Skip to content

feat: add gitops release workflow with goreleaser#1161

Merged
TerryHowe merged 7 commits into
oras-project:v2from
TerryHowe:feat/gitops-release
May 10, 2026
Merged

feat: add gitops release workflow with goreleaser#1161
TerryHowe merged 7 commits into
oras-project:v2from
TerryHowe:feat/gitops-release

Conversation

@TerryHowe

@TerryHowe TerryHowe commented May 7, 2026

Copy link
Copy Markdown
Member

Summary

Replaces the manual issue-vote → tag → release process with a PR-based GitOps workflow.

Changes

  • .goreleaser.yaml — Minimal config for a Go library (no binary builds, archives, or checksums). prerelease: auto marks tags containing -alpha, -beta, or -rc as pre-release on GitHub.
  • .github/workflows/release.yml — Triggers on merge of a release/vX.Y.Z branch into v2. Extracts the version from the branch name, tags the merge commit, and publishes the GitHub Release using the PR body as release notes. The goreleaser/goreleaser-action is pinned to e435ccd (v6.4.0).
  • RELEASES.md — Documents the full release process, the --allow-empty branch convention, and three levels of local testing with act.
  • .github/act/release-event.json — Mock PR event payload for local workflow testing.

How a release works

  1. Create a branch named release/vX.Y.Z from v2 with an empty commit (required for GitHub to allow a PR with no code diff):
    git fetch upstream
    git checkout -b release/v2.7.0 upstream/v2
    git commit --allow-empty -s -m "chore: prepare release v2.7.0"
    git push origin release/v2.7.0
  2. Open a PR to v2 — write the release notes in the PR description (same format as today's release issues)
  3. Get the required approvals via branch protection (replaces the issue vote)
  4. Merge — the workflow automatically tags the commit and publishes the GitHub Release using the PR body as release notes

The release PR does not need to contain the changes being released — those are already on v2. The PR is purely a trigger.

Local testing

Three levels of validation are available without triggering a real release:

# 1. Validate goreleaser config
goreleaser check

# 2. Validate workflow structure and job matching (dry run)
act pull_request -e .github/act/release-event.json -W .github/workflows/release.yml -n

# 3. Full end-to-end run (Colima + cached actions required)
act pull_request \
  -e .github/act/release-event.json \
  -W .github/workflows/release.yml \
  -s GITHUB_TOKEN=fake \
  --pull=false \
  --action-offline-mode \
  --container-daemon-socket -

The end-to-end run executes through checkout → Go setup → version extraction (printing version=vX.Y.Z) → then fails at git push with a permission error. That is the expected safe stopping point — no tag is pushed and no release is created.

Notes

  • Branch protection on v2 should require the same approval quorum currently used in release issues (3 of 4 owners)
  • Pre-release tags (-alpha, -beta, -rc) are automatically marked as pre-release on GitHub

🤖 Generated with Claude Code

Adds a PR-based release process:
- Merging a 'release/vX.Y.Z' branch into v2 triggers the workflow
- The workflow tags the commit, uses the PR body as release notes,
  and publishes the GitHub Release via goreleaser.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Terry Howe <terrylhowe@gmail.com>
TerryHowe and others added 4 commits May 7, 2026 12:25
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Terry Howe <terrylhowe@gmail.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Terry Howe <terrylhowe@gmail.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Terry Howe <terrylhowe@gmail.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Terry Howe <terrylhowe@gmail.com>
@sajayantony

Copy link
Copy Markdown
Contributor

This is really cool.

@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.

This is really great! thanks for putting this together. Only question is whether there should be a step that validates the tag follows Semantic Versioning

Otherwise, good to merge

Signed-off-by: Terry Howe <terrylhowe@gmail.com>

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

Introduces a PR-driven GitOps release process for oras-go (v2 branch) that auto-tags and publishes GitHub Releases via GoReleaser when a release/vX.Y.Z PR is merged.

Changes:

  • Add a minimal .goreleaser.yaml suitable for a Go library release (no build artifacts; auto prerelease detection).
  • Add a GitHub Actions workflow to extract the version from release/ branch names, tag the merged commit, and publish a GitHub Release using the PR body as notes.
  • Document the new release workflow and provide an act test payload for local validation.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 6 comments.

File Description
RELEASES.md Documents the new GitOps release PR process and local testing via act.
.goreleaser.yaml Configures GoReleaser for library-only releases and prerelease auto-detection.
.github/workflows/release.yml Implements the automated tagging + GitHub Release publication workflow.
.github/act/release-event.json Provides a mock PR-closed event payload for local workflow testing.

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

Comment thread .github/workflows/release.yml
Comment thread .github/workflows/release.yml
Comment thread .github/workflows/release.yml
Comment thread .github/workflows/release.yml Outdated
Comment thread .github/workflows/release.yml
Comment thread RELEASES.md Outdated
Signed-off-by: Terry Howe <terrylhowe@gmail.com>
@TerryHowe
TerryHowe merged commit d593d50 into oras-project:v2 May 10, 2026
1 check passed
This was referenced May 31, 2026
TerryHowe added a commit that referenced this pull request Jun 3, 2026
This is a security patch release addressing five advisories in the
authentication, remote, and content layers, plus accumulated bug fixes
and maintenance since v2.6.0.

## Security Fixes

- Drop the `Authorization` header on cross-origin redirects to prevent
origin credentials leaking to a redirect target on a different
scheme/port of the same host
([GHSA-vh4v-2xq2-g5cg](GHSA-vh4v-2xq2-g5cg))
- Validate the bearer `realm` host before sending credentials to prevent
credential exfiltration to an attacker-controlled token service,
including TLS downgrades and IP-literal metadata endpoints; adds
`TrustedRealmHosts`
([GHSA-28r5-37g7-p6mp](https://github.com/oras-project/oras-go/security/advisories/GHSA-28r5-37g7-p6mp),
[GHSA-xf85-363p-868w](GHSA-xf85-363p-868w))
- Validate the `Location` host before blob upload to prevent credentials
being forwarded to a cross-host upload endpoint (SSRF / CWE-918) (#1152,
[GHSA-jxpm-75mh-9fp7](GHSA-jxpm-75mh-9fp7))
- Reject descriptor sizes exceeding 32 MiB in `content.ReadAll` to
prevent a crafted OCI layout from triggering a `makeslice` panic and
crashing the process (#1153,
[GHSA-f36w-mj3v-6jqv](https://github.com/oras-project/oras-go/security/advisories/GHSA-f36w-mj3v-6jqv))
- Resolve symlinks when enforcing the `workingDir` write boundary in
`content/file`, blocking writes that escape the boundary via a symlinked
path component when `AllowPathTraversalOnWrite=false`

## Bug Fixes

- `graph.Memory` should use digest as map key (#1095)
- Fix credentials key for the Docker `registry-1` host (#966)
- Support an empty credentials file (#959)

## Other Changes

- Add GitOps release workflow with goreleaser (#1161)
- Shift the Go support window to [1.24, 1.25] (#991)
- Run `go modernize` (#1005)
- Sync `CODEOWNERS` and `OWNERS.md` from main to v2 (#1122)
- Remove scripts reference from the Makefile (#960)
- Bump `golang.org/x/sync` 0.14.0 → 0.20.0 (#971, #978, #1001, #1037,
#1078, #1121)
- Bump GitHub Actions: `actions/checkout` 4→5 (#989), `actions/setup-go`
5→6 (#998), `actions/stale` 9→10 (#997), `github/codeql-action` 3→4
(#1016)

Signed-off-by: Terry Howe <terrylhowe@gmail.com>
@TerryHowe TerryHowe mentioned this pull request Jun 3, 2026
TerryHowe added a commit to TerryHowe/oras-go that referenced this pull request Jun 22, 2026
## Summary

Replaces the manual issue-vote → tag → release process with a PR-based
GitOps workflow.

## Changes

- **`.goreleaser.yaml`** — Minimal config for a Go library (no binary
builds, archives, or checksums). `prerelease: auto` marks tags
containing `-alpha`, `-beta`, or `-rc` as pre-release on GitHub.
- **`.github/workflows/release.yml`** — Triggers on merge of a
`release/vX.Y.Z` branch into `v2`. Extracts the version from the branch
name, tags the merge commit, and publishes the GitHub Release using the
PR body as release notes. The `goreleaser/goreleaser-action` is pinned
to `e435ccd` (v6.4.0).
- **`RELEASES.md`** — Documents the full release process, the
`--allow-empty` branch convention, and three levels of local testing
with `act`.
- **`.github/act/release-event.json`** — Mock PR event payload for local
workflow testing.

## How a release works

1. Create a branch named `release/vX.Y.Z` from `v2` with an empty commit
(required for GitHub to allow a PR with no code diff):
   ```bash
   git fetch upstream
   git checkout -b release/v2.7.0 upstream/v2
   git commit --allow-empty -s -m "chore: prepare release v2.7.0"
   git push origin release/v2.7.0
   ```
2. Open a PR to `v2` — write the release notes in the PR description
(same format as today's release issues)
3. Get the required approvals via branch protection (replaces the issue
vote)
4. Merge — the workflow automatically tags the commit and publishes the
GitHub Release using the PR body as release notes

The release PR does not need to contain the changes being released —
those are already on `v2`. The PR is purely a trigger.

## Local testing

Three levels of validation are available without triggering a real
release:

```bash
# 1. Validate goreleaser config
goreleaser check

# 2. Validate workflow structure and job matching (dry run)
act pull_request -e .github/act/release-event.json -W .github/workflows/release.yml -n

# 3. Full end-to-end run (Colima + cached actions required)
act pull_request \
  -e .github/act/release-event.json \
  -W .github/workflows/release.yml \
  -s GITHUB_TOKEN=fake \
  --pull=false \
  --action-offline-mode \
  --container-daemon-socket -
```

The end-to-end run executes through checkout → Go setup → version
extraction (printing `version=vX.Y.Z`) → then fails at `git push` with a
permission error. That is the expected safe stopping point — no tag is
pushed and no release is created.

## Notes

- Branch protection on `v2` should require the same approval quorum
currently used in release issues (3 of 4 owners)
- Pre-release tags (`-alpha`, `-beta`, `-rc`) are automatically marked
as pre-release on GitHub

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Signed-off-by: Terry Howe <terrylhowe@gmail.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
(cherry picked from commit d593d50)
Signed-off-by: Terry Howe <terrylhowe@gmail.com>
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.

4 participants