| 1 |
# Releasing oras-go |
| 2 |
|
| 3 |
Releases are created via a GitOps workflow. Merging a `release/vX.Y.Z` branch |
| 4 |
into `v2` automatically tags the commit and publishes the GitHub Release. |
| 5 |
|
| 6 |
## Steps |
| 7 |
|
| 8 |
### 1. Create a release branch |
| 9 |
|
| 10 |
The release branch needs at least one commit so GitHub will allow a PR to be |
| 11 |
opened. Use an empty commit as a lightweight marker: |
| 12 |
|
| 13 |
```bash |
| 14 |
git fetch upstream |
| 15 |
git checkout -b release/v2.7.0 upstream/v2 |
| 16 |
git commit --allow-empty -s -m "chore: prepare release v2.7.0" |
| 17 |
git push origin release/v2.7.0 |
| 18 |
``` |
| 19 |
|
| 20 |
The release does not need to contain the changes being released — those are |
| 21 |
already on `v2`. The PR is a trigger: when it merges, the workflow tags the |
| 22 |
PR's `merge_commit_sha` (the exact commit that landed on `v2`), which includes |
| 23 |
all prior work on the branch. |
| 24 |
|
| 25 |
### 2. Open a pull request |
| 26 |
|
| 27 |
Open a PR from `release/v2.7.0` targeting the `v2` branch. Write the release |
| 28 |
notes directly in the PR description using the format from prior releases: |
| 29 |
|
| 30 |
```markdown |
| 31 |
## New Features |
| 32 |
... |
| 33 |
|
| 34 |
## Bug Fixes |
| 35 |
... |
| 36 |
|
| 37 |
## Documentation |
| 38 |
... |
| 39 |
|
| 40 |
## Other Changes |
| 41 |
... |
| 42 |
``` |
| 43 |
|
| 44 |
The PR description becomes the GitHub Release body verbatim, so write it in |
| 45 |
its final form. |
| 46 |
|
| 47 |
### 3. Get approvals |
| 48 |
|
| 49 |
Branch protection on `v2` requires approval from at least 3 of the 4 owners |
| 50 |
listed in [OWNERS.md](OWNERS.md). Reviewers should verify: |
| 51 |
|
| 52 |
- The target commit is correct |
| 53 |
- The release notes are accurate and complete |
| 54 |
- All CI checks pass |
| 55 |
|
| 56 |
### 4. Merge |
| 57 |
|
| 58 |
Merge the PR. The [release workflow](.github/workflows/release.yml) |
| 59 |
automatically: |
| 60 |
|
| 61 |
1. Extracts the version from the branch name (`release/v2.7.0` → `v2.7.0`) |
| 62 |
2. Creates and pushes the git tag |
| 63 |
3. Publishes the GitHub Release with the PR body as release notes |
| 64 |
|
| 65 |
## Pre-releases |
| 66 |
|
| 67 |
Tags containing `-alpha`, `-beta`, or `-rc` (e.g., `v2.7.0-rc.1`) are |
| 68 |
automatically marked as pre-release on GitHub. Use the same branch naming |
| 69 |
convention: `release/v2.7.0-rc.1`. |
| 70 |
|
| 71 |
## Testing the workflow locally |
| 72 |
|
| 73 |
Three levels of local validation are available without triggering a real release: |
| 74 |
|
| 75 |
**1. Validate the goreleaser config:** |
| 76 |
```bash |
| 77 |
goreleaser check |
| 78 |
``` |
| 79 |
|
| 80 |
**2. Validate workflow structure and job matching (dry run):** |
| 81 |
```bash |
| 82 |
act pull_request \ |
| 83 |
-e .github/act/release-event.json \ |
| 84 |
-W .github/workflows/release.yml \ |
| 85 |
-n |
| 86 |
``` |
| 87 |
|
| 88 |
**3. Run the workflow end-to-end with a fake token (Colima + cached actions required):** |
| 89 |
```bash |
| 90 |
act pull_request \ |
| 91 |
-e .github/act/release-event.json \ |
| 92 |
-W .github/workflows/release.yml \ |
| 93 |
-s GITHUB_TOKEN=fake \ |
| 94 |
--pull=false \ |
| 95 |
--action-offline-mode \ |
| 96 |
--container-daemon-socket - |
| 97 |
``` |
| 98 |
|
| 99 |
This runs all steps up to and including version extraction (`version=vX.Y.Z` will |
| 100 |
appear in the output). The `git push` step then fails with a permission error — |
| 101 |
that is expected and confirms no tag was pushed. The mock event payload is at |
| 102 |
`.github/act/release-event.json`. |
| 103 |
|
| 104 |
## Updating the documentation site |
| 105 |
|
| 106 |
After a release, update [oras-www](https://github.com/oras-project/oras-www) |
| 107 |
to reflect the new version. See the `CLAUDE.md` in that repository for the |
| 108 |
exact steps. |