1
- name : Release Plan Review
1
+ name : Plan Release
2
2
on :
3
+ workflow_dispatch :
3
4
push :
4
5
branches :
5
6
- main
@@ -14,36 +15,34 @@ concurrency:
14
15
cancel-in-progress : true
15
16
16
17
jobs :
17
- check-plan :
18
- name : " Check Release Plan "
18
+ is-this-a-release :
19
+ name : " Is this a release? "
19
20
runs-on : ubuntu-latest
20
21
outputs :
21
22
command : ${{ steps.check-release.outputs.command }}
22
23
23
24
steps :
24
25
- uses : actions/checkout@v4
25
26
with :
26
- fetch-depth : 0
27
+ fetch-depth : 2
27
28
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`
29
30
# when the .release-plan.json file was changed on the last commit.
30
31
- id : check-release
31
32
run : if git diff --name-only HEAD HEAD~1 | grep -w -q ".release-plan.json"; then echo "command=release"; fi >> $GITHUB_OUTPUT
32
33
33
- prepare-release-notes :
34
- name : Prepare Release Notes
34
+ create- prepare-release-pr :
35
+ name : Create Prepare Release PR
35
36
runs-on : ubuntu-latest
36
37
timeout-minutes : 5
37
- needs : check-plan
38
+ needs : is-this-a-release
38
39
permissions :
39
40
contents : write
40
41
issues : read
41
42
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)
45
44
# 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)
47
46
48
47
steps :
49
48
- uses : actions/checkout@v4
55
54
- uses : pnpm/action-setup@v4
56
55
- uses : actions/setup-node@v4
57
56
with :
57
+ node-version : 18
58
58
cache : pnpm
59
59
- run : pnpm install --frozen-lockfile
60
60
- name : " Generate Explanation and Prep Changelogs"
@@ -64,24 +64,28 @@ jobs:
64
64
pnpm release-plan prepare 2> >(tee -a release-plan-stderr.txt >&2)
65
65
66
66
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)
70
68
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)
74
70
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
75
76
fi
77
+ echo 'text<<EOF' >> $GITHUB_OUTPUT
78
+ echo "$release_plan_output" >> $GITHUB_OUTPUT
79
+ echo 'EOF' >> $GITHUB_OUTPUT
76
80
env :
77
81
GITHUB_AUTH : ${{ secrets.GITHUB_TOKEN }}
78
82
79
83
- uses : peter-evans/create-pull-request@v7
80
84
with :
81
- commit-message : " Prepare Release using 'release-plan'"
85
+ commit-message : " Prepare Release ${{ steps.explanation.outputs.new_version}} using 'release-plan'"
82
86
labels : " internal"
83
87
branch : release-preview
84
- title : Prepare Release
88
+ title : Prepare Release ${{ steps.explanation.outputs.new_version }}
85
89
body : |
86
90
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 👍
87
91
0 commit comments