Skip to content

Commit aea08d2

Browse files
authored
update release-plan (#2649)
2 parents cb4f9ef + 3899168 commit aea08d2

File tree

4 files changed

+427
-248
lines changed

4 files changed

+427
-248
lines changed

.github/workflows/plan-release.yml

Lines changed: 39 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,80 +1,91 @@
1-
name: Release Plan Review
1+
name: Plan Release
22
on:
3+
workflow_dispatch:
34
push:
45
branches:
56
- main
67
- master
7-
pull_request:
8+
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/
89
types:
910
- labeled
11+
- unlabeled
1012

1113
concurrency:
1214
group: plan-release # only the latest one of these should ever be running
1315
cancel-in-progress: true
1416

1517
jobs:
16-
check-plan:
17-
name: "Check Release Plan"
18+
is-this-a-release:
19+
name: "Is this a release?"
1820
runs-on: ubuntu-latest
1921
outputs:
2022
command: ${{ steps.check-release.outputs.command }}
2123

2224
steps:
2325
- uses: actions/checkout@v4
2426
with:
25-
fetch-depth: 0
27+
fetch-depth: 2
2628
ref: 'main'
27-
# This will only cause the `check-plan` job to have a "command" of `release`
29+
# This will only cause the `is-this-a-release` job to have a "command" of `release`
2830
# when the .release-plan.json file was changed on the last commit.
2931
- id: check-release
3032
run: if git diff --name-only HEAD HEAD~1 | grep -w -q ".release-plan.json"; then echo "command=release"; fi >> $GITHUB_OUTPUT
3133

32-
prepare_release_notes:
33-
name: Prepare Release Notes
34+
create-prepare-release-pr:
35+
name: Create Prepare Release PR
3436
runs-on: ubuntu-latest
3537
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)
38+
needs: is-this-a-release
39+
permissions:
40+
contents: write
41+
issues: read
42+
pull-requests: write
43+
# only run on push event or workflow dispatch if plan wasn't updated (don't create a release plan when we're releasing)
4044
# 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)
45+
if: ((github.event_name == 'push' || github.event_name == 'workflow_dispatch') && needs.is-this-a-release.outputs.command != 'release') || (github.event_name == 'pull_request_target' && github.event.pull_request.merged == true)
4246

4347
steps:
4448
- uses: actions/checkout@v4
4549
# We need to download lots of history so that
46-
# lerna-changelog can discover what's changed since the last release
50+
# github-changelog can discover what's changed since the last release
4751
with:
4852
fetch-depth: 0
53+
ref: 'main'
54+
- uses: pnpm/action-setup@v4
4955
- uses: actions/setup-node@v4
5056
with:
5157
node-version: 18
52-
53-
- uses: pnpm/action-setup@v2
54-
with:
55-
version: 8
58+
cache: pnpm
5659
- run: pnpm install --frozen-lockfile
57-
5860
- name: "Generate Explanation and Prep Changelogs"
5961
id: explanation
6062
run: |
61-
set -x
63+
set +e
64+
pnpm release-plan prepare 2> >(tee -a release-plan-stderr.txt >&2)
6265
63-
pnpm release-plan prepare --singlePackage=ember-inspector
66+
if [ $? -ne 0 ]; then
67+
release_plan_output=$(cat release-plan-stderr.txt)
68+
else
69+
release_plan_output=$(jq .description .release-plan.json -r)
70+
rm release-plan-stderr.txt
6471
65-
echo 'text<<EOF' >> $GITHUB_OUTPUT
66-
jq .description .release-plan.json -r >> $GITHUB_OUTPUT
67-
echo 'EOF' >> $GITHUB_OUTPUT
72+
if [ $(jq '.solution | length' .release-plan.json) -eq 1 ]; then
73+
new_version=$(jq -r '.solution[].newVersion' .release-plan.json)
74+
echo "new_version=v$new_version" >> $GITHUB_OUTPUT
75+
fi
76+
fi
77+
echo 'text<<EOF' >> $GITHUB_OUTPUT
78+
echo "$release_plan_output" >> $GITHUB_OUTPUT
79+
echo 'EOF' >> $GITHUB_OUTPUT
6880
env:
6981
GITHUB_AUTH: ${{ secrets.GITHUB_TOKEN }}
7082

71-
- uses: peter-evans/create-pull-request@v5
83+
- uses: peter-evans/create-pull-request@v7
7284
with:
73-
commit-message: "Prepare Release using 'release-plan'"
74-
author: "github-actions[bot] <[email protected]>"
85+
commit-message: "Prepare Release ${{ steps.explanation.outputs.new_version}} using 'release-plan'"
7586
labels: "internal"
7687
branch: release-preview
77-
title: Prepare Release
88+
title: Prepare Release ${{ steps.explanation.outputs.new_version }}
7889
body: |
7990
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 👍
8091

