Skip to content

Commit 0ab298e

Browse files
Merge pull request #1607 from glimmerjs/release-plan
Setup Release plan, remove release-it
2 parents 3768842 + f561b50 commit 0ab298e

7 files changed

+622
-251
lines changed

.github/workflows/plan-release.yml

+92
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
name: Release Plan Review
2+
on:
3+
push:
4+
branches:
5+
- main
6+
- master
7+
pull_request_target: # This workflow has permissions on the repo, do NOT run code from PRs in this workflow. See https://securitylab.github.com/research/github-actions-preventing-pwn-requests/
8+
types:
9+
- labeled
10+
- unlabeled
11+
12+
concurrency:
13+
group: plan-release # only the latest one of these should ever be running
14+
cancel-in-progress: true
15+
16+
jobs:
17+
check-plan:
18+
name: "Check Release Plan"
19+
runs-on: ubuntu-latest
20+
outputs:
21+
command: ${{ steps.check-release.outputs.command }}
22+
23+
steps:
24+
- uses: actions/checkout@v4
25+
with:
26+
fetch-depth: 0
27+
ref: 'main'
28+
# This will only cause the `check-plan` job to have a "command" of `release`
29+
# when the .release-plan.json file was changed on the last commit.
30+
- id: check-release
31+
run: if git diff --name-only HEAD HEAD~1 | grep -w -q ".release-plan.json"; then echo "command=release"; fi >> $GITHUB_OUTPUT
32+
33+
prepare_release_notes:
34+
name: Prepare Release Notes
35+
runs-on: ubuntu-latest
36+
timeout-minutes: 5
37+
needs: check-plan
38+
permissions:
39+
contents: write
40+
issues: read
41+
pull-requests: write
42+
outputs:
43+
explanation: ${{ steps.explanation.outputs.text }}
44+
# only run on push event if plan wasn't updated (don't create a release plan when we're releasing)
45+
# only run on labeled event if the PR has already been merged
46+
if: (github.event_name == 'push' && needs.check-plan.outputs.command != 'release') || (github.event_name == 'pull_request_target' && github.event.pull_request.merged == true)
47+
48+
steps:
49+
- uses: actions/checkout@v4
50+
# We need to download lots of history so that
51+
# github-changelog can discover what's changed since the last release
52+
with:
53+
fetch-depth: 0
54+
ref: 'main'
55+
- uses: actions/setup-node@v4
56+
with:
57+
node-version: 18
58+
- uses: pnpm/action-setup@v4
59+
with:
60+
version: 9
61+
- run: pnpm install --frozen-lockfile
62+
- name: "Generate Explanation and Prep Changelogs"
63+
id: explanation
64+
run: |
65+
set +e
66+
pnpm release-plan prepare 2> >(tee -a release-plan-stderr.txt >&2)
67+
68+
if [ $? -ne 0 ]; then
69+
echo 'text<<EOF' >> $GITHUB_OUTPUT
70+
cat release-plan-stderr.txt >> $GITHUB_OUTPUT
71+
echo 'EOF' >> $GITHUB_OUTPUT
72+
else
73+
echo 'text<<EOF' >> $GITHUB_OUTPUT
74+
jq .description .release-plan.json -r >> $GITHUB_OUTPUT
75+
echo 'EOF' >> $GITHUB_OUTPUT
76+
rm release-plan-stderr.txt
77+
fi
78+
env:
79+
GITHUB_AUTH: ${{ secrets.GITHUB_TOKEN }}
80+
81+
- uses: peter-evans/create-pull-request@v6
82+
with:
83+
commit-message: "Prepare Release using 'release-plan'"
84+
labels: "internal"
85+
branch: release-preview
86+
title: Prepare Release
87+
body: |
88+
This PR is a preview of the release that [release-plan](https://github.com/embroider-build/release-plan) has prepared. To release you should just merge this PR 👍
89+
90+
-----------------------------------------
91+
92+
${{ steps.explanation.outputs.text }}

.github/workflows/publish.yml

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# For every push to the master branch, this checks if the release-plan was
2+
# updated and if it was it will publish stable npm packages based on the
3+
# release plan
4+
5+
name: Publish Stable
6+
7+
on:
8+
workflow_dispatch:
9+
push:
10+
branches:
11+
- main
12+
- master
13+
14+
concurrency:
15+
group: publish-${{ github.head_ref || github.ref }}
16+
cancel-in-progress: true
17+
18+
jobs:
19+
check-plan:
20+
name: "Check Release Plan"
21+
runs-on: ubuntu-latest
22+
outputs:
23+
command: ${{ steps.check-release.outputs.command }}
24+
25+
steps:
26+
- uses: actions/checkout@v4
27+
with:
28+
fetch-depth: 0
29+
ref: 'main'
30+
# This will only cause the `check-plan` job to have a result of `success`
31+
# when the .release-plan.json file was changed on the last commit. This
32+
# plus the fact that this action only runs on main will be enough of a guard
33+
- id: check-release
34+
run: if git diff --name-only HEAD HEAD~1 | grep -w -q ".release-plan.json"; then echo "command=release"; fi >> $GITHUB_OUTPUT
35+
36+
publish:
37+
name: "NPM Publish"
38+
runs-on: ubuntu-latest
39+
needs: check-plan
40+
if: needs.check-plan.outputs.command == 'release'
41+
permissions:
42+
contents: write
43+
pull-requests: write
44+
45+
steps:
46+
- uses: actions/checkout@v4
47+
- uses: actions/setup-node@v4
48+
with:
49+
node-version: 18
50+
# This creates an .npmrc that reads the NODE_AUTH_TOKEN environment variable
51+
registry-url: 'https://registry.npmjs.org'
52+
- uses: pnpm/action-setup@v4
53+
with:
54+
version: 9
55+
- run: pnpm install --frozen-lockfile
56+
- name: npm publish
57+
run: pnpm release-plan publish
58+
env:
59+
GITHUB_AUTH: ${{ secrets.GITHUB_TOKEN }}
60+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# Changelog
2+
13

24

35

RELEASE.md

+15-51
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,27 @@
11
# Release Process
22

3-
> **Warning**
4-
> this file is currently outdated, but will be updated soon.
5-
6-
Releases are mostly automated using
7-
[release-it](https://github.com/release-it/release-it/) and
8-
[lerna-changelog](https://github.com/lerna/lerna-changelog/).
3+
Releases in this repo are mostly automated using [release-plan](https://github.com/embroider-build/release-plan/). Once you label all your PRs correctly (see below) you will have an automatically generated PR that updates your CHANGELOG.md file and a `.release-plan.json` that is used to prepare the release once the PR is merged.
94

105
## Preparation
116

12-
Since the majority of the actual release process is automated, the primary
13-
remaining task prior to releasing is confirming that all pull requests that
14-
have been merged since the last release have been labeled with the appropriate
15-
`lerna-changelog` labels and the titles have been updated to ensure they
16-
represent something that would make sense to our users. Some great information
17-
on why this is important can be found at
18-
[keepachangelog.com](https://keepachangelog.com/en/1.0.0/), but the overall
19-
guiding principle here is that changelogs are for humans, not machines.
20-
21-
When reviewing merged PR's the labels to be used are:
22-
23-
- breaking - Used when the PR is considered a breaking change.
24-
- enhancement - Used when the PR adds a new feature or enhancement.
25-
- bug - Used when the PR fixes a bug included in a previous release.
26-
- documentation - Used when the PR adds or updates documentation.
27-
- internal - Used for internal changes that still require a mention in the
28-
changelog/release notes.
29-
30-
## Release
7+
Since the majority of the actual release process is automated, the remaining tasks before releasing are:
318

32-
Once the prep work is completed, the actual release is straight forward:
9+
- correctly labeling **all** pull requests that have been merged since the last release
10+
- updating pull request titles so they make sense to our users
3311

34-
- First, ensure that you have installed your projects dependencies:
35-
36-
```sh
37-
yarn install
38-
```
39-
40-
- Second, ensure that you have obtained a
41-
[GitHub personal access token][generate-token] with the `repo` scope (no
42-
other permissions are needed). Make sure the token is available as the
43-
`GITHUB_AUTH` environment variable.
44-
45-
For instance:
12+
Some great information on why this is important can be found at [keepachangelog.com](https://keepachangelog.com/en/1.1.0/), but the overall
13+
guiding principle here is that changelogs are for humans, not machines.
4614

47-
```bash
48-
export GITHUB_AUTH=abc123def456
49-
```
15+
When reviewing merged PR's the labels to be used are:
5016

51-
[generate-token]: https://github.com/settings/tokens/new?scopes=repo&description=GITHUB_AUTH+env+variable
17+
* breaking - Used when the PR is considered a breaking change.
18+
* enhancement - Used when the PR adds a new feature or enhancement.
19+
* bug - Used when the PR fixes a bug included in a previous release.
20+
* documentation - Used when the PR adds or updates documentation.
21+
* internal - Internal changes or things that don't fit in any other category.
5222

53-
- And last (but not least 😁) do your release.
23+
**Note:** `release-plan` requires that **all** PRs are labeled. If a PR doesn't fit in a category it's fine to label it as `internal`
5424

55-
```sh
56-
npx release-it
57-
```
25+
## Release
5826

59-
[release-it](https://github.com/release-it/release-it/) manages the actual
60-
release process. It will prompt you to to choose the version number after which
61-
you will have the chance to hand tweak the changelog to be used (for the
62-
`CHANGELOG.md` and GitHub release), then `release-it` continues on to tagging,
63-
pushing the tag and commits, etc.
27+
Once the prep work is completed, the actual release is straight forward: you just need to merge the open [Plan Release](https://github.com/glimmerjs/glimmer-vm/pulls?q=is%3Apr+is%3Aopen+%22Prepare+Release%22+in%3Atitle) PR

package.json

+19-48
Original file line numberDiff line numberDiff line change
@@ -36,27 +36,6 @@
3636
"test:types": "node bin/run-types-tests.mjs",
3737
"unlink:all": "esyes ./bin/unlink-all.mts"
3838
},
39-
"pnpm": {
40-
"overrides": {
41-
"@rollup/pluginutils": "^5.0.2",
42-
"@types/node": "$@types/node",
43-
"typescript": "$typescript"
44-
},
45-
"patchedDependencies": {
46-
"@release-it-plugins/workspaces@4.0.0": "patches/@release-it-plugins__workspaces@4.0.0.patch"
47-
},
48-
"peerDependencyRules": {
49-
"allowAny": [
50-
"vite-plugin-babel",
51-
"vite"
52-
],
53-
"allowedVersions": {
54-
"@rollup/pluginutils": "5",
55-
"rollup": "3",
56-
"typescript": "5"
57-
}
58-
}
59-
},
6039
"devDependencies": {
6140
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
6241
"@babel/plugin-transform-modules-commonjs": "^7.23.3",
@@ -115,6 +94,7 @@
11594
"puppeteer-chromium-resolver": "^20.0.0",
11695
"qunit": "^2.19.4",
11796
"release-it": "^16.2.1",
97+
"release-plan": "^0.9.0",
11898
"rimraf": "^5.0.0",
11999
"rollup": "^4.5.1",
120100
"semver": "^7.5.2",
@@ -128,33 +108,6 @@
128108
"xo": "^0.54.2",
129109
"zx": "^7.2.3"
130110
},
131-
"release-it": {
132-
"plugins": {
133-
"@release-it-plugins/workspaces": {
134-
"publish": false,
135-
"workspaces": [
136-
"packages/@glimmer/*"
137-
],
138-
"additionalManifests": {
139-
"dependencyUpdates": []
140-
}
141-
},
142-
"@release-it-plugins/lerna-changelog": {
143-
"infile": "CHANGELOG.md",
144-
"launchEditor": true
145-
}
146-
},
147-
"git": {
148-
"commitMessage": "v${version}",
149-
"tagName": "v${version}"
150-
},
151-
"github": {
152-
"release": true,
153-
"releaseName": "v${version}",
154-
"tokenRef": "GITHUB_AUTH"
155-
},
156-
"npm": false
157-
},
158111
"changelog": {
159112
"repo": "glimmerjs/glimmer-vm",
160113
"labels": {
@@ -171,5 +124,23 @@
171124
"volta": {
172125
"node": "20.9.0",
173126
"pnpm": "8.5.0"
127+
},
128+
"pnpm": {
129+
"overrides": {
130+
"@rollup/pluginutils": "^5.0.2",
131+
"@types/node": "$@types/node",
132+
"typescript": "$typescript"
133+
},
134+
"peerDependencyRules": {
135+
"allowAny": [
136+
"vite-plugin-babel",
137+
"vite"
138+
],
139+
"allowedVersions": {
140+
"@rollup/pluginutils": "5",
141+
"rollup": "3",
142+
"typescript": "5"
143+
}
144+
}
174145
}
175146
}

patches/@release-it-plugins__workspaces@4.0.0.patch

-20
This file was deleted.

0 commit comments

Comments
 (0)