Skip to content

Commit 5b099b1

Browse files
Merge pull request #1062 from NullVoxPopuli/setup-release-plan
Setup release plan
2 parents 4799e44 + 28f378d commit 5b099b1

8 files changed

+970
-1020
lines changed

.github/workflows/ci.yml

-35
Original file line numberDiff line numberDiff line change
@@ -174,41 +174,6 @@ jobs:
174174
run: pnpm test:ember
175175
working-directory: ${{ matrix.concurrencyVersion }}
176176

177-
178-
# https://github.com/changesets/action
179-
release:
180-
name: Release
181-
timeout-minutes: 5
182-
runs-on: ubuntu-latest
183-
if: github.ref == 'refs/heads/main'
184-
needs:
185-
- default_tests
186-
- floating_tests
187-
- typecheck
188-
- try_scenarios
189-
- test-ember-concurrency
190-
191-
steps:
192-
- uses: actions/checkout@v4
193-
with:
194-
persist-credentials: false
195-
- uses: wyvox/action-setup-pnpm@v3
196-
with:
197-
node-version: 18.18.1
198-
- uses: ./.github/actions/download-built-package
199-
- name: Create Release Pull Request or Publish to npm
200-
id: changesets
201-
uses: changesets/action@v1
202-
with:
203-
# This expects you to have a script called release which does a build for your packages and calls changeset publish
204-
publish: pnpm release
205-
title: "Release Preview"
206-
env:
207-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
208-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
209-
210-
211-
212177
MeasureAssetSizes:
213178
name: Measure Asset Sizes
214179
runs-on: ubuntu-latest

.github/workflows/plan-release.yml

+72
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
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: 'main'
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+
outputs:
38+
explanation: ${{ steps.explanation.outputs.text }}
39+
# only run on push event if plan wasn't updated (don't create a release plan when we're releasing)
40+
# only run on labeled event if the PR has already been merged
41+
if: (github.event_name == 'push' && needs.check-plan.outputs.command != 'release') || (github.event_name == 'pull_request' && github.event.pull_request.merged == true)
42+
43+
steps:
44+
- uses: actions/checkout@v4
45+
- uses: wyvox/action-setup-pnpm@v3
46+
47+
- name: "Generate Explanation and Prep Changelogs"
48+
id: explanation
49+
run: |
50+
set -x
51+
52+
pnpm release-plan prepare
53+
54+
echo 'text<<EOF' >> $GITHUB_OUTPUT
55+
jq .description .release-plan.json -r >> $GITHUB_OUTPUT
56+
echo 'EOF' >> $GITHUB_OUTPUT
57+
env:
58+
GITHUB_AUTH: ${{ secrets.GITHUB_TOKEN }}
59+
60+
- uses: peter-evans/create-pull-request@v5
61+
with:
62+
commit-message: "Prepare Release using 'release-plan'"
63+
author: "github-actions[bot] <github-actions-bot@users.noreply.github.com>"
64+
labels: "internal"
65+
branch: release-preview
66+
title: Prepare Release
67+
body: |
68+
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 👍
69+
70+
-----------------------------------------
71+
72+
${{ steps.explanation.outputs.text }}

.github/workflows/publish.yml

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
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+
42+
steps:
43+
- uses: actions/checkout@v4
44+
- uses: wyvox/action-setup-pnpm@v3
45+
with:
46+
# This creates an .npmrc that reads the NODE_AUTH_TOKEN environment variable
47+
node-registry-url: 'https://registry.npmjs.org'
48+
- name: npm publish
49+
run: pnpm release-plan publish
50+
51+
env:
52+
GITHUB_AUTH: ${{ secrets.GITHUB_TOKEN }}
53+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
File renamed without changes.

RELEASE.md

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Release Process
2+
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.
4+
5+
## Preparation
6+
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
13+
guiding principle here is that changelogs are for humans, not machines.
14+
15+
When reviewing merged PR's the labels to be used are:
16+
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.
22+
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`
24+
25+
## Release
26+
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/NullVoxPopuli/ember-resources/pulls?q=is%3Apr+is%3Aopen+%22Prepare+Release%22+in%3Atitle) PR

package.json

+8-15
Original file line numberDiff line numberDiff line change
@@ -4,45 +4,41 @@
44
"license": "MIT",
55
"author": "NullVoxPopuli",
66
"scripts": {
7-
"release": "changeset publish",
7+
"build": "pnpm run --filter ember-resources build",
8+
"build:docs": "pnpm run --filter docs docs:collect",
9+
"ci:update": "npx ember-ci-update",
810
"dev": "concurrently 'npm:dev:*' --prefix-colors cyan,white,yellow --restart-tries -1",
9-
"dev:ember": "pnpm run --filter test-app start",
1011
"dev:addon": "pnpm run --filter ember-resources start --no-watch.clearScreen",
1112
"dev:docs": "pnpm run --filter docs docs:watch --preserveWatchOutput",
12-
"ci:update": "npx ember-ci-update",
13-
"build": "pnpm run --filter ember-resources build",
14-
"build:docs": "pnpm run --filter docs docs:collect",
13+
"dev:ember": "pnpm run --filter test-app start",
1514
"lint": "pnpm run --filter '*' lint",
1615
"lint:fix": "pnpm run --filter '*' lint:fix"
1716
},
1817
"devDependencies": {
19-
"@changesets/changelog-github": "^0.5.0",
20-
"@changesets/cli": "^2.26.0",
2118
"@nullvoxpopuli/eslint-configs": "^3.2.0",
2219
"concurrently": "^8.0.0",
2320
"eslint": "^8.35.0",
2421
"loader.js": "^4.7.0",
2522
"prettier": "^3.0.0",
23+
"release-plan": "^0.6.0",
2624
"typescript": "^5.0.0"
2725
},
26+
"packageManager": "pnpm@8.12.1",
2827
"engines": {
2928
"node": ">= 18.*",
30-
"yarn": "use pnpm",
31-
"npm": "use pnpm"
29+
"npm": "use pnpm",
30+
"yarn": "use pnpm"
3231
},
3332
"volta": {
3433
"node": "20.10.0",
3534
"pnpm": "8.12.1"
3635
},
37-
"packageManager": "pnpm@8.12.1",
3836
"pnpm": {
3937
"overrides": {
4038
"@types/eslint": "7.29.0",
41-
"@changesets/assemble-release-plan": "5.2.3",
4239
"mustache": "^4.2.0"
4340
},
4441
"overrides-notes": {
45-
"@changesets/assemble-release-plan": "patched, we don't want drift until https://github.com/changesets/changesets/issues/835 is resolved",
4642
"@types/eslint": "webpack brings in @types/eslint@8, which breaks our type checking",
4743
"mustache": "ember-cli -> testem -> consolidate -> mustache is ancient"
4844
},
@@ -55,9 +51,6 @@
5551
"ember-source",
5652
"typescript"
5753
]
58-
},
59-
"patchedDependencies": {
60-
"@changesets/assemble-release-plan@5.2.3": "patches/@changesets__assemble-release-plan@5.2.3.patch"
6154
}
6255
}
6356
}

patches/@changesets__assemble-release-plan@5.2.3.patch

-39
This file was deleted.

0 commit comments

Comments
 (0)