Skip to content

Workflow artifact release

github-actions[bot] edited this page Nov 7, 2026 · 2 revisions

artifact-release

What it does. For anything that is a file rather than an image (a .deb, a firmware binary, an offline bundle): runs your build command, then publishes the matching files to the GitHub release with a SHA256SUMS, a keyless cosign signature bundle per file and build provenance. No secret anywhere.

Why it exists. Three repositories each built a file by hand and attached it to a release with nothing a downloader could verify. This is the container release's supply-chain story for a file.

Publishing is an allow-list. The publish job, and each step in it that signs, attests or uploads, runs only for an event named in allowed-publish-events (default push; a caller triggered by release: published sets push,release) on a refs/tags/v<semver> (SemVer 2.0.0: no leading zeroes, no empty identifiers) ref. An existing release is only completed: every asset must be absent or already there with the identical sha256 digest. Nothing is replaced; a differing asset fails the run and names it, and that version is burned. The asset set is read again after the upload and must hold exactly this build's files with identical digests, or the run fails. Concurrent writers to the same release are unsupported. The release must hold exactly the files this build produced: an asset that is not part of the build (an extra asset) is treated like a differing one and fails the run, before and after the upload. All assets are read through the paginated asset listing, so a release with more than one page of assets is checked in full. The release is looked up by its HTTP status (a 404 means no release; any other failure stops the run). Every local file name must follow the asset naming policy, checked before any release call: ASCII letters, digits, ., _ and -, starting and ending with a letter or digit (an uploaded name that GitHub changed would break the exact comparison). This is a conservative repository naming policy, stricter than what GitHub documents: GitHub documents renaming for special characters and leading or trailing periods, and the policy also refuses names that start or end with _ or -. Existing callers whose build produces such a name (spaces, +, non-ASCII, a leading or trailing _ or -) must rename the file in their build-command before re-pinning; the run fails before any release call, so nothing is half-published. Every remote asset, extras included, must be in state uploaded, and no name may occur twice. Listing pages are validated as an array of arrays of objects before they are read, so a malformed listing stops the run. Behavior change: a new release created for a SemVer prerelease tag (for example v1.2.3-rc.1; build metadata alone, v1.2.3+build.1, is not a prerelease) is now marked as a prerelease with --prerelease, so it is not shown as the latest release; earlier versions of this workflow never set the flag. Hidden files (names beginning with .) in the staging directory are rejected by the naming policy rather than silently skipped. Names that differ only in letter case (for example A.whl and a.whl) are refused as well, as a conservative naming policy: GitHub's exact rule for case is not verified here, and a rejected second upload would leave a partial release. An existing release must also carry the prerelease flag the tag implies (a boolean; set for a SemVer prerelease tag, unset otherwise), or the run fails and the version is burned. A draft release for the tag is not completed automatically: the run fails and asks you to publish or delete the draft, or burn the version.

Jobs and trust boundaries

Job Holds Notes
build contents: read Runs everything you wrote: build-command with $VERSION set (the tag with its prefix removed, or 0.0.0+<sha> off a tag), verify-command, collection of every file matching artifacts, release-notes-command. Keeps sudo only because build-install-command may legitimately be sudo apt-get install ...
publish contents: write, id-token: write, attestations: write Checks nothing out. Writes SHA256SUMS, records provenance, signs every file with cosign (a <file>.sigstore.json bundle beside it) and attaches all of it

A pull request builds and checks and never publishes.

A minimal caller

on:
  push: { tags: ['v*'] }
  pull_request:          # builds and checks; never publishes
  workflow_dispatch:

jobs:
  artifacts:
    uses: ChiefGyk3D/git-your-ship-together/.github/workflows/artifact-release.yml@<sha> # vX.Y.Z
    permissions:
      contents: write
      id-token: write
      attestations: write
    with:
      publish: ${{ startsWith(github.ref, 'refs/tags/v') }}
      build-install-command: sudo apt-get install -y dpkg-dev
      build-command: ./packaging/debian/build.sh dist
      artifacts: dist/*.deb
      verify-command: dpkg-deb --info dist/*.deb | grep -q "Version: $VERSION"
      egress-policy: block
      extra-allowed-endpoints: azure.archive.ubuntu.com:80

Verify a download with cosign verify-blob --bundle <file>.sigstore.json <file> against this repository's identity, or gh attestation verify <file> --owner OWNER. The build's hosts depend on your build command and go in extra-allowed-endpoints. Outputs: version. SBOMs are not attached yet (issue #99).

Inputs (16), read from artifact-release.yml:

Input Type Default Meaning
build-install-command string empty Shell run before the build, e.g. sudo apt-get install -y dpkg-dev; empty installs nothing.
build-command string empty Shell that produces the files, run with $VERSION set. Required; the job fails without one.
artifacts string dist/* Space-separated globs naming the files to publish, relative to the repository root.
tag-prefix string v What precedes the version in a release tag; v makes v1.2.3 the tag for version 1.2.3.
verify-command string empty Shell run after the build with $VERSION set, to refuse a release whose tree or files disagree with it; empty runs nothing.
release-notes-command string empty Shell that prints the GitHub release notes to stdout with $VERSION set; empty lets GitHub generate them from the commits.
publish boolean false Publish to the GitHub release. False builds, checks and stops; a pull request never publishes whatever this says.
allowed-publish-events string push Comma-separated event names (no spaces) that may publish, when the ref is also a release tag (refs/tags/v<major>.<minor>.<patch>). Default push; a caller that publishes on release sets push,release. A pull request event is refused even if listed.
github-release boolean true Attach the files, SHA256SUMS, signatures and provenance to the GitHub release for the tag.
release-title string empty Title of a GitHub release this workflow creates; empty uses the tag.
sign boolean true Sign every file with cosign, keyless, and publish the Sigstore bundle beside it.
attest boolean true Record SLSA build provenance for every file through GitHub's attestation API.
egress-policy string audit harden-runner egress policy for every job - audit logs outbound connections, block allows only allowed-endpoints.
allowed-endpoints string api.github.com:443 fulcio.sigstore.dev:443 github.com:443 objects.githubusercontent.com:443 rekor.sigstore.dev:443 release-assets.githubusercontent.com:443 timestamp.sigstore.dev:443 tuf-repo-cdn.sigstore.dev:443 uploads.github.com:443 harden-runner allow-list for block, space-separated host:port entries. The build's hosts depend on the caller's build command and go in extra-allowed-endpoints; the default is GitHub and Sigstore. Wildcards are not supported and a newline-separated list matches nothing.
extra-allowed-endpoints string empty Appended to allowed-endpoints, for the hosts the build command reaches. Same format.
timeout-minutes number 30 Per-job timeout.

Outputs a caller job can read:

Output Meaning
version The version the files were built as.

What it refuses to do

It never publishes from a pull request, never signs with a stored key, and fails if build-command is empty rather than publishing nothing.

Clone this wiki locally