Skip to content

feat: add release automation script - #1992

Merged
TerryHowe merged 18 commits into
oras-project:mainfrom
TerryHowe:feature/release-script
Sep 18, 2026
Merged

TerryHowe merged 18 commits into
oras-project:mainfrom
TerryHowe:feature/release-script

Conversation

@TerryHowe

@TerryHowe TerryHowe commented Mar 4, 2026 •

Copy link
Copy Markdown
Member

Summary

Adds scripts/release.sh, a bash release automation script that codifies the manual steps from https://oras.land/community/release-process into four repeatable phases.

Phases

  • prep <version> - Validates semver format, checks gh/signing prerequisites, updates internal/version/version.go (sets Version, clears BuildMetadata), creates branch chore/release-v<version>, commits with sign-off, pushes, creates a PR titled "bump: tag and release ORAS CLI v<version>" targeting main (or the release branch for patches), and prints the commit SHA with a Slack vote template.

  • tag <version> <sha> - Validates that the commit at the given SHA contains the correct version and cleared BuildMetadata, creates a signed git tag v<version>, pushes the tag, and creates a release branch (e.g. release-X.Y) for new minor versions (patch==0, no pre-release suffix).

  • validate [version] - Polls the release-ghcr and release-github GitHub Actions workflows until they complete, downloads artifacts with gh release download (works against the draft release), verifies checksums with sha256sum/shasum, and tests that the binary for the current OS/arch reports the expected version and git commit.

  • publish [version] - Verifies the artifact signatures, appends a Verification section to the release notes, publishes the release (--draft=false), triggers the snap workflow, cleans up _dist/, and prints a post-release Slack template.

validate and publish infer the version from internal/version/version.go when it is not given explicitly.

Signing

Artifacts are signed in CI, not locally. The signs block in .goreleaser.yml signs every artifact with the ORAS project release key (C6FC42F0DE84A345FAADB742F44418110791EF37) during release-github.yml, and the .asc files ship with the release.

publish therefore verifies those signatures against the project key rather than creating new ones — signing locally would use whichever key gpg defaults to and would replace the project key's signatures on the release. This also drops the now-orphaned sign Makefile target, which had exactly that failure mode and was referenced by nothing.

Features

  • --dry-run flag for safe testing
  • Upstream remote auto-detected from remote URLs; overridable with ORAS_REMOTE
  • ORAS_MAIN_RELEASE_VERSION to override the major.minor series released from main
  • ORAS_REPO Makefile variable for fetch-dist
  • Color-coded output, with manual follow-up steps called out as [MANUAL]
  • Slack templates for the release vote and the announcement

Makefile Targets

Adds release-prep, release-tag, release-validate, release-publish. Switches fetch-dist to gh release download (the previous curl loop could not see draft releases) and removes the orphaned sign target.

Test plan

  • Run scripts/release.sh --help to verify usage output
  • Run scripts/release.sh --dry-run prep 1.3.0 to verify prep phase logic
  • Run scripts/release.sh --dry-run tag 1.3.0 abc1234 to verify tag phase logic
  • Run scripts/release.sh --dry-run validate 1.3.0 to verify validate phase logic
  • Run scripts/release.sh --dry-run publish 1.3.0 to verify publish phase logic
  • Verify make help shows the new release targets

Note on further automation

This script automates the local runbook; a maintainer still drives each phase. Moving to the model oras-go uses — merging a release/vX.Y.Z PR triggers a workflow that tags, releases and publishes with no laptop involved — additionally requires a bypass actor on the repository's tag-creation ruleset so CI can push tags, and dropping draft: true from .goreleaser.yml. Out of scope here.

https://claude.ai/code/session_01Fxbefi17MX51RbvRLerggB

@codecov

codecov Bot commented Mar 4, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.66%. Comparing base (c75e8f3) to head (9716bfd).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1992      +/-   ##
==========================================
+ Coverage   87.62%   87.66%   +0.04%     
==========================================
  Files         139      139              
  Lines        5681     5685       +4     
