feat: chained release-publish-oci workflow for service repos - #93
Conversation
|
Review notes. CI is red on this branch
Nested reusable workflows referenced by relative path
Either switch both to the explicit form, or confirm on the companion run that the relative form resolves against this repo before adopting the workflow elsewhere. No path to complete a release whose publish step failed
Given that the stated goal is removing a manual recovery step, a Related: a called workflow's
|
release-please creates tags with GITHUB_TOKEN, and GitHub never fires workflows from bot-token events — so per-repo `on: push: tags` publish workflows silently do not run. The field workaround (delete + re-push the tag) triggers them but flips the GitHub release to Draft, which is how orphaned draft releases appeared in scopes-lambda. Make chaining the standard instead: - release.yml now declares workflow_call outputs (release_created, tag_name) so callers can gate downstream jobs in the same run. - New release-publish-oci.yml: release-please -> docker build+push ECR -> np artifact registration -> release finalize, all in one workflow run. The finalize step appends the artifact block (image, digest, pinned reference, artifact id) to the release body so consumers can copy the exact pinned image, and force-publishes the release (also repairing any draft state). Service repos need only a ~12-line caller on push:main; no PAT or GitHub App token required anywhere. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
id integrity, declared registration, preflight, pushed-tag row - existing_tag input: skip release-please and publish+finalize an already-created tag (completes a half-finished release, backfills pre-pipeline tags); finalize upserts the release when none exists. - preflight job fails before release-please cuts anything when the caller omits id-token: write (called workflows can only narrow the caller's token; the runner exposes the OIDC endpoint only when granted, making it detectable up front). - Image row uses docker-build-push-ecr's image_tag output (the tag actually pushed after prefix stripping) instead of re-deriving from the git tag. - Artifact id integrity: stdout-only capture (stderr stays on the run log), a create failure fails the step, and a created-but-unparsed id reports "registered (id unavailable)" with a warning — never a false "not registered". The release-body step still runs on registration failure (release must not stay draft) while the job stays red. - register_artifact input (default true) makes registration a declared choice: missing key/NRN wiring is now an error, not a silent skip. - np_cli_version input + curl -fsSL + pipefail for the CLI install. - Release lookup: direct releases/tags/<tag> first, list fallback for drafts; body PATCHed from file. - Expose aws_region, build_args, also_tag_latest passthroughs; scope registration env to its step; shellcheck SC2016 annotated (markdown backticks); README summary row + section; release.yml display name tofu-release -> release (cosmetic, nothing else changed). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
9b4dae3 to
2dc2925
Compare
|
Thanks for the thorough pass — everything addressed in the latest push (rebased onto main, so #91's tag fix is in the base). Point by point: CI red / SC2016 — fixed; the backticks are markdown in a printf format, so it's an annotated Nested No recovery path — added Image row vs pushed tag — took your durable option: post-#91 Artifact ID dropped silently — fixed exactly as described: stdout-only capture (stderr stays on the run log), a create failure fails the step, and a created-but-unparsed id reports Registration skip inferred — added CLI install — Smaller items — all taken: registry/repository split — confirmed against reality rather than docs: scopes-lambda's existing |
Summary
Standardizes the release pipeline for service repos that ship an OCI image (scopes-lambda and the many similar repos coming), fixing two field problems at the root:
GITHUB_TOKEN, and GitHub never fires workflows from bot-token events — soon: push: tagspublish workflows silently did not run. The manual workaround (delete + re-push the tag) works once but flips the GitHub release to Draft (that is where scopes-lambda's draft v0.3.0/v0.3.1 came from).Change
release.yml: declareworkflow_calloutputs (release_created,tag_name) so callers can chain jobs in the same run.New
release-publish-oci.yml— the standard chain, one workflow run, zero cross-workflow triggers (so the bot-token limitation is structurally irrelevant, no PAT needed):release-please→ (if release_created) →docker-build-push-ecr→np artifact create→ finalize: append an Artifact section (image, digest, pinnedimage@digestreference, artifact id) to the release body and force-publish it (draft=false, which also self-repairs any draft orphaned by a tag delete/re-push).Per-repo adoption is a ~12-line caller (see the header comment in the workflow). Artifact registration is optional per repo: skipped cleanly when the
artifact_np_api_keysecret /NP_ARTIFACT_NRNvar are absent.Test plan
🤖 Generated with Claude Code