Skip to content

Commit 167b941

Browse files
committed
npx create-release-plan-setup@latest --update
1 parent 503d249 commit 167b941

5 files changed

Lines changed: 407 additions & 92 deletions

File tree

.github/workflows/plan-release.yml

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

.github/workflows/publish.yml

Lines changed: 49 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,62 @@
1-
name: Publish
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
26

37
on:
4-
push:
5-
tags:
6-
- 'v*'
7-
# Manual run
88
workflow_dispatch:
9-
inputs:
10-
tag:
11-
required: true
12-
type: string
13-
description: 'Tag to release'
9+
push:
10+
branches:
11+
- main
12+
- master
13+
14+
concurrency:
15+
group: publish-${{ github.head_ref || github.ref }}
16+
cancel-in-progress: true
1417

1518
jobs:
16-
release:
17-
name: release
19+
check-plan:
20+
name: "Check Release Plan"
1821
runs-on: ubuntu-latest
22+
outputs:
23+
command: ${{ steps.check-release.outputs.command }}
1924

2025
steps:
2126
- uses: actions/checkout@v4
2227
with:
23-
ref: ${{ github.event.inputs.tag || github.ref_name }}
28+
fetch-depth: 0
29+
ref: 'master'
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
2435

25-
- uses: wyvox/action-setup-pnpm@v3
26-
with:
27-
node-registry-url: 'https://registry.npmjs.org'
28-
args: '--no-frozen-lockfile'
29-
- run: git diff
30-
name: 'Did pnpm cause a diff?'
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
3144

32-
- run: pnpm publish --no-git-checks
33-
working-directory: './addon/'
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+
53+
- uses: pnpm/action-setup@v2
54+
with:
55+
version: 8
56+
- run: pnpm install --frozen-lockfile
57+
- name: npm publish
58+
run: pnpm release-plan publish
59+
3460
env:
35-
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
61+
GITHUB_AUTH: ${{ secrets.GITHUB_TOKEN }}
62+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

RELEASE.md

Lines changed: 11 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,15 @@
11
# Release Process
22

3-
Releases are mostly automated using
4-
[release-it](https://github.com/release-it/release-it/) and
5-
[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 prepare the release once the PR is merged.
64

75
## Preparation
86

9-
Since the majority of the actual release process is automated, the primary
10-
remaining task prior to releasing is confirming that all pull requests that
11-
have been merged since the last release have been labeled with the appropriate
12-
`lerna-changelog` labels and the titles have been updated to ensure they
13-
represent something that would make sense to our users. Some great information
14-
on why this is important can be found at
15-
[keepachangelog.com](https://keepachangelog.com/en/1.0.0/), but the overall
7+
Since the majority of the actual release process is automated, the remaining tasks before releasing are:
8+
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
11+
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
1613
guiding principle here is that changelogs are for humans, not machines.
1714

1815
When reviewing merged PR's the labels to be used are:
@@ -21,44 +18,10 @@ When reviewing merged PR's the labels to be used are:
2118
* enhancement - Used when the PR adds a new feature or enhancement.
2219
* bug - Used when the PR fixes a bug included in a previous release.
2320
* documentation - Used when the PR adds or updates documentation.
24-
* internal - Used for internal changes that still require a mention in the
25-
changelog/release notes.
26-
27-
## Release
28-
29-
Once the prep work is completed, the actual release is straight forward:
30-
31-
* First, ensure that you have installed your projects dependencies:
32-
33-
```sh
34-
pnpm install
35-
```
21+
* internal - Internal changes or things that don't fit in any other category.
3622

37-
* Second, ensure that you have obtained a
38-
[GitHub personal access token][generate-token] with the `repo` scope (no
39-
other permissions are needed). Make sure the token is available as the
40-
`GITHUB_AUTH` environment variable.
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`
4124

42-
For instance:
43-
44-
```bash
45-
export GITHUB_AUTH=abc123def456
46-
```
47-
48-
[generate-token]: https://github.com/settings/tokens/new?scopes=repo&description=GITHUB_AUTH+env+variable
49-
50-
* And last (but not least 😁) do your release.
51-
52-
```sh
53-
npx release-it
54-
```
55-
56-
[release-it](https://github.com/release-it/release-it/) manages the actual
57-
release process. It will prompt you to to choose the version number after which
58-
you will have the chance to hand tweak the changelog to be used (for the
59-
`CHANGELOG.md` and GitHub release), then `release-it` continues on to tagging,
60-
pushing the tag and commits, etc.
25+
## Release
6126

62-
Once the tag has been pushed, the GitHub workflow `publish.yml` will be triggered
63-
to publish the package(s) to npm. This workflow does not wait for tests to pass, so
64-
be sure to only run `release-it` on a passing build.
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/ember-cli/ember-page-title/pulls?q=is%3Apr+is%3Aopen+%22Prepare+Release%22+in%3Atitle) PR

package.json

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,22 @@
11
{
2+
"version": "8.2.0",
23
"private": true,
34
"repository": {
45
"type": "git",
56
"url": "[email protected]:ember-cli/ember-page-title.git"
67
},
78
"scripts": {
8-
"prepare": "pnpm build",
99
"build": "pnpm --filter 'ember-page-title' build",
1010
"lint": "pnpm --filter '*' lint",
1111
"lint:fix": "pnpm --filter '*' lint:fix",
12+
"prepare": "pnpm build",
1213
"test": "pnpm --filter '*' test"
1314
},
1415
"devDependencies": {
1516
"@release-it-plugins/lerna-changelog": "^6.0.0",
1617
"@release-it-plugins/workspaces": "^4.0.0",
17-
"release-it": "^16.1.5"
18+
"release-it": "^16.1.5",
19+
"release-plan": "^0.6.0"
1820
},
1921
"volta": {
2022
"node": "20.10.0",
@@ -23,26 +25,6 @@
2325
"publishConfig": {
2426
"registry": "https://registry.npmjs.org"
2527
},
26-
"release-it": {
27-
"plugins": {
28-
"@release-it-plugins/workspaces": {
29-
"publish": false
30-
},
31-
"@release-it-plugins/lerna-changelog": {
32-
"infile": "CHANGELOG.md",
33-
"launchEditor": true
34-
}
35-
},
36-
"git": {
37-
"tagName": "v${version}"
38-
},
39-
"npm": false,
40-
"github": {
41-
"release": true,
42-
"tokenRef": "GITHUB_AUTH"
43-
}
44-
},
45-
"version": "8.2.0",
4628
"pnpm": {
4729
"patchedDependencies": {
4830
@@ -70,5 +52,24 @@
7052
"@glimmer/*": "Glimmer is still pre 1.0, and every minor in pre-1.0 SemVer is a breaking chaneg. So because some dependencies (like 0.44.0 of Glimmer -- this is not compatible with current Glimmer (>= 0.80))"
7153
}
7254
}
55+
},
56+
"release-it": {
57+
"plugins": {
58+
"@release-it-plugins/workspaces": {
59+
"publish": false
60+
},
61+
"@release-it-plugins/lerna-changelog": {
62+
"infile": "CHANGELOG.md",
63+
"launchEditor": true
64+
}
65+
},
66+
"git": {
67+
"tagName": "v${version}"
68+
},
69+
"npm": false,
70+
"github": {
71+
"release": true,
72+
"tokenRef": "GITHUB_AUTH"
73+
}
7374
}
7475
}

0 commit comments

Comments
 (0)