This repository has been archived by the owner on Dec 12, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 1
chore(release): Add changelog script, autorelease action and docs for publishing a release #58
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
61256ad
chore(release): Add changelog script, autorelease action and docs for…
andreiborza 9f967ed
Update package.json
andreiborza e3224df
Only run auto-release for `prepare-release` branches
andreiborza 219b58f
Bump pnpm/action-setup version to v4
andreiborza File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
name: "Auto release" | ||
on: | ||
pull_request: | ||
types: | ||
- closed | ||
branches: | ||
- main | ||
|
||
# This workflow triggers a release when merging a branch with the pattern `prepare-release/VERSION` into main. | ||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
name: 'Prepare a new version' | ||
if: startsWith(github.head_ref, 'prepare-release/') | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
token: ${{ secrets.GH_RELEASE_PAT }} | ||
fetch-depth: 0 | ||
|
||
# https://github.com/actions-ecosystem/action-regex-match | ||
- uses: actions-ecosystem/action-regex-match@v2 | ||
id: version-regex | ||
with: | ||
# Parse version from head branch | ||
text: ${{ github.head_ref }} | ||
# match: preprare-release/xx.xx.xx | ||
regex: '^prepare-release\/(\d+\.\d+\.\d+)(?:-(alpha|beta|rc)\.\d+)?$' | ||
|
||
- name: Extract version | ||
id: get_version | ||
run: | | ||
version=${{ steps.version-regex.outputs.match }} | ||
version=${version/'prepare-release/'/''} | ||
echo "version=$version" >> $GITHUB_OUTPUT | ||
|
||
- name: Setup pnpm | ||
uses: pnpm/action-setup@v4 | ||
with: | ||
version: 9 | ||
|
||
- name: Setup Node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version-file: 'package.json' | ||
cache: pnpm | ||
|
||
- name: Install dependencies | ||
run: pnpm install | ||
|
||
- name: Prepare release | ||
uses: getsentry/action-prepare-release@lms/write-config-branch | ||
if: github.event.pull_request.merged == true && steps.version-regex.outputs.match != '' && steps.get_version.outputs.version != '' | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GH_RELEASE_PAT }} | ||
with: | ||
version: ${{ github.event.inputs.version }} | ||
force: ${{ github.event.inputs.force }} | ||
merge_target: main | ||
craft_config_from_merge_target: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
.idea | ||
node_modules | ||
tmp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Publishing a Release | ||
|
||
_These steps are only relevant to Sentry employees when preparing and publishing a new release._ | ||
|
||
1. Run `pnpm changelog` on the `main` branch and determine what version will be released (we use | ||
[semver](https://semver.org)) | ||
2. Create a branch `prepare-release/VERSION`, e.g. `prepare-release/1.4.8`, off of main | ||
3. Update [`CHANGELOG.md`](https://github.com/getsentry/sentry-migr8/edit/main/CHANGELOG.md) to add an entry for | ||
the next release number and a list of changes since the last release. (See details below.) | ||
4. Open a PR with the title `meta(changelog): Update changelog for VERSION` against the `main` branch. | ||
5. **Be cautious!** The PR against `master` should be merged via "Merge Commit" | ||
6. When the PR is merged, it will automatically trigger the | ||
[Auto Release](https://github.com/getsentry/sentry-migr8/actions/workflows/auto-release.yml) on main. | ||
|
||
## Updating the Changelog | ||
|
||
1. Run `pnpm changelog` and copy everything. | ||
2. Create a new section in the changelog with the previously determined version number. | ||
3. Paste in the logs you copied earlier. | ||
4. Highlight any important changes with subheadings. | ||
5. 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!) | ||
6. Commit, push, and continue with step 4 from the previous section with the general instructions (above). | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this will not work, as this will just be triggered on every PR that is merged? 😅 this works in sentry-javascript because of gitflow, where we only merge into master when we actually release. here we'll need some other check I guess?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, forgot to add the check to only run on
prepare-release
branches. Added this now.