ReviewOS

also looking at this

craft-native/craft

fix(release): stop shipping the wrong binaries, and delete the dead notifier

#43
Merged glennmichael123 wants to merge fix/release-artifact-hygiene into main
2 files +24 -28
.github/workflows/release.ymlmodified+18-26
Changes to .github/workflows/release.yml
@@ -66,7 +66,11 @@ jobs:
6666 mkdir -p zig-out/cross/darwin-x64 && cp zig-out/bin/craft zig-out/cross/darwin-x64/craft
6767 echo "::endgroup::"
6868
69 # Restore native ARM64 binary
69 # Restore native ARM64 binary. `zig-out/bin` is cleared first because
70 # the publish step zips that directory whole and unfiltered, so
71 # anything a cross build left in it ships to users under the host's
72 # archive name.
73 rm -rf zig-out/bin
7074 eval "$(pantry env | sed -n '/^export /,$p')" && zig build -Doptimize=ReleaseSafe -Dversion="$VERSION"
7175
7276 - name: First-party Zig dependencies
@@ -93,7 +97,12 @@ jobs:
9397 echo "::endgroup::"
9498 done
9599
96 # Restore native linux-x64 binary
100 # Restore native linux-x64 binary. Clearing `zig-out/bin` first is
101 # load-bearing: the windows cross build above leaves craft.exe there,
102 # nothing removes it, and the publish step zips the whole directory —
103 # so craft-linux-x64.zip shipped a Windows PE binary alongside the
104 # Linux one.
105 rm -rf zig-out/bin
97106 eval "$(pantry env | sed -n '/^export /,$p')" && zig build -Doptimize=ReleaseSafe -Dversion="$VERSION"
98107
99108 # ── macOS Code Signing & Notarization ──────────────────────────
@@ -199,6 +208,13 @@ jobs:
199208 release: 'true'
200209 release-changelog: CHANGELOG.md
201210 release-token: ${{ secrets.PAT_TOKEN || secrets.GITHUB_TOKEN }}
211 # Replaces the old `notify` job, which pointed at
212 # .github/actions/discord-notify — a path that has never existed in
213 # this repository. Its `hashFiles` guard skipped the only real step,
214 # so the job checked out the repo, did nothing and reported success:
215 # a failed release looked notified. The action does this natively.
216 discord-webhook: ${{ secrets.DISCORD_WEBHOOK_URL }}
217 notification-title: craft ${{ github.ref_name }}
202218 env:
203219 GITHUB_TOKEN: ${{ secrets.PAT_TOKEN || secrets.GITHUB_TOKEN }}
204220
@@ -224,27 +240,3 @@ jobs:
224240 run: pantry publish --npm --access public
225241 env:
226242 NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
227
228 notify:
229 name: discord-notification
230 needs: [pantry, npm]
231 if: always()
232 runs-on: ubuntu-latest
233 steps:
234 - uses: actions/checkout@v6
235 - uses: ./.github/actions/discord-notify
236 if: hashFiles('.github/actions/discord-notify/action.yml') != ''
237 with:
238 title: "Release $ — $"
239 description: "craft $ has been released"
240 status: ${{ needs.pantry.result == 'success' && needs.npm.result == 'success' && 'success' || (needs.pantry.result == 'cancelled' || needs.npm.result == 'cancelled') && 'warning' || 'failure' }}
241 fields: |
242 [
243 {"name": "Tag", "value": "`$`", "inline": true},
244 {"name": "Actor", "value": "$", "inline": true},
245 {"name": "Binaries", "value": "$", "inline": true},
246 {"name": "npm Packages", "value": "$", "inline": true},
247 {"name": "Release", "value": "[View on GitHub](https://github.com/$/releases/tag/$)", "inline": true}
248 ]
249 webhook_url: ${{ secrets.DISCORD_WEBHOOK_URL }}
250 continue-on-error: true