Skip to content

Commit 4b86d33

Browse files
authored
Merge pull request #503 from ember-learn/release-plan-v3
use release-plan for legacy release
2 parents 6216711 + dcdc878 commit 4b86d33

File tree

5 files changed

+662
-40
lines changed

5 files changed

+662
-40
lines changed

.github/workflows/plan-release.yml

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

.github/workflows/publish.yml

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

RELEASE.md

Lines changed: 27 additions & 0 deletions
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/ember-learn/ember-styleguide/pulls?q=is%3Apr+is%3Aopen+%22Prepare+Release%22+in%3Atitle) PR

package.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@
88
"homepage": "https://ember-learn.github.io/ember-styleguide",
99
"repository": "https://github.com/ember-learn/ember-styleguide.git",
1010
"license": "MIT",
11-
"directories": {
12-
"doc": "doc",
13-
"test": "tests"
14-
},
1511
"contributors": [
1612
"Sivakumar Kailasam <[email protected]>",
1713
"Ember.JS Learning team"
1814
],
15+
"directories": {
16+
"doc": "doc",
17+
"test": "tests"
18+
},
1919
"scripts": {
2020
"build": "ember build --environment=production",
2121
"lint": "npm-run-all --aggregate-output --continue-on-error --parallel \"lint:!(fix)\"",
@@ -100,6 +100,7 @@
100100
"prettier": "^2.5.1",
101101
"qunit": "^2.17.2",
102102
"qunit-dom": "^1.6.0",
103+
"release-plan": "^0.7.0",
103104
"stylelint-config-standard": "^18.0.0",
104105
"stylelint-declaration-strict-value": "^1.0.4",
105106
"stylelint-order": "^1.0.0",

0 commit comments

Comments
 (0)