Skip to content

Commit 1e51fd4

Browse files
Merge pull request #138 from universal-ember/update-release-plan
Update release-plan
2 parents e0fe775 + 86012aa commit 1e51fd4

File tree

4 files changed

+338
-249
lines changed

4 files changed

+338
-249
lines changed

.github/workflows/plan-release.yml

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
name: Release Plan Review
1+
name: Plan Release
22
on:
3+
workflow_dispatch:
34
push:
45
branches:
56
- main
@@ -14,36 +15,34 @@ concurrency:
1415
cancel-in-progress: true
1516

1617
jobs:
17-
check-plan:
18-
name: "Check Release Plan"
18+
is-this-a-release:
19+
name: "Is this a release?"
1920
runs-on: ubuntu-latest
2021
outputs:
2122
command: ${{ steps.check-release.outputs.command }}
2223

2324
steps:
2425
- uses: actions/checkout@v4
2526
with:
26-
fetch-depth: 0
27+
fetch-depth: 2
2728
ref: 'main'
28-
# 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`
2930
# when the .release-plan.json file was changed on the last commit.
3031
- id: check-release
3132
run: if git diff --name-only HEAD HEAD~1 | grep -w -q ".release-plan.json"; then echo "command=release"; fi >> $GITHUB_OUTPUT
3233

33-
prepare-release-notes:
34-
name: Prepare Release Notes
34+
create-prepare-release-pr:
35+
name: Create Prepare Release PR
3536
runs-on: ubuntu-latest
3637
timeout-minutes: 5
37-
needs: check-plan
38+
needs: is-this-a-release
3839
permissions:
3940
contents: write
4041
issues: read
4142
pull-requests: write
42-
outputs:
43-
explanation: ${{ steps.explanation.outputs.text }}
44-
# only run on push event if plan wasn't updated (don't create a release plan when we're releasing)
43+
# only run on push event or workflow dispatch if plan wasn't updated (don't create a release plan when we're releasing)
4544
# only run on labeled event if the PR has already been merged
46-
if: (github.event_name == 'push' && needs.check-plan.outputs.command != 'release') || (github.event_name == 'pull_request_target' && 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)
4746

4847
steps:
4948
- uses: actions/checkout@v4
@@ -55,6 +54,7 @@ jobs:
5554
- uses: pnpm/action-setup@v4
5655
- uses: actions/setup-node@v4
5756
with:
57+
node-version: 18
5858
cache: pnpm
5959
- run: pnpm install --frozen-lockfile
6060
- name: "Generate Explanation and Prep Changelogs"
@@ -64,24 +64,28 @@ jobs:
6464
pnpm release-plan prepare 2> >(tee -a release-plan-stderr.txt >&2)
6565
6666
if [ $? -ne 0 ]; then
67-
echo 'text<<EOF' >> $GITHUB_OUTPUT
68-
cat release-plan-stderr.txt >> $GITHUB_OUTPUT
69-
echo 'EOF' >> $GITHUB_OUTPUT
67+
release_plan_output=$(cat release-plan-stderr.txt)
7068
else
71-
echo 'text<<EOF' >> $GITHUB_OUTPUT
72-
jq .description .release-plan.json -r >> $GITHUB_OUTPUT
73-
echo 'EOF' >> $GITHUB_OUTPUT
69+
release_plan_output=$(jq .description .release-plan.json -r)
7470
rm release-plan-stderr.txt
71+
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
7576
fi
77+
echo 'text<<EOF' >> $GITHUB_OUTPUT
78+
echo "$release_plan_output" >> $GITHUB_OUTPUT
79+
echo 'EOF' >> $GITHUB_OUTPUT
7680
env:
7781
GITHUB_AUTH: ${{ secrets.GITHUB_TOKEN }}
7882

7983
- uses: peter-evans/create-pull-request@v7
8084
with:
81-
commit-message: "Prepare Release using 'release-plan'"
85+
commit-message: "Prepare Release ${{ steps.explanation.outputs.new_version}} using 'release-plan'"
8286
labels: "internal"
8387
branch: release-preview
84-
title: Prepare Release
88+
title: Prepare Release ${{ steps.explanation.outputs.new_version }}
8589
body: |
8690
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 👍
8791

.github/workflows/publish.yml

Lines changed: 6 additions & 23 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,34 +9,17 @@ 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'
4123
permissions:
4224
contents: write
4325
pull-requests: write
@@ -49,11 +31,12 @@ jobs:
4931
- uses: pnpm/action-setup@v4
5032
- uses: actions/setup-node@v4
5133
with:
34+
node-version: 18
5235
# This creates an .npmrc that reads the NODE_AUTH_TOKEN environment variable
5336
registry-url: 'https://registry.npmjs.org'
5437
cache: pnpm
5538
- run: pnpm install --frozen-lockfile
56-
- name: npm publish
39+
- name: Publish to NPM
5740
run: NPM_CONFIG_PROVENANCE=true pnpm release-plan publish
5841
env:
5942
GITHUB_AUTH: ${{ secrets.GITHUB_TOKEN }}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"concurrently": "^9.0.1",
2222
"prettier": "^3.0.3",
2323
"prettier-plugin-ember-template-tag": "^2.0.0",
24-
"release-plan": "^0.11.0"
24+
"release-plan": "^0.16.0"
2525
},
2626
"packageManager": "[email protected]",
2727
"engines": {

0 commit comments

Comments
 (0)