Skip to content

Commit 9b226da

Browse files
authored
add release plan (#2563)
1 parent 5ad3a77 commit 9b226da

File tree

5 files changed

+406
-26
lines changed

5 files changed

+406
-26
lines changed

.github/workflows/build.yml

+5-26
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ jobs:
252252
needs:
253253
- test
254254
- ember-try
255-
- build
255+
- build
256256
runs-on: ubuntu-latest
257257
steps:
258258
- name: Set up node
@@ -272,8 +272,8 @@ jobs:
272272
echo "REFRESH_TOKEN=${{ secrets.GOOGLE_NIGHTLY_REFRESH_TOKEN }}" >> $GITHUB_ENV
273273
else
274274
echo "EXTENSION_ID=bmdblncegkenkacieihfhpjfppoconhi" >> $GITHUB_ENV
275-
echo "CLIENT_ID=${{ secrets.GOOGLE_STABLE_CLIENT_ID }}" >> $GITHUB_ENV
276-
echo "REFRESH_TOKEN=${{ secrets.GOOGLE_STABLE_REFRESH_TOKEN }}" >> $GITHUB_ENV
275+
echo "CLIENT_ID=${{ secrets.GOOGLE_NIGHTLY_CLIENT_ID }}" >> $GITHUB_ENV
276+
echo "REFRESH_TOKEN=${{ secrets.GOOGLE_NIGHTLY_REFRESH_TOKEN }}" >> $GITHUB_ENV
277277
fi
278278
- name: Upload to Chrome Web Store
279279
if: >-
@@ -286,7 +286,7 @@ jobs:
286286
needs:
287287
- test
288288
- ember-try
289-
- build
289+
- build
290290
runs-on: ubuntu-latest
291291
steps:
292292
- name: Set up nod
@@ -314,7 +314,7 @@ jobs:
314314
needs:
315315
- test
316316
- ember-try
317-
- build
317+
- build
318318
runs-on: ubuntu-latest
319319
steps:
320320
- name: Set up node
@@ -336,25 +336,4 @@ jobs:
336336
npm whoami
337337
if [[ "$GITHUB_EVENT_NAME" == "schedule" ]]; then
338338
npm publish --tag alpha
339-
else
340-
npm publish
341339
fi
342-
343-
publish-github:
344-
name: Publish GitHub release
345-
needs:
346-
- test
347-
- ember-try
348-
- build
349-
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
350-
runs-on: ubuntu-latest
351-
steps:
352-
- name: Create release
353-
uses: actions/create-release@v1
354-
env:
355-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
356-
with:
357-
tag_name: ${{ github.ref }}
358-
release_name: ${{ github.ref }}
359-
draft: false
360-
prerelease: false

.github/workflows/plan-release.yml

+83
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
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+
# We need to download lots of history so that
46+
# lerna-changelog can discover what's changed since the last release
47+
with:
48+
fetch-depth: 0
49+
- uses: actions/setup-node@v4
50+
with:
51+
node-version: 18
52+
53+
- uses: pnpm/action-setup@v2
54+
with:
55+
version: 8
56+
- run: pnpm install --frozen-lockfile
57+
58+
- name: "Generate Explanation and Prep Changelogs"
59+
id: explanation
60+
run: |
61+
set -x
62+
63+
pnpm release-plan prepare --singlePackage=ember-inspector
64+
65+
echo 'text<<EOF' >> $GITHUB_OUTPUT
66+
jq .description .release-plan.json -r >> $GITHUB_OUTPUT
67+
echo 'EOF' >> $GITHUB_OUTPUT
68+
env:
69+
GITHUB_AUTH: ${{ secrets.GITHUB_TOKEN }}
70+
71+
- uses: peter-evans/create-pull-request@v5
72+
with:
73+
commit-message: "Prepare Release using 'release-plan'"
74+
author: "github-actions[bot] <github-actions-bot@users.noreply.github.com>"
75+
labels: "internal"
76+
branch: release-preview
77+
title: Prepare Release
78+
body: |
79+
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 👍
80+
81+
-----------------------------------------
82+
83+
${{ steps.explanation.outputs.text }}

.github/workflows/publish.yml

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
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: actions/setup-node@v4
45+
with:
46+
node-version: 18
47+
# This creates an .npmrc that reads the NODE_AUTH_TOKEN environment variable
48+
registry-url: 'https://registry.npmjs.org'
49+
50+
- uses: pnpm/action-setup@v2
51+
with:
52+
version: 8
53+
- run: pnpm install --frozen-lockfile
54+
- name: npm publish
55+
run: pnpm release-plan publish --singlePackage=ember-inspector
56+
env:
57+
GITHUB_AUTH: ${{ secrets.GITHUB_TOKEN }}
58+
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}

package.json

+2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"test": "tests"
1111
},
1212
"scripts": {
13+
"prepublishOnly": "node -e 'process.exit(!require(\"fs\").existsSync(\"./dist\"))' || pnpm build:production",
1314
"build": "ember build",
1415
"build:production": "EMBER_ENV=production node scripts/download-panes.js && ember build --environment production && gulp compress:chrome && gulp compress:firefox && gulp clean-tmp",
1516
"changelog": "github_changelog_generator -u emberjs -p ember-inspector --since-tag v3.8.0",
@@ -28,6 +29,7 @@
2829
"watch": "ember build --watch"
2930
},
3031
"devDependencies": {
32+
"release-plan": "^0.8.0",
3133
"@babel/eslint-parser": "^7.16.0",
3234
"@babel/helper-call-delegate": "^7.12.13",
3335
"@babel/plugin-proposal-decorators": "^7.16.0",

0 commit comments

Comments
 (0)