Skip to content

Releases: MerlijnW70/knapsack

v0.0.2

28 May 18:44
92269bd

Choose a tag to compare

fix(release): use gh CLI instead of softprops/action-gh-release@v2 (#7)

* fix(release): serialize release creation to kill matrix race

v0.0.2's first tag-push produced an incomplete release because all
four matrix jobs raced to create the same Release object via
softprops/action-gh-release@v2. Linux + Windows lost with:

  HttpError: Validation Failed:
  {"resource":"Release","code":"already_exists","field":"tag_name"}

aarch64-apple-darwin's job reported success but its assets silently
never landed (overwritten in the race window). Only x86_64-apple-darwin
shipped on the first attempt.

Fix: split into two phases.

1. New `create-release` job runs ONCE before the matrix and
   idempotently makes the Release object exist.
2. `build` matrix jobs `needs: create-release` and call
   softprops/action-gh-release@v2 in upload-only mode — the release
   already exists, so no create-race is possible.

Also split publish-step by matrix.kind: unix jobs only list .tar.gz
files, Windows jobs only list .zip files. Removes the noisy "Pattern
... does not match any files" warnings and makes the intent explicit.

`scripts` job (install.sh, install.ps1) unchanged — it already
`needs: build` so it only runs after the matrix is green.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* fix(release): use gh CLI instead of softprops/action-gh-release@v2

Refines 4a9485a after observing that gh run rerun --failed did NOT
recover the v0.0.2 release. Even with the Release object existing
(it was created by macos-x86_64 winning the first race), every
subsequent softprops/action-gh-release@v2 invocation that supplies
tag_name throws the same HttpError on a PATCH the action makes
internally:

  Validation Failed: {"resource":"Release","code":"already_exists",
                     "field":"tag_name"}

The bug is in the action's own update path, not the matrix race —
which means the previous fix (split create / upload-only) was
necessary but not sufficient. Replace the action entirely with `gh`
CLI calls, which issue per-asset POSTs and do not touch the release
object's tag_name:

  - create-release: `gh release create "$tag" || (release exists, no-op)`
  - upload (unix):  `gh release upload "$tag" <tar.gz + sha256> --clobber`
  - upload (win):   `gh release upload "$tag" <zip + sha256> --clobber`
  - scripts:        `gh release upload "$tag" install.sh install.ps1 --clobber`

`gh` is preinstalled on all GitHub-hosted runners; only GH_TOKEN is
required and is supplied via the workflow's own GITHUB_TOKEN.

CHANGELOG entry updated to reflect the deeper diagnosis and the
final fix shape (gh CLI, not softprops).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: intentos-dev <intentosapp@gmail.com>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>