From d39df3e1d2f8db3d599e98dd7544ab34a446b3f5 Mon Sep 17 00:00:00 2001 From: morimoto-cybozu Date: Fri, 20 Jan 2023 11:33:44 +0000 Subject: [PATCH] Add release workflow and document Signed-off-by: morimoto-cybozu --- .github/workflows/release.yaml | 20 +++++++++ RELEASE.md | 80 ++++++++++++++++++++++++++++++++++ 2 files changed, 100 insertions(+) create mode 100644 .github/workflows/release.yaml create mode 100644 RELEASE.md diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..6358125 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,20 @@ +name: release +on: + push: + tags: + - 'v*' +jobs: + release: + name: Release on GitHub + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v3 + - name: Create release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + version=$(echo ${{ github.ref }} | sed -e "s#refs/tags/##g") + if echo $version | grep -q -e '-'; then prerelease=-p; fi + gh release create $version $prerelease \ + -t "Release $version" \ + -n "See [CHANGELOG.md](./CHANGELOG.md) for details." diff --git a/RELEASE.md b/RELEASE.md new file mode 100644 index 0000000..c63c239 --- /dev/null +++ b/RELEASE.md @@ -0,0 +1,80 @@ +Release procedure +================= + +This document describes how to release a new version of log. + +Versioning +---------- + +Follow [semantic versioning 2.0.0][semver] to choose the new version number. + +Prepare change log entries +-------------------------- + +Add notable changes since the last release to [CHANGELOG.md](CHANGELOG.md). +It should look like: + +```markdown +(snip) +## [Unreleased] + +### Added +- Implement ... (#35) + +### Changed +- Fix a bug in ... (#33) + +### Removed +- Deprecated `-option` is removed ... (#39) + +(snip) +``` + +Bump version +------------ + +1. Determine a new version number. Then set `VERSION` variable. + + ```console + # Set VERSION and confirm it. It should not have "v" prefix. + $ VERSION=x.y.z + $ echo $VERSION + ``` + +2. Make a branch to release + + ```console + $ git neco dev "bump-$VERSION" + ``` + +3. Edit `CHANGELOG.md` for the new version ([example][]). +4. Commit the change and push it. + + ```console + $ git commit -a -m "Bump version to $VERSION" + $ git neco review + ``` + +5. Merge this branch. +6. Add a git tag to the main HEAD, then push it. + + ```console + # Set VERSION again. + $ VERSION=x.y.z + $ echo $VERSION + + $ git checkout main + $ git pull + $ git tag -a -m "Release v$VERSION" "v$VERSION" + + # Make sure the release tag exists. + $ git tag -ln | grep $VERSION + + $ git push origin "v$VERSION" + ``` + +GitHub actions will build and push artifacts such as container images and +create a new GitHub release. + +[semver]: https://semver.org/spec/v2.0.0.html +[example]: https://github.com/cybozu-go/etcdpasswd/commit/77d95384ac6c97e7f48281eaf23cb94f68867f79