ci: build the release image on version tags instead of pushes to main

- Triggers on every pushed v* tag, regardless of which files changed
  (no more paths filter / 'version' file bump needed)
- Image is tagged with the version (e.g. v3.0.2), the commit sha and latest

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
eric.busandClaude Opus 5.5 committed 2026-11-23 09:20:41 +01:00
1 parent e8ff3b94cd
commit a069fffa5b
1 file changed
+9 -9
+9 -9
View File
@@ -1,16 +1,12 @@
name: Build and Deploy name: Build and Deploy
run-name: ${{ gitea.actor }} is building ${{ gitea.repository }} run-name: ${{ gitea.actor }} is building ${{ gitea.repository }} ${{ gitea.ref_name }}
# Builds a release image for every new version tag (v1.2.3), regardless of
# which files changed. Pushes to main no longer trigger a build.
on: on:
push: push:
branches: tags:
- main - 'v*'
paths:
- 'Dockerfile'
- 'composer.json'
- 'composer.lock'
- '.gitea/workflows/build-docker.yml'
- 'version' # Change this file to force rebuild
jobs: jobs:
build: build:
@@ -19,6 +15,8 @@ jobs:
env: env:
REGISTRY: git.gooienmeer.nl REGISTRY: git.gooienmeer.nl
IMAGE: git.gooienmeer.nl/nh_gooi/nhgooi.nl IMAGE: git.gooienmeer.nl/nh_gooi/nhgooi.nl
# The tag that triggered this build, e.g. v3.0.2
VERSION: ${{ gitea.ref_name }}
steps: steps:
- name: Checkout - name: Checkout
@@ -34,12 +32,14 @@ jobs:
- name: Build image - name: Build image
run: | run: |
docker build \ docker build \
-t "$IMAGE:$VERSION" \
-t "$IMAGE:${{ gitea.sha }}" \ -t "$IMAGE:${{ gitea.sha }}" \
-t "$IMAGE:latest" \ -t "$IMAGE:latest" \
. .
- name: Push image - name: Push image
run: | run: |
docker push "$IMAGE:$VERSION"
docker push "$IMAGE:${{ gitea.sha }}" docker push "$IMAGE:${{ gitea.sha }}"
docker push "$IMAGE:latest" docker push "$IMAGE:latest"