ci: gate image publish on v* tag (trigger standard)

This commit is contained in:
2026-06-16 08:41:48 +02:00
parent 1f25aa318f
commit f32abf3686
+6 -5
View File
@@ -1,5 +1,5 @@
# Build the Crucible image. PR-first (D7): PRs build only; push to main also # Build the Crucible image (D7 trigger standard): PRs/main build only; tag `v*`
# publishes registry.westgate.pw/deployment/crucible:<git-sha>. Never a mutable tag. # publishes registry.westgate.pw/deployment/crucible:<sha>. Never a mutable tag.
# #
# Daemonless: the host-mode runner has no container runtime, so the image is # Daemonless: the host-mode runner has no container runtime, so the image is
# built by Nix (`nix build .#image`, see flake.nix) and pushed with skopeo # built by Nix (`nix build .#image`, see flake.nix) and pushed with skopeo
@@ -7,9 +7,10 @@
name: build-image name: build-image
on: on:
pull_request:
push: push:
branches: [main] branches: [main]
pull_request: tags: ['v*']
env: env:
REGISTRY: registry.westgate.pw REGISTRY: registry.westgate.pw
@@ -29,9 +30,9 @@ jobs:
- name: Build OCI image (daemonless) - name: Build OCI image (daemonless)
run: nix build .#image run: nix build .#image
# Publish only on main (post-merge). PRs verify the build but never push. # Publish only on a v* tag push. PRs and main pushes build but never push.
- name: Publish image - name: Publish image
if: github.event_name == 'push' && github.ref == 'refs/heads/main' if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
env: env:
REGISTRY_USER: ${{ secrets.REGISTRY_USER }} REGISTRY_USER: ${{ secrets.REGISTRY_USER }}
REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }} REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }}