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

Merged
eric.bus merged 1 commits from ci/build-on-tags into main 2026-11-23 09:23:14 +01:00
Showing only changes of commit a069fffa5b - Show all commits
+9 -9
View File
@@ -1,16 +1,12 @@
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:
push:
branches:
- main
paths:
- 'Dockerfile'
- 'composer.json'
- 'composer.lock'
- '.gitea/workflows/build-docker.yml'
- 'version' # Change this file to force rebuild
tags:
- 'v*'
jobs:
build:
@@ -19,6 +15,8 @@ jobs:
env:
REGISTRY: git.gooienmeer.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:
- name: Checkout
@@ -34,12 +32,14 @@ jobs:
- name: Build image
run: |
docker build \
-t "$IMAGE:$VERSION" \
-t "$IMAGE:${{ gitea.sha }}" \
-t "$IMAGE:latest" \
.
- name: Push image
run: |
docker push "$IMAGE:$VERSION"
docker push "$IMAGE:${{ gitea.sha }}"
docker push "$IMAGE:latest"