Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ standalone module so consumers can import it on its own.
From a clean, current `main`, preview the next release:

```sh
RELEASE_DRY_RUN=1 script/release patch
RELEASE_DRY_RUN=1 script/release patch --stable
```

Then cut it:

```sh
script/release patch
script/release patch --stable
```

To preview a release candidate instead:
Expand All @@ -32,7 +32,7 @@ script/release patch --rc
```

The first candidate is `go/vX.Y.Z-rc.1`; repeating the same bump increments
`rc.N`. Run the bump without `--rc` to publish the stable `go/vX.Y.Z`.
`rc.N`. Use `--stable` to publish the stable `go/vX.Y.Z`.

Use `patch` for compatible fixes, `minor` for compatible additions, and
`major` for breaking changes.
Expand Down
21 changes: 10 additions & 11 deletions script/release
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Cut a release tag for the Go sub-module.
#
# Usage:
# script/release <patch|minor|major> [--rc]
# script/release <patch|minor|major> <--stable|--rc>
#
# The next version is computed from the latest go/vX.Y.Z tag and the chosen
# bump. Maintainers run this locally to validate and push an annotated tag.
Expand Down Expand Up @@ -174,21 +174,20 @@ cut_tag() {
main() {
cd "$(dirname "$0")/.."

[ "$#" -eq 2 ] ||
die "usage: script/release <patch|minor|major> <--stable|--rc>"

local bump="${1:-}"
case "$bump" in
patch | minor | major) ;;
*) die "usage: script/release <patch|minor|major> [--rc]" ;;
*) die "usage: script/release <patch|minor|major> <--stable|--rc>" ;;
esac

local prerelease=0
case "$#" in
1) ;;
2)
[ "$2" = "--rc" ] ||
die "usage: script/release <patch|minor|major> [--rc]"
prerelease=1
;;
*) die "usage: script/release <patch|minor|major> [--rc]" ;;
local prerelease
case "$2" in
--stable) prerelease=0 ;;
--rc) prerelease=1 ;;
*) die "usage: script/release <patch|minor|major> <--stable|--rc>" ;;
esac

cut_tag "$bump" "$prerelease"
Expand Down
7 changes: 6 additions & 1 deletion script/release_test
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,14 @@ git push --quiet origin refs/tags/go/v1.2.4-rc.1
output="$(RELEASE_DRY_RUN=1 script/release patch --rc)"
[[ "$output" == *"Cutting go/v1.2.4-rc.2 "* ]]

output="$(RELEASE_DRY_RUN=1 script/release patch)"
output="$(RELEASE_DRY_RUN=1 script/release patch --stable)"
[[ "$output" == *"Cutting go/v1.2.4 "* ]]

if RELEASE_DRY_RUN=1 script/release patch >/dev/null 2>&1; then
echo "expected missing release channel to fail" >&2
exit 1
fi

ancestor="$(git rev-parse HEAD)"
tree="$(git rev-parse "${ancestor}^{tree}")"
descendant="$(printf 'descendant\n' | git -c user.name=test -c user.email=test@example.com commit-tree "$tree" -p "$ancestor")"
Expand Down
Loading