Skip to content

Commit db1303a

Browse files
committed
ci: gate docker publish with local checks
1 parent cb4faff commit db1303a

2 files changed

Lines changed: 36 additions & 0 deletions

File tree

.github/workflows/docker-publish.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,32 @@ env:
1515
CONTAINER_IMAGE: ghcr.io/${{ github.repository }}
1616

1717
jobs:
18+
validate:
19+
name: Validate container release gates
20+
runs-on: ubuntu-latest
21+
timeout-minutes: 30
22+
permissions:
23+
contents: read
24+
25+
steps:
26+
- name: Checkout repository
27+
uses: actions/checkout@v4
28+
29+
- name: Set up Go
30+
uses: actions/setup-go@v5
31+
with:
32+
go-version-file: go.mod
33+
cache: true
34+
cache-dependency-path: |
35+
go.mod
36+
go.sum
37+
38+
- name: Run container release gates
39+
run: ./scripts/ci.sh workflow-lint hygiene release-hygiene container-hygiene tidy test
40+
1841
build:
1942
runs-on: ubuntu-latest
43+
needs: validate
2044
permissions:
2145
contents: read
2246
packages: write

scripts/ci.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,18 @@ container_hygiene() {
148148
printf 'docker workflows must authenticate against ghcr.io when pushing\n' >&2
149149
return 1
150150
fi
151+
if ! git grep -nF 'name: Validate container release gates' -- "$publish" >/dev/null; then
152+
printf 'docker publish workflow must validate repository gates before building images\n' >&2
153+
return 1
154+
fi
155+
if ! git grep -nF './scripts/ci.sh workflow-lint hygiene release-hygiene container-hygiene tidy test' -- "$publish" >/dev/null; then
156+
printf 'docker publish validate job must run local release gates\n' >&2
157+
return 1
158+
fi
159+
if ! git grep -nF 'needs: validate' -- "$publish" >/dev/null; then
160+
printf 'docker publish build job must depend on validate\n' >&2
161+
return 1
162+
fi
151163
if ! git grep -nF 'image: ${VOHIVE_IMAGE:-ghcr.io/boa-z/vohive:latest}' -- "$compose" >/dev/null; then
152164
printf 'prebuilt compose file must default to the current GHCR image\n' >&2
153165
return 1

0 commit comments

Comments
 (0)