Skip to content

Commit e8e090f

Browse files
Merge pull request #1670 from NullVoxPopuli/release-plan
Release plan
2 parents 62b5a3d + d5e3599 commit e8e090f

10 files changed

+601
-1528
lines changed

.changeset/README.md

-8
This file was deleted.

.changeset/config.json

-31
This file was deleted.

.github/workflows/plan-release.yml

+93
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
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+
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+
# github-changelog can discover what's changed since the last release
50+
with:
51+
fetch-depth: 0
52+
ref: 'main'
53+
- uses: actions/setup-node@v4
54+
with:
55+
node-version: 18
56+
57+
- uses: pnpm/action-setup@v3
58+
with:
59+
version: 8
60+
- run: pnpm install --frozen-lockfile
61+
62+
- name: "Generate Explanation and Prep Changelogs"
63+
id: explanation
64+
run: |
65+
set +e
66+
67+
pnpm release-plan prepare 2> >(tee -a stderr.log >&2)
68+
69+
70+
if [ $? -ne 0 ]; then
71+
echo 'text<<EOF' >> $GITHUB_OUTPUT
72+
cat stderr.log >> $GITHUB_OUTPUT
73+
echo 'EOF' >> $GITHUB_OUTPUT
74+
else
75+
echo 'text<<EOF' >> $GITHUB_OUTPUT
76+
jq .description .release-plan.json -r >> $GITHUB_OUTPUT
77+
echo 'EOF' >> $GITHUB_OUTPUT
78+
fi
79+
env:
80+
GITHUB_AUTH: ${{ secrets.GITHUB_TOKEN }}
81+
82+
- uses: peter-evans/create-pull-request@v6
83+
with:
84+
commit-message: "Prepare Release using 'release-plan'"
85+
labels: "internal"
86+
branch: release-preview
87+
title: Prepare Release
88+
body: |
89+
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 👍
90+
91+
-----------------------------------------
92+
93+
${{ steps.explanation.outputs.text }}

.github/workflows/publish.yml

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
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+
53+
- uses: pnpm/action-setup@v3
54+
with:
55+
version: 8
56+
- run: pnpm install --frozen-lockfile
57+
- name: npm publish
58+
run: pnpm release-plan publish
59+
60+
env:
61+
GITHUB_AUTH: ${{ secrets.GITHUB_TOKEN }}
62+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.github/workflows/release.yml

-37
This file was deleted.

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Changelog

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 to 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/limber/pulls?q=is%3Apr+is%3Aopen+%22Prepare+Release%22+in%3Atitle) PR

package.json

+17-19
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,42 @@
11
{
22
"name": "limber-monorepo",
33
"private": true,
4+
"repository": {
5+
"type": "git",
6+
"url": "git@github.com:NullVoxPopuli/limber.git"
7+
},
48
"author": "NullVoxPopuli",
59
"scripts": {
6-
"dev": "node ./dev/index.js",
7-
"prepare": "pnpm build",
8-
"release": "changeset publish",
910
"build": "turbo build --filter=limber^... --filter=tutorial^...",
10-
"lint:fix": "turbo _:lint:fix --output-logs errors-only",
11+
"dev": "node ./dev/index.js",
1112
"lint": "turbo _:lint --output-logs errors-only",
13+
"lint:fix": "turbo _:lint:fix --output-logs errors-only",
14+
"prepare": "pnpm build",
1215
"start": "pnpm build && concurrently 'npm:start:tutorial' 'npm:start:repl' 'npm:start:styles' --names 'tutarial,repl,tailwind'",
13-
"start:tutorial": "pnpm --filter=tutorial start",
1416
"start:repl": "pnpm --filter=limber start",
15-
"start:styles": "pnpm --filter=limber-styles start"
16-
},
17-
"engines": {
18-
"node": ">= 16"
19-
},
20-
"volta": {
21-
"node": "20.11.1",
22-
"pnpm": "8.15.1"
17+
"start:styles": "pnpm --filter=limber-styles start",
18+
"start:tutorial": "pnpm --filter=tutorial start"
2319
},
2420
"devDependencies": {
2521
"@babel/core": "^7.23.9",
26-
"@changesets/changelog-github": "^0.5.0",
27-
"@changesets/cli": "^2.26.2",
2822
"@nullvoxpopuli/eslint-configs": "^3.2.2",
2923
"concurrently": "^8.2.2",
3024
"dev-tools": "workspace:*",
3125
"eslint": "^8.55.0",
3226
"pnpm-sync-dependencies-meta-injected": "^0.0.10",
3327
"prettier": "^3.2.5",
3428
"prettier-plugin-ember-template-tag": "^2.0.0",
29+
"release-plan": "^0.8.0",
3530
"turbo": "^1.12.2"
3631
},
3732
"packageManager": "pnpm@8.15.1",
33+
"engines": {
34+
"node": ">= 16"
35+
},
36+
"volta": {
37+
"node": "20.11.1",
38+
"pnpm": "8.15.1"
39+
},
3840
"pnpm": {
3941
"overrides": {
4042
"@nullvoxpopuli/eslint-configs": "^3.2.2",
@@ -57,10 +59,6 @@
5759
"rollup",
5860
"rsvp"
5961
]
60-
},
61-
"notes": {},
62-
"patchedDependencies": {
63-
"@changesets/assemble-release-plan@6.0.0": "patches/@changesets__assemble-release-plan@6.0.0.patch"
6462
}
6563
}
6664
}

0 commit comments

Comments
 (0)