==========================================
+ Hits         4978     4984       +6     
+ Misses        420      418       -2     
  Partials      283      283              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new scripts/release.sh automation script to codify the ORAS CLI release process into repeatable phases, and exposes those phases via make targets for convenience.

Changes:

  • Added scripts/release.sh implementing prep, tag, validate, and publish release phases (with --dry-run support).
  • Added Makefile targets (release-prep, release-tag, release-validate, release-publish) to invoke the script.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 9 comments.

File Description
scripts/release.sh New bash script that automates version bump PR creation, tagging, CI/artifact validation, and publishing/signing steps.
Makefile Adds convenience targets to run the release script phases via make.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread scripts/release.sh Resolved
Comment thread scripts/release.sh Resolved
Comment thread scripts/release.sh Resolved
Comment thread scripts/release.sh Resolved
Comment thread scripts/release.sh Resolved
Comment thread scripts/release.sh Resolved
Comment thread scripts/release.sh Resolved
Comment thread scripts/release.sh Resolved
Comment thread scripts/release.sh Resolved

@sabre1041 sabre1041 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks really good. one small comment

Comment thread Makefile Resolved
@TerryHowe TerryHowe added this to the v1.4.0 milestone May 24, 2026
@TerryHowe
TerryHowe force-pushed the feature/release-script branch from ea94983 to fc91d0e Compare June 28, 2026 12:20
TerryHowe and others added 17 commits September 6, 2026 08:04
- Extract check_prerequisites() as shared function called from both
  do_prep and do_tag, ensuring GPG/gh/remote are validated before tagging
- Add dirty working tree guard in do_prep before creating branch
- Add portable checksum verification: prefer sha256sum over shasum with
  fallback and fatal error if neither is available
- Use make SHELL=/bin/bash sign to avoid POSIX brace glob issue
- Fix .asc upload to avoid glob expansion in dry-run mode
- Fix snap workflow: use release-snap.yml with required version and
  isStable fields, pass --ref for correct trigger

Signed-off-by: Terry Howe <[email protected]>
- Replace make fetch-dist with gh release download in validate phase
  so artifact fetching works against draft releases (curl on the public
  /releases/download/ URL returns 404 for drafts)
- Add ORAS_REPO variable to Makefile so the repo is not hardcoded
- Add gh CLI prerequisite check to fetch-dist target with install URL

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Signed-off-by: Terry Howe <[email protected]>
- Replace make sign with a direct gpg loop covering all artifact types
  including .zip (make sign only covered *.{gz,txt})
- Fail immediately if any gpg signing fails instead of swallowing errors
- Scope verify and upload globs to oras_<version>_* to avoid picking up
  leftover files from prior releases
- Add --clobber to gh release upload so publish is safely retryable

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Signed-off-by: Terry Howe <[email protected]>
Bash arithmetic (( expr )) exits with code 1 when the expression
evaluates to 0. Post-increment (( n++ )) returns the old value, so
the first increment from 0 to 1 silently kills the script under
set -euo pipefail. Use $(( n + 1 )) assignment instead.

Affected: attempt counter in validate and sig_count in publish.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Signed-off-by: Terry Howe <[email protected]>
gpg consumes stdin during signing, leaving confirm's read at EOF which
silently treats the response as empty (N) and aborts. Reading from
/dev/tty ensures interactive prompts always reach the terminal.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Signed-off-by: Terry Howe <[email protected]>
- Remove all confirm() calls and the confirm function itself; the script
  now runs non-interactively without pausing for user input
- Replace the branch warning in prep with a hard failure: the current
  branch must be 'main' or 'release-X.Y' where X.Y matches the
  major.minor of the version being released (e.g. v1.3.2 requires
  main or release-1.3)

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Signed-off-by: Terry Howe <[email protected]>
validate and publish now read the version from internal/version/version.go
when no version argument is supplied, so running just
'scripts/release.sh validate' or 'scripts/release.sh publish' works
from the release branch without repeating the version string.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Signed-off-by: Terry Howe <[email protected]>
When running prep from 'main', the version's major.minor must match
MAIN_RELEASE_VERSION (default 2.0). This prevents accidentally cutting
a 1.x patch release from main. Override with ORAS_MAIN_RELEASE_VERSION
when the next main-branch series changes.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Signed-off-by: Terry Howe <[email protected]>
…N from validate/publish make targets

