Skip to content

Add a shared publish workflow for Docker images - #20

Merged
KOliver94 merged 4 commits into
mainfrom
shared-publish
Nov 20, 2026
Merged

KOliver94 merged 4 commits into
mainfrom
shared-publish

Conversation

@KOliver94

Copy link
Copy Markdown
Member

Adds .github/workflows/shared-publish.yml, a reusable workflow that builds, pushes and attests Docker images for ghcr.io, so request-manager, backstage and Raktr stop carrying near-identical publish workflows and their own copies of the git describe version recipe.

What changes

  • shared-publish.yml (workflow_call) runs three jobs:
    • Version checks nothing out: a tag build gets the tag without its v, every other build 0.0.0+<sha7>. It also outputs revision, the same seven characters.
    • Build runs on pull requests only, with contents: read and no secrets, and pushes nothing.
    • Publish runs on every other event: it logs in to ghcr.io, pushes, and writes a build provenance attestation (push-to-registry: false). It passes the Sentry token to the build on tag builds only.
  • .github/actions/docker-build: the build steps both jobs share. It checks out, names the image ghcr.io/<owner>/<repo>[/<component>] in lowercase, keeps the existing four tag rules, and passes VERSION and REVISION plus any extra build-args. The token becomes the BuildKit secret SENTRY_AUTH_TOKEN when one is given. GHA cache is scoped per image, with provenance and sbom off.
  • Inputs: images is a JSON list of {component, context, file?}, passed as a block scalar because the convention allows no flow maps. The default is one image from .. build-args takes extra arguments, and the optional secret sentry-auth-token carries the token. The version output gives the version to the caller's later jobs.
  • Convention:
    • docs/workflows.md drops the build-and-push exception from "No code from a pull request runs with a write scope"; only the labeling case remains. It now says that a job calling a reusable workflow only sets the most the called jobs may hold.
    • New section: "Calling the shared publish workflow", with a copyable caller.
    • New checker rule, with tests: a step in a reusable workflow that uses a ./… action is reported, since that path resolves against the caller's checkout; the workflow's own actions are reached through $/.
  • Tests: a Docker build job in test.yml builds a throwaway image (test/docker-build) through the composite action without pushing, and checks the image name it reports.
  • Config: .github/actionlint.yaml ignores actionlint's $/ error for every shared-*.yml, not only shared-checks.yml.

For reviewers

  • Callers grant contents: read, packages: write, id-token: write and attestations: write on their uses: job. A called workflow can only narrow scopes, so Build runs with contents: read.
  • Because the attestation is signed by this repository's workflow, verifying an image outside BSStudio (Raktr, owner mboldi) needs --signer-repo BSStudio/.github.
  • Each repository's first build after it switches over starts with an empty cache, because the cache is now keyed by image name.
  • This PR's Docker build job is the first real run of the composite action. shared-publish.yml itself first runs when request-manager switches to it, after this is released as v1.3.0.

@KOliver94
KOliver94 merged commit 14e6dea into main Nov 20, 2026
8 checks passed
@KOliver94
KOliver94 deleted the shared-publish branch November 20, 2026 20:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant