1- name : Release Plan Review
1+ name : Plan Release
22on :
3+ workflow_dispatch :
34 push :
45 branches :
56 - main
@@ -14,35 +15,34 @@ concurrency:
1415 cancel-in-progress : true
1516
1617jobs :
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 : ' master'
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
41+ issues : read
4042 pull-requests : write
41- outputs :
42- explanation : ${{ steps.explanation.outputs.text }}
43- # 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)
4444 # only run on labeled event if the PR has already been merged
45- 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)
4646
4747 steps :
4848 - uses : actions/checkout@v4
@@ -51,10 +51,11 @@ jobs:
5151 with :
5252 fetch-depth : 0
5353 ref : ' master'
54+ - uses : pnpm/action-setup@v4
5455 - uses : actions/setup-node@v4
5556 with :
5657 node-version : 18
57- - uses : pnpm/action-setup@v4
58+ cache : pnpm
5859 - run : pnpm install --frozen-lockfile
5960 - name : " Generate Explanation and Prep Changelogs"
6061 id : explanation
@@ -63,24 +64,28 @@ jobs:
6364 pnpm release-plan prepare 2> >(tee -a release-plan-stderr.txt >&2)
6465
6566 if [ $? -ne 0 ]; then
66- echo 'text<<EOF' >> $GITHUB_OUTPUT
67- cat release-plan-stderr.txt >> $GITHUB_OUTPUT
68- echo 'EOF' >> $GITHUB_OUTPUT
67+ release_plan_output=$(cat release-plan-stderr.txt)
6968 else
70- echo 'text<<EOF' >> $GITHUB_OUTPUT
71- jq .description .release-plan.json -r >> $GITHUB_OUTPUT
72- echo 'EOF' >> $GITHUB_OUTPUT
69+ release_plan_output=$(jq .description .release-plan.json -r)
7370 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
7476 fi
77+ echo 'text<<EOF' >> $GITHUB_OUTPUT
78+ echo "$release_plan_output" >> $GITHUB_OUTPUT
79+ echo 'EOF' >> $GITHUB_OUTPUT
7580 env :
7681 GITHUB_AUTH : ${{ secrets.GITHUB_TOKEN }}
7782
78- - uses : peter-evans/create-pull-request@v6
83+ - uses : peter-evans/create-pull-request@v7
7984 with :
80- commit-message : " Prepare Release using 'release-plan'"
85+ commit-message : " Prepare Release ${{ steps.explanation.outputs.new_version}} using 'release-plan'"
8186 labels : " internal"
8287 branch : release-preview
83- title : Prepare Release
88+ title : Prepare Release ${{ steps.explanation.outputs.new_version }}
8489 body : |
8590 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 👍
8691
0 commit comments