- Remove redundant *Changelog:* line from the publish Slack announcement
  (it was the same URL as *Release:*)
- Drop $(VERSION) from release-validate and release-publish Makefile
  targets since the script now reads the version from version.go

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Signed-off-by: Terry Howe <[email protected]>
… docs

- Auto-detect the canonical oras-project/oras remote by URL instead of
  assuming it is named 'upstream'; ORAS_REMOTE still overrides.
- Target the release branch the PR is cut from (main or release-X.Y) so
  patch-release PRs no longer always target main.
- Match the documented vote requirement (super-majority of ORAS maintainer
  approval) instead of the unspecified 72h / 3-binding-vote / veto rules.

Signed-off-by: Terry Howe <[email protected]>
Match the documented release note: use the full 40-char GPG fingerprint and
attribute the signer via their GitHub handle (from the authenticated gh user),
linking to their key at github.com/<handle>.gpg. Falls back gracefully when the
handle cannot be resolved.

Signed-off-by: Terry Howe <[email protected]>
parse_global_flags ran inside a command substitution, so DRY_RUN=true was set
only in the subshell and lost. --dry-run was silently ignored and prep ran for
real (creating branches/PRs). Parse flags into a POSITIONAL_ARGS global in the
current shell instead, so DRY_RUN sticks.

Also point the release vote message at the #oras-maintainers Slack channel.

Signed-off-by: Terry Howe <[email protected]>
Five corrections, mostly from running the v1.3.4 release by hand:

- publish no longer re-signs the artifacts. .goreleaser.yml now carries a
  "signs" block, so release-github.yml signs everything in CI with the ORAS
  project release key and the .asc files ship with the release. Signing
  locally produced signatures from whichever key gpg defaults to and
  uploaded them with --clobber, replacing the project key's signatures.
  publish now verifies the downloaded signatures against the project key
  instead, importing it from KEYS when it is missing from the keyring.

- the Verification note recorded the wrong fingerprint. It read the first
  fpr: line out of the local keyring, which is not necessarily the key gpg
  signed with and is never the project key. It now names the project key,
  and is skipped when the notes already carry a Verification section.

- check_prerequisites demanded a GPG secret key, but "git tag -s" honors
  gpg.format, which may be ssh or x509. The check both rejected maintainers
  who sign with SSH and passed maintainers whose GPG key git would never
  reach for. Signing is now checked separately, against the configured
  format, by the two phases that actually sign.

- prep's in-place sed on the version file ran unguarded, so --dry-run
  rewrote version.go. run() cannot wrap it, so it is guarded explicitly.

- the main release series was hardcoded to 3.0, which rejected every 1.3.x
  release from main unless ORAS_MAIN_RELEASE_VERSION was set. It is now
  derived from the version file on the current branch, so it tracks the
  branch, and cutting a new minor from main is allowed. The environment
  variable still overrides it.

Signed-off-by: Terry Howe <[email protected]>
@TerryHowe
TerryHowe force-pushed the feature/release-script branch from dbaef5c to 234c09e Compare September 6, 2026 14:05
The 'sign' target is unreferenced: artifacts are signed in CI by the
'signs' block in .goreleaser.yml using the ORAS project release key, and
release.sh verifies those signatures rather than creating new ones. The
target would have signed with whichever key gpg defaults to, replacing
the project key's signatures.

Also correct the release-publish help text, which still described the
old sign-and-upload behavior.

Claude-Session: https://claude.ai/code/session_01Fxbefi17MX51RbvRLerggB
Signed-off-by: Terry Howe <[email protected]>

@sajayantony sajayantony left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for taking care of the releases @TerryHowe

@TerryHowe
TerryHowe merged commit 4e589f5 into oras-project:main Sep 18, 2026
9 checks passed
@TerryHowe
TerryHowe deleted the feature/release-script branch September 18, 2026 20:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants