Skip to content

Commit e9c799b

Browse files
authored
ci: Streamline Gitflow release process (#7113)
1 parent 20a970c commit e9c799b

File tree

4 files changed

+48
-71
lines changed

4 files changed

+48
-71
lines changed

.github/workflows/auto-release.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Gitflow - Auto prepare release
2+
on:
3+
pull_request:
4+
types:
5+
- closed
6+
branches:
7+
- master
8+
9+
# This workflow tirggers a release when merging a branch with the pattern `prepare-release/VERSION` into master.
10+
jobs:
11+
release:
12+
runs-on: ubuntu-20.04
13+
name: 'Prepare a new version'
14+
15+
steps:
16+
- uses: actions/checkout@v3
17+
with:
18+
token: ${{ secrets.GH_RELEASE_PAT }}
19+
fetch-depth: 0
20+
21+
# https://github.com/actions-ecosystem/action-regex-match
22+
- uses: actions-ecosystem/action-regex-match@v2
23+
id: version
24+
with:
25+
# Parse version from head branch
26+
text: ${{ github.head_ref }}
27+
# match: refs/heads/preprare-release/xx.xx.xx
28+
regex: '^refs\/heads\/preprare-release\/(\d+\.\d+\.\d+)$'
29+
30+
- name: Prepare release
31+
uses: getsentry/action-prepare-release@v1
32+
if: github.event.pull_request.merged == true && steps.version.outputs.match != ''
33+
env:
34+
GITHUB_TOKEN: ${{ secrets.GH_RELEASE_PAT }}
35+
with:
36+
version: ${{ steps.version.outputs.match != '' }}
37+
force: false
38+
merge_target: master

.github/workflows/build.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,8 @@ jobs:
137137
# Note: These next three have to be checked as strings ('true'/'false')!
138138
is_develop: ${{ github.ref == 'refs/heads/develop' }}
139139
is_release: ${{ startsWith(github.ref, 'refs/heads/release/') }}
140-
is_gitflow_sync: ${{ github.head_ref == 'refs/heads/develop' || github.head_ref == 'refs/heads/master' }}
140+
# When merging into master, or from master
141+
is_gitflow_sync: ${{ github.head_ref == 'refs/heads/master' || github.ref == 'refs/heads/master' }}
141142
has_gitflow_label:
142143
${{ github.event_name == 'pull_request' && contains(steps.pr-labels.outputs.labels, ' Gitflow ') }}
143144
force_skip_cache:

.github/workflows/gitflow-sync-master.yml

Lines changed: 0 additions & 62 deletions
This file was deleted.

docs/publishing-a-release.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,20 @@ _These steps are only relevant to Sentry employees when preparing and publishing
66
**If you want to release a new SDK for the first time, be sure to follow the [New SDK Release Checklist](./new-sdk-release-checklist.md)**
77

88
1. Determine what version will be released (we use [semver](https://semver.org)).
9-
2. Update [`CHANGELOG.md`](https://github.com/getsentry/sentry-javascript/edit/master/CHANGELOG.md) to add an entry for the next release number and a list of changes since the last release. (See details below.)
10-
a. Merging the Changelog PR will automatically trigger a sync from `develop` -> `master`
11-
3. Run the [Prepare Release](https://github.com/getsentry/sentry-javascript/actions/workflows/release.yml) workflow.
12-
a. Wait for this until the sync to `master` is completed.
13-
4. A new issue should appear in https://github.com/getsentry/publish/issues.
14-
5. Ask a member of the [@getsentry/releases team](https://github.com/orgs/getsentry/teams/releases/members) to approve the release.
9+
2. Create a branch `prepare-release/VERSION`, eg. `prepare-release/7.37.0`, off develop
10+
3. Update [`CHANGELOG.md`](https://github.com/getsentry/sentry-javascript/edit/master/CHANGELOG.md) to add an entry for the next release number and a list of changes since the last release. (See details below.)
11+
4. Create a PR towards `master` branch
12+
5. When the PR is merged, it will automatically trigger the [Prepare Release](https://github.com/getsentry/sentry-javascript/actions/workflows/release.yml) on master.
13+
6. A new issue should appear in https://github.com/getsentry/publish/issues.
14+
7. Ask a member of the [@getsentry/releases team](https://github.com/orgs/getsentry/teams/releases/members) to approve the release.
1515
a. Once the release is completed, a sync from `master` ->` develop` will be automatically triggered
1616

1717
## Updating the Changelog
1818

19-
1. Create a new branch.
19+
1. Create a new branch `prepare-release/VERSION` off of `develop`, e.g. `prepare-release/7.37.1`.
2020
2. Run `yarn changelog` and copy everything
2121
3. Create a new section in the changelog, deciding based on the changes whether it should be a minor bump or a patch release.
2222
4. Paste in the logs you copied earlier.
2323
5. Delete any which aren't user-facing changes.
2424
7. If any of the PRs are from external contributors, include underneath the commits `Work in this release contributed by <list of external contributors' GitHub usernames>. Thank you for your contributions!`. If there's only one external PR, don't forget to remove the final `s`. If there are three or more, use an Oxford comma. (It's in the Sentry styleguide!)
25-
8. Commit, push, and open a PR with the title `meta: Update changelog for <fill in relevant version here>` against `develop` branch.
25+
8. Commit, push, and open a PR with the title `meta(changelog): Update changelog for VERSION` against `master` branch.

0 commit comments

Comments
 (0)