Skip to content

Commit 6ad2839

Browse files
Update release-plan
1 parent c498296 commit 6ad2839

File tree

3 files changed

+45
-85
lines changed

3 files changed

+45
-85
lines changed

.github/workflows/plan-release.yml

Lines changed: 23 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,83 +1,58 @@
1-
name: Release Plan Review
1+
name: Plan Release
22
on:
3+
workflow_dispatch:
34
push:
45
branches:
56
- main
6-
pull_request:
7+
- master
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/
79
types:
810
- labeled
11+
- unlabeled
912

1013
concurrency:
1114
group: plan-release # only the latest one of these should ever be running
1215
cancel-in-progress: true
1316

1417
jobs:
15-
check-plan:
16-
name: "Check Release Plan"
18+
should-run-release-plan-prepare:
19+
name: Should we run release-plan prepare?
1720
runs-on: ubuntu-latest
1821
outputs:
19-
command: ${{ steps.check-release.outputs.command }}
20-
22+
should-prepare: ${{ steps.should-prepare.outputs.should-prepare }}
2123
steps:
22-
- uses: actions/checkout@v4
24+
- uses: release-plan/actions/should-prepare-release@v1
2325
with:
24-
fetch-depth: 0
2526
ref: 'main'
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
27+
id: should-prepare
3028

31-
prepare_release_notes:
32-
name: Prepare Release Notes
29+
create-prepare-release-pr:
30+
name: Create Prepare Release PR
3331
runs-on: ubuntu-latest
3432
timeout-minutes: 5
35-
needs: check-plan
33+
needs: should-run-release-plan-prepare
3634
permissions:
3735
contents: write
36+
issues: read
3837
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-
38+
if: needs.should-run-release-plan-prepare.outputs.should-prepare == 'true'
4539
steps:
46-
- uses: actions/checkout@v4
47-
# We need to download lots of history so that
48-
# github-changelog can discover what's changed since the last release
40+
- uses: release-plan/actions/prepare@v1
41+
name: Run release-plan prepare
4942
with:
50-
fetch-depth: 0
5143
ref: 'main'
52-
- uses: wyvox/action-setup-pnpm@v3
53-
- run: pnpm install --frozen-lockfile
54-
55-
- name: "Generate Explanation and Prep Changelogs"
56-
id: explanation
57-
run: |
58-
set +e
59-
60-
pnpm release-plan prepare 2> >(tee -a stderr.log >&2)
61-
62-
63-
if [ $? -ne 0 ]; then
64-
echo 'text<<EOF' >> $GITHUB_OUTPUT
65-
cat stderr.log >> $GITHUB_OUTPUT
66-
echo 'EOF' >> $GITHUB_OUTPUT
67-
else
68-
echo 'text<<EOF' >> $GITHUB_OUTPUT
69-
jq .description .release-plan.json -r >> $GITHUB_OUTPUT
70-
echo 'EOF' >> $GITHUB_OUTPUT
71-
fi
7244
env:
7345
GITHUB_AUTH: ${{ secrets.GITHUB_TOKEN }}
46+
id: explanation
7447

75-
- uses: peter-evans/create-pull-request@v6
48+
- uses: peter-evans/create-pull-request@v7
49+
name: Create Prepare Release PR
7650
with:
77-
commit-message: "Prepare Release using 'release-plan'"
51+
commit-message: "Prepare Release ${{ steps.explanation.outputs.new-version}} using 'release-plan'"
7852
labels: "internal"
53+
sign-commits: true
7954
branch: release-preview
80-
title: Prepare Release
55+
title: Prepare Release ${{ steps.explanation.outputs.new-version }}
8156
body: |
8257
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 👍
8358

.github/workflows/publish.yml

Lines changed: 16 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
# For every push to the main 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

@@ -9,48 +8,34 @@ on:
98
push:
109
branches:
1110
- main
11+
- master
12+
paths:
13+
- '.release-plan.json'
1214

1315
concurrency:
1416
group: publish-${{ github.head_ref || github.ref }}
1517
cancel-in-progress: true
1618

1719
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: 'main'
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-
3520
publish:
3621
name: "NPM Publish"
3722
runs-on: ubuntu-latest
38-
needs: check-plan
39-
if: needs.check-plan.outputs.command == 'release'
4023
permissions:
4124
contents: write
42-
pull-requests: write
25+
id-token: write
26+
attestations: write
4327

4428
steps:
45-
- uses: actions/checkout@v4
46-
- uses: wyvox/action-setup-pnpm@v3
29+
- uses: actions/checkout@v5
30+
- uses: pnpm/action-setup@v4
31+
- uses: actions/setup-node@v6
4732
with:
48-
# This creates an .npmrc that reads the NODE_AUTH_TOKEN environment variable
49-
node-registry-url: 'https://registry.npmjs.org'
33+
node-version: 22
34+
registry-url: 'https://registry.npmjs.org'
35+
cache: pnpm
5036
- run: pnpm install --frozen-lockfile
51-
- name: npm publish
52-
run: pnpm release-plan publish
53-
37+
- run: npm install -g npm@latest # ensure that the globally installed npm is new enough to support OIDC
38+
- name: Publish to NPM
39+
run: NPM_CONFIG_PROVENANCE=true pnpm release-plan publish
5440
env:
5541
GITHUB_AUTH: ${{ secrets.GITHUB_TOKEN }}
56-
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}

package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,7 @@
77
"url": "git+https://github.com/shipshapecode/shepherd.git"
88
},
99
"license": "AGPL-3.0",
10-
"authors": [
11-
"Robbie Wagner <[email protected]>",
12-
"Chuck Carpenter <[email protected]>"
13-
],
1410
"scripts": {
15-
"prepare": "pnpm -F shepherd.js build",
1611
"build": "pnpm -F shepherd.js build && pnpm -F '!shepherd.js' -F !landing -F !shepherd-docs build",
1712
"cypress:install": "pnpm -F 'cypress-tests' cypress:install",
1813
"dev": "pnpm watch",
@@ -22,6 +17,7 @@
2217
"lint:js": "pnpm -F '*' lint:js",
2318
"lint:prettier": "pnpm -F '*' lint:prettier",
2419
"lint:prettier:fix": "pnpm -F '*' lint:prettier:fix",
20+
"prepare": "pnpm -F shepherd.js build",
2521
"start": "pnpm watch",
2622
"test:ci": "pnpm build && pnpm -F '*' test:ci",
2723
"test:cy:watch": "pnpm -F cypress-tests test:watch",
@@ -53,5 +49,9 @@
5349
"packageManager": "[email protected]",
5450
"engines": {
5551
"node": "18.* || >= 20"
56-
}
52+
},
53+
"authors": [
54+
"Robbie Wagner <[email protected]>",
55+
"Chuck Carpenter <[email protected]>"
56+
]
5757
}

0 commit comments

Comments
 (0)