ci, action: tag-only image publish, nu tasks, 0.9.0 action cutover

Merged
SW
1d ago
+155-60

Three CI and action fixes.

Release image job: write permissions only on tags

The image job also ran on pull requests that touch the image, with packages: write, id-token: write and attestations: write, while it ran the PR's image:build and image:smoke. Now:

  • image (still named "Container image") builds and smoke-tests with contents: read only. On a tag it uploads what image:push needs as the image artifact: image.tar (the index the smoke test ran), the apk cache, the local packages and the SBOMs.
  • image-publish runs only on push (tags). It downloads that artifact, logs in to GHCR, runs image:push and attests. It is the only job with the package, OIDC and attestation write permissions. image:push still refuses to publish an index other than the tested one.
  • release now needs image-publish and downloads only the dist-* artifacts, so the image artifact never ends up as a release asset.

No new actions, so actions.lock needs no change.

Workflow shell moved into nu tasks

  • release:check-tag <tag> reads patchula-cli's version from cargo metadata --locked instead of picking apart cargo pkgid output.
  • release:smoke <platform> unpacks the platform's archive and checks that patchula --version matches the archive's version exactly (before, it only checked for some semver). The smoke job now checks out the repo and installs nu through mise to run it.
  • action:pin-release looks up the latest release, writes its schema over the tests/action/PatchulaConfig.pkl symlink and sets version in GITHUB_OUTPUT. It clears MISE_ENABLE_TOOLS for its own mise exec, and the workflow sets that variable only on the steps that need it, so the composite action's mise exec never inherits it.

The composite action.yml keeps its bash run: steps, because it runs in other repositories where this repo's tasks don't exist.

Tested locally: release:check-tag passes on v0.9.0 and fails on v0.8.0. release:smoke passes on the real v0.9.0 linux-x64-musl archive and fails when the archive is missing. action:pin-release with stand-in env vars pinned 0.9.0, wrote the schema in place of the symlink and left the root PatchulaConfig.pkl untouched. nu-lint, jactionlint and zizmor are clean.

action.yml: hard cutover to 0.9.0+

I removed the fallback that passed --cache as the SQLite file (releases up to 0.4.0) and the one that keyed the cache by version for releases without patchula cache schema. 0.9.0 is the first release with cache schema (#325). If the installed binary has no working cache schema, whether it came from version or binary, the action now fails the step with an error that names the binary and asks for 0.9.0 or later. The cache key format (…-s<schema>-…) is unchanged, so existing caches still restore. The inputs' descriptions and guide/github-actions.md now give the minimum version.

Follow-ups (not in this PR)

  • The threat model and lockfile guide contradict each other on lockfile tools running repository code. That is fixed by making the tools stop running it, in a separate PR, not by an exception in the threat model.
  • nix gets the installation token (github_token()), not a repository-scoped one. It runs no repository code, but the "credential no wider than its reach" rule may call for a scoped token there, as gh-actions-lock gets.
  • Nothing dropped.