diff --git a/RELEASE.md b/RELEASE.md index 5c65318d3..ec956744b 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -14,33 +14,19 @@ The Exercism CLI uses [GoReleaser](https://goreleaser.com) to automate the relea 1. Bump the `Version` constant in `cmd/version.go` 1. Update the `CHANGELOG.md` file to include a section for the new version and its changes. Hint: you can view changes using the compare view: https://github.com/exercism/cli/compare/$PREVIOUS_RELEASE...main. -1. Commit the updated version +1. Commit the updated files 1. Create a PR _Note: It's useful to add the version to the commit message when you bump it: e.g. `Bump version to v2.3.4`._ ## Cut a release -Once the version bump PR has been merged, run the following commands: +Once the version bump PR has been merged, run the following command to cut a release: -```bash -VERSION=$(sed -n -E 's/^const Version = "([0-9]+\.[0-9]+\.[0-9]+)"$/\1/p' cmd/version.go) -TAG_NAME="v${VERSION}" -GPG_FINGERPRINT="" - -# Test run -goreleaser --skip=publish --snapshot --clean - -# Create a new tag on the main branch and push it -git tag -a "${TAG_NAME}" -m "Trying out GoReleaser" -git push origin "${TAG_NAME}" +```shell +GPG_FINGERPINT="" ./bin/release.sh ``` -Brew tap is now managed by `.goreleaser.yml` so no need to update it manually. -GoReleaser can generate and publish a homebrew-tap recipe into a repository -automatically. See [GoReleaser docs](https://goreleaser.com/customization/homebrew/) -for more details. - ## Cut Release on GitHub At this point, Goreleaser will have created a draft release at https://github.com/exercism/cli/releases/tag/vX.Y.Z. @@ -55,20 +41,6 @@ To install, follow the interactive installation instructions at https://exercism Lastly, test and publish the draft -## Update Homebrew - -Next, we'll submit a PR to Homebrew to update the Exercism formula (which is how macOS users usually download the CLI): - -``` -cd /tmp && curl -O https://github.com/exercism/cli/archive/vX.Y.Z.tar.gz -cd $(brew --repository) -git checkout master -brew update -brew bump-formula-pr --strict exercism --url=https://github.com/exercism/cli/archive/vX.Y.Z.tar.gz --sha256=$(shasum -a 256 /tmp/vX.Y.Z.tar.gz) -``` - -For more information see [How To Open a Homebrew Pull Request](https://docs.brew.sh/How-To-Open-a-Homebrew-Pull-Request). - ## Update the docs site If there are any significant changes, we should describe them on diff --git a/bin/release.sh b/bin/release.sh new file mode 100755 index 000000000..05f228455 --- /dev/null +++ b/bin/release.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash + +set -euo pipefail + +if [[ -z "${GPG_FINGERPRINT}" ]]; then + echo "GPG_FINGERPRINT environment variable is not set" + exit 1 +fi + +echo "Syncing repo with latest main..." +git checkout main +git pull + +VERSION=$(sed -n -E 's/^const Version = "([0-9]+\.[0-9]+\.[0-9]+)"$/\1/p' cmd/version.go) +TAG_NAME="v${VERSION}" + +echo "Verify release can be built..." +goreleaser --skip=publish --snapshot --clean + +echo "Pushing tag..." +git tag -a "${TAG_NAME}" -m "Release ${TAG_NAME}" +git push origin "${TAG_NAME}" + +echo "Tag pushed" +echo "The release CI workflow will automatically create a draft release." +echo "Once created, edit the release notes and publish it."