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:
1 parent
e8ff3b94cd
commit
a069fffa5b
1 file changed
+9
-9
@@ -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"
|
||||
|
||||
|
||||
Reference in new issue
Block a user