.github/workflows/publish.yml

Lines changed: 13 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
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
1+
# For every push to the primary branch with .release-plan.json modified,
2+
# runs release-plan.
43

54
name: Publish Stable
65

@@ -10,51 +9,37 @@ on:
109
branches:
1110
- main
1211
- master
12+
paths:
13+
- '.release-plan.json'
1314

1415
concurrency:
1516
group: publish-${{ github.head_ref || github.ref }}
1617
cancel-in-progress: true
1718

1819
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-
3620
publish:
3721
name: "NPM Publish"
3822
runs-on: ubuntu-latest
39-
needs: check-plan
40-
if: needs.check-plan.outputs.command == 'release'
23+
permissions:
24+
contents: write
25+
pull-requests: write
26+
id-token: write
27+
attestations: write
4128

4229
steps:
4330
- uses: actions/checkout@v4
4431
with:
4532
token: ${{ secrets.GH_PAT }}
33+
- uses: pnpm/action-setup@v4
4634
- uses: actions/setup-node@v4
4735
with:
4836
node-version: 18
4937
# This creates an .npmrc that reads the NODE_AUTH_TOKEN environment variable
5038
registry-url: 'https://registry.npmjs.org'
51-
52-
- uses: pnpm/action-setup@v2
53-
with:
54-
version: 8
39+
cache: pnpm
5540
- run: pnpm install --frozen-lockfile
56-
- name: npm publish
57-
run: pnpm release-plan publish --singlePackage=ember-inspector
41+
- name: Publish to NPM
42+
run: NPM_CONFIG_PROVENANCE=true pnpm release-plan publish
5843
env:
5944
GITHUB_AUTH: ${{ secrets.GH_PAT }}
6045
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}

package.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
"test": "tests"
1111
},
1212
"scripts": {
13-
"prepublishOnly": "node -e 'process.exit(!require(\"fs\").existsSync(\"./dist\"))' || pnpm build:production",
1413
"build": "ember build",
1514
"build:production": "EMBER_ENV=production node scripts/download-panes.js && ember build --environment production && gulp compress:chrome && gulp compress:firefox && gulp clean-tmp",
1615
"changelog": "github_changelog_generator -u emberjs -p ember-inspector --since-tag v3.8.0",
@@ -25,6 +24,7 @@
2524
"lint:js:fix": "eslint . --fix",
2625
"lint:types": "tsc --noEmit",
2726
"lock-version": "pnpm build:production && pnpm compress:panes",
27+
"prepublishOnly": "node -e 'process.exit(!require(\"fs\").existsSync(\"./dist\"))' || pnpm build:production",
2828
"serve:bookmarklet": "ember serve --port 9191",
2929
"start": "ember serve",
3030
"test": "concurrently \"pnpm:lint\" \"pnpm:test:*\" --names \"lint,test:\" --prefixColors auto",
@@ -49,10 +49,10 @@
4949
"@eslint/js": "^9.17.0",
5050
"@glimmer/component": "^1.1.2",
5151
"@glimmer/tracking": "^1.1.2",
52-
"@html-next/vertical-collection": "^4.0.2",
5352
"@glint/environment-ember-loose": "^1.5.0",
5453
"@glint/environment-ember-template-imports": "^1.5.0",
5554
"@glint/template": "^1.5.0",
55+
"@html-next/vertical-collection": "^4.0.2",
5656
"@tsconfig/ember": "^3.0.8",
5757
"@types/chrome": "^0.0.250",
5858
"@types/eslint__js": "^8.42.3",
@@ -136,7 +136,7 @@
136136
"qunit-dom": "^3.4.0",
137137
"release-it": "^15.11.0",
138138
"release-it-lerna-changelog": "^5.0.0",
139-
"release-plan": "^0.8.0",
139+
"release-plan": "^0.16.0",
140140
"sass": "^1.79.4",
141141
"source-map-js": "^1.2.1",
142142
"stylelint": "^16.13.2",
@@ -148,10 +148,15 @@
148148
"typescript-eslint": "^8.18.2",
149149
"webpack": "^5.97.1"
150150
},
151+
"packageManager": "[email protected]",
151152
"engines": {
152153
"node": ">= 18",
153154
"pnpm": "^9.0.0"
154155
},
156+
"volta": {
157+
"node": "18.20.4",
158+
"pnpm": "9.12.1"
159+
},
155160
"publishConfig": {
156161
"registry": "https://registry.npmjs.org"
157162
},
@@ -189,10 +194,5 @@
189194
"npm": {
190195
"publish": false
191196
}
192-
},
193-
"volta": {
194-
"node": "18.20.4",
195-
"pnpm": "9.12.1"
196-
},
197-
"packageManager": "[email protected]"
197+
}
198198
}

0 commit comments

Comments
 (0)