44 push :
55 branches :
66 - main
7+ - master
78 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/
89 types :
910 - labeled
@@ -14,77 +15,44 @@ concurrency:
1415 cancel-in-progress : true
1516
1617jobs :
17- is-this-a- release :
18- name : " Is this a release? "
18+ should-run- release-plan-prepare :
19+ name : Should we run release-plan prepare?
1920 runs-on : ubuntu-latest
2021 outputs :
21- command : ${{ steps.check-release.outputs.command }}
22-
22+ should-prepare : ${{ steps.should-prepare.outputs.should-prepare }}
2323 steps :
24- - uses : actions/checkout@v4
24+ - uses : release-plan/ actions/should-prepare-release@v1
2525 with :
26- fetch-depth : 2
2726 ref : ' main'
28- # This will only cause the `is-this-a-release` job to have a "command" of `release`
29- # when the .release-plan.json file was changed on the last commit.
30- - id : check-release
31- 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
3228
3329 create-prepare-release-pr :
3430 name : Create Prepare Release PR
3531 runs-on : ubuntu-latest
3632 timeout-minutes : 5
37- needs : is-this-a- release
33+ needs : should-run- release-plan-prepare
3834 permissions :
3935 contents : write
4036 issues : read
4137 pull-requests : write
42- # only run on push event or workflow dispatch if plan wasn't updated (don't create a release plan when we're releasing)
43- # only run on labeled event if the PR has already been merged
44- 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)
45-
38+ if : needs.should-run-release-plan-prepare.outputs.should-prepare == 'true'
4639 steps :
47- - uses : actions/checkout@v4
48- # We need to download lots of history so that
49- # github-changelog can discover what's changed since the last release
40+ - uses : release-plan/actions/prepare@v1
41+ name : Run release-plan prepare
5042 with :
51- fetch-depth : 0
5243 ref : ' main'
53- - uses : pnpm/action-setup@v4
54- - uses : actions/setup-node@v4
55- with :
56- node-version : 18
57- cache : pnpm
58- - run : pnpm install --frozen-lockfile
59- - name : " Generate Explanation and Prep Changelogs"
60- id : explanation
61- run : |
62- set +e
63- pnpm release-plan prepare 2> >(tee -a release-plan-stderr.txt >&2)
64-
65- if [ $? -ne 0 ]; then
66- release_plan_output=$(cat release-plan-stderr.txt)
67- else
68- release_plan_output=$(jq .description .release-plan.json -r)
69- rm release-plan-stderr.txt
70-
71- if [ $(jq '.solution | length' .release-plan.json) -eq 1 ]; then
72- new_version=$(jq -r '.solution[].newVersion' .release-plan.json)
73- echo "new_version=v$new_version" >> $GITHUB_OUTPUT
74- fi
75- fi
76- echo 'text<<EOF' >> $GITHUB_OUTPUT
77- echo "$release_plan_output" >> $GITHUB_OUTPUT
78- echo 'EOF' >> $GITHUB_OUTPUT
7944 env :
8045 GITHUB_AUTH : ${{ secrets.GITHUB_TOKEN }}
46+ id : explanation
8147
82- - uses : peter-evans/create-pull-request@v7
48+ - uses : peter-evans/create-pull-request@v8
49+ name : Create Prepare Release PR
8350 with :
84- commit-message : " Prepare Release ${{ steps.explanation.outputs.new_version }} using 'release-plan'"
51+ commit-message : " Prepare Release ${{ steps.explanation.outputs.new-version }} using 'release-plan'"
8552 labels : " internal"
53+ sign-commits : true
8654 branch : release-preview
87- title : Prepare Release ${{ steps.explanation.outputs.new_version }}
55+ title : Prepare Release ${{ steps.explanation.outputs.new-version }}
8856 body : |
8957 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 👍
9058
0 commit comments