Skip to content

Commit 6e8682f

Browse files
authored
Fix nightly release: scope homebrew cask to vigilante archives, gate publish to main (#464)
* ci: scope homebrew cask to vigilante archive id and gate nightly publish to main The nightly release was failing at the homebrew cask stage with: one tap can handle only one archive of an OS/Arch combination. Consider using ids in the homebrew_casks section Both `vigilante` and `gh-sandbox` produce Linux amd64/arm64 archives, so the unscoped homebrew_casks entry tried to template both into a single cask and collided. Filter the cask to the `release-archives` archive id (which already pins to the `vigilante` build) so gh-sandbox artifacts are excluded from the cask template while still shipping as release assets. Also harden the workflow so it only publishes/updates external artifacts when running on `main`. Non-main pushes (currently used as a temporary verification branch for this fix) exercise the goreleaser build step but skip the rolling prerelease, nightly verification, and Homebrew tap update. The `main`-only gates are the permanent behavior; the branch entry under `on.push.branches` is temporary and will be removed once this run is confirmed green. Local verification: - goreleaser check — pass - goreleaser release --snapshot --clean --skip=publish — pass; the generated dist/homebrew/Casks/vigilante.rb references only the vigilante archives (macOS amd64/arm64, Linux amd64). * ci: make environment and tap-token step main-only for nightly Branch pushes hit environment protection rules before the job could even start, because the job unconditionally required environment `main` and that environment is gated to `main`. Make the environment conditional so non-main verification pushes still build the goreleaser snapshot, and gate the `Get token for Homebrew tap` step to main since its secrets are only available inside the `main` environment. On main pushes the behavior is identical to before. * ci: remove temporary branch entry from nightly trigger Nightly run 24846173714 on this branch succeeded with the goreleaser homebrew_casks fix in place (build step passed; publish/tap steps correctly skipped off-main). Drop the temporary branch entry from the push trigger list so nightly only fires on main again. The permanent main-only gates on the publish/verify/tap steps and the conditional `environment: main` stay in place as a safety net.
1 parent 18c1c21 commit 6e8682f

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

.github/workflows/nightly.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ permissions:
1111
jobs:
1212
prerelease:
1313
runs-on: ubuntu-latest
14-
environment: main
14+
# Only gate production secrets behind the protected `main` environment on main pushes;
15+
# verification runs on other branches build without access to publish credentials.
16+
environment: ${{ github.ref == 'refs/heads/main' && 'main' || '' }}
1517
steps:
1618
- name: Check out repository
1719
uses: actions/checkout@v6
@@ -48,6 +50,7 @@ jobs:
4850
run: goreleaser check
4951

5052
- name: Get token for Homebrew tap
53+
if: github.ref == 'refs/heads/main'
5154
uses: actions/create-github-app-token@v3
5255
id: tap_token
5356
with:
@@ -65,6 +68,7 @@ jobs:
6568
run: goreleaser release --snapshot --clean
6669

6770
- name: Publish rolling prerelease
71+
if: github.ref == 'refs/heads/main'
6872
env:
6973
GH_TOKEN: ${{ github.token }}
7074
NIGHTLY_TAG: ${{ env.NIGHTLY_TAG }}
@@ -96,19 +100,22 @@ jobs:
96100
--prerelease
97101
98102
- name: Verify nightly release publication
103+
if: github.ref == 'refs/heads/main'
99104
env:
100105
GH_TOKEN: ${{ github.token }}
101106
NIGHTLY_TAG: ${{ env.NIGHTLY_TAG }}
102107
NIGHTLY_VERSION: ${{ env.NIGHTLY_VERSION }}
103108
run: bash ./scripts/verify-nightly-release.sh
104109

105110
- name: Check out Homebrew tap
111+
if: github.ref == 'refs/heads/main'
106112
env:
107113
TAP_TOKEN: ${{ steps.tap_token.outputs.token }}
108114
run: |
109115
git clone "https://x-access-token:${TAP_TOKEN}@github.com/aliengiraffe/homebrew-spaceship.git" "$RUNNER_TEMP/homebrew-spaceship"
110116
111117
- name: Update nightly Homebrew cask
118+
if: github.ref == 'refs/heads/main'
112119
env:
113120
CHECKSUMS_FILE: dist/checksums.txt
114121
NIGHTLY_TAG: ${{ env.NIGHTLY_TAG }}
@@ -117,6 +124,7 @@ jobs:
117124
run: ./scripts/update-nightly-cask.sh
118125

119126
- name: Push nightly Homebrew cask
127+
if: github.ref == 'refs/heads/main'
120128
working-directory: ${{ runner.temp }}/homebrew-spaceship
121129
run: |
122130
git config user.name "github-actions[bot]"

.goreleaser.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ release:
6969

7070
homebrew_casks:
7171
- name: vigilante
72+
ids:
73+
- release-archives
7274
repository:
7375
owner: aliengiraffe
7476
name: homebrew-spaceship

0 commit comments

Comments
 (0)