Added workflow

This commit is contained in:
2026-03-27 18:51:01 +01:00
parent df1e422a63
commit f4d9e007e2
2 changed files with 46 additions and 4 deletions

View File

@@ -0,0 +1,41 @@
name: Build Docker image on push
on:
push:
branches:
- '**'
jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set variables
shell: bash
run: |
echo "IMAGE_NAME=gitea.lostak.dev/lostakj/opendkim" >> "$GITHUB_ENV"
echo "IMAGE_TAG=${GITHUB_SHA::7}" >> "$GITHUB_ENV"
- name: Login to Gitea registry
shell: bash
run: |
echo "${{ secrets.REGISTRY_TOKEN }}" | docker login gitea.lostak.dev -u "${{ secrets.REGISTRY_USER }}" --password-stdin
- name: Create buildx builder
shell: bash
run: |
docker buildx create --name ci-builder --use || docker buildx use ci-builder
docker buildx inspect --bootstrap
- name: Build and push image
shell: bash
run: |
docker buildx build \
--platform linux/amd64 \
-t "${IMAGE_NAME}:${IMAGE_TAG}" \
.

View File

@@ -1,9 +1,9 @@
name: Build and push Docker image on push name: Build and push Docker image on tag
on: on:
push: push:
branches: tags:
- '**' - '*'
jobs: jobs:
docker: docker:
@@ -19,6 +19,7 @@ jobs:
shell: bash shell: bash
run: | run: |
echo "IMAGE_NAME=gitea.lostak.dev/lostakj/opendkim" >> "$GITHUB_ENV" echo "IMAGE_NAME=gitea.lostak.dev/lostakj/opendkim" >> "$GITHUB_ENV"
echo "IMAGE_TAG=${GITHUB_REF_NAME}" >> "$GITHUB_ENV"
- name: Login to Gitea registry - name: Login to Gitea registry
shell: bash shell: bash
@@ -36,6 +37,6 @@ jobs:
run: | run: |
docker buildx build \ docker buildx build \
--platform linux/amd64 \ --platform linux/amd64 \
-t "${IMAGE_NAME}:latest" \ -t "${IMAGE_NAME}:${IMAGE_TAG}" \
--push \ --push \
. .