Skip to content

Commit 4f9b6ee

Browse files
chore: add dry-run mode to release workflow
Add workflow_dispatch trigger with dry-run input (defaults to true). In dry-run mode: Docker images are built but not pushed, cosign signing is skipped, and crates.io publish is skipped. Enables testing the full build pipeline without side effects. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 4e6cc19 commit 4f9b6ee

1 file changed

Lines changed: 32 additions & 5 deletions

File tree

.github/workflows/release.yml

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,18 @@ on:
33
push:
44
tags:
55
- "v*"
6+
workflow_dispatch:
7+
inputs:
8+
dry-run:
9+
description: "Dry run — build and verify without pushing images or publishing"
10+
type: boolean
11+
default: true
612
permissions:
713
contents: read
814
packages: write
915
id-token: write
16+
env:
17+
DRY_RUN: ${{ github.event_name == 'workflow_dispatch' && inputs.dry-run == true }}
1018
jobs:
1119
test:
1220
runs-on: ubuntu-latest
@@ -56,56 +64,75 @@ jobs:
5664
name: initium-arm64
5765
path: bin/
5866
- run: mv bin/initium bin/initium-arm64 && chmod +x bin/initium-arm64
67+
- name: Verify binaries
68+
run: |
69+
file bin/initium-amd64 bin/initium-arm64
70+
echo "amd64 size: $(du -h bin/initium-amd64 | cut -f1)"
71+
echo "arm64 size: $(du -h bin/initium-arm64 | cut -f1)"
5972
- uses: sigstore/cosign-installer@v3
73+
if: env.DRY_RUN == 'false'
6074
- uses: docker/setup-buildx-action@v3
6175
- uses: docker/login-action@v3
76+
if: env.DRY_RUN == 'false'
6277
with:
6378
registry: ghcr.io
6479
username: ${{ github.actor }}
6580
password: ${{ secrets.GITHUB_TOKEN }}
6681
- name: Extract version
6782
id: version
68-
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> "$GITHUB_OUTPUT"
69-
- uses: docker/build-push-action@v6
83+
run: |
84+
if [[ "$GITHUB_REF" == refs/tags/v* ]]; then
85+
echo "VERSION=${GITHUB_REF#refs/tags/v}" >> "$GITHUB_OUTPUT"
86+
else
87+
echo "VERSION=dry-run-$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT"
88+
fi
89+
- name: Build initium image
90+
uses: docker/build-push-action@v6
7091
id: build-main
7192
with:
7293
context: .
7394
platforms: linux/amd64,linux/arm64
74-
push: true
95+
push: ${{ env.DRY_RUN == 'false' }}
7596
tags: |
7697
ghcr.io/kitstream/initium:${{ steps.version.outputs.VERSION }}
7798
ghcr.io/kitstream/initium:latest
7899
sbom: true
79100
provenance: true
80101
- name: Sign initium image
102+
if: env.DRY_RUN == 'false'
81103
run: cosign sign --yes ghcr.io/kitstream/initium@${{ steps.build-main.outputs.digest }}
82104
- name: SBOM attestation for initium image
105+
if: env.DRY_RUN == 'false'
83106
run: |
84107
cosign attest --yes --type spdx \
85108
--predicate <(docker buildx imagetools inspect ghcr.io/kitstream/initium@${{ steps.build-main.outputs.digest }} --format '{{json (index .SBOM "linux/amd64").SPDX}}') \
86109
ghcr.io/kitstream/initium@${{ steps.build-main.outputs.digest }}
87-
- uses: docker/build-push-action@v6
110+
- name: Build initium-jyq image
111+
uses: docker/build-push-action@v6
88112
id: build-jyq
89113
with:
90114
context: .
91115
file: Dockerfile.jyq
92116
platforms: linux/amd64,linux/arm64
93-
push: true
117+
push: ${{ env.DRY_RUN == 'false' }}
94118
tags: |
95119
ghcr.io/kitstream/initium-jyq:${{ steps.version.outputs.VERSION }}
96120
ghcr.io/kitstream/initium-jyq:latest
97121
sbom: true
98122
provenance: true
99123
- name: Sign initium-jyq image
124+
if: env.DRY_RUN == 'false'
100125
run: cosign sign --yes ghcr.io/kitstream/initium-jyq@${{ steps.build-jyq.outputs.digest }}
101126
- name: SBOM attestation for initium-jyq image
127+
if: env.DRY_RUN == 'false'
102128
run: |
103129
cosign attest --yes --type spdx \
104130
--predicate <(docker buildx imagetools inspect ghcr.io/kitstream/initium-jyq@${{ steps.build-jyq.outputs.digest }} --format '{{json (index .SBOM "linux/amd64").SPDX}}') \
105131
ghcr.io/kitstream/initium-jyq@${{ steps.build-jyq.outputs.digest }}
106132
publish:
107133
runs-on: ubuntu-latest
108134
needs: [docker]
135+
if: ${{ !(github.event_name == 'workflow_dispatch' && inputs.dry-run == true) }}
109136
steps:
110137
- uses: actions/checkout@v4
111138
- uses: dtolnay/rust-toolchain@stable

0 commit comments

Comments
 (0)