mirror of
https://github.com/lobaro/restic-backup-docker.git
synced 2026-11-13 23:45:24 +00:00
ci: require a green test run before publishing images
test.yml becomes callable; docker-publish.yml runs it as a gate job on master and tag pushes and builds only when it succeeded. Pull requests keep running test.yml directly, so nothing runs twice. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
db408b9145
commit
52709929f3
2 files changed
+17
-4
No files matched your search
@@ -21,8 +21,20 @@ env:
|
||||
|
||||
|
||||
jobs:
|
||||
build:
|
||||
# Publish gate: the test suite must pass before an image is built and pushed
|
||||
# on master or a release tag. Pull requests already run test.yml directly and
|
||||
# only build here without pushing, so the suite is skipped for them.
|
||||
tests:
|
||||
if: github.event_name != 'pull_request'
|
||||
permissions:
|
||||
contents: read
|
||||
uses: ./.github/workflows/test.yml
|
||||
|
||||
build:
|
||||
needs: tests
|
||||
# A skipped `tests` job (pull requests) would skip `build` as well, hence
|
||||
# the explicit condition. Failed or cancelled tests never publish.
|
||||
if: ${{ !cancelled() && (github.event_name == 'pull_request' || needs.tests.result == 'success') }}
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
name: Test
|
||||
|
||||
# Pull requests run this workflow directly. Pushes to master and v*.*.* tags run
|
||||
# it as the gate of docker-publish.yml (workflow_call), so the suite runs exactly
|
||||
# once per event and an image is never published without it.
|
||||
on:
|
||||
push:
|
||||
branches: [ "master" ]
|
||||
tags: [ "v*.*.*" ]
|
||||
pull_request:
|
||||
branches: [ "master" ]
|
||||
workflow_call:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
Reference in new issue
Block a user