|
1 | | -name: Release Plan Review |
| 1 | +name: Plan Release |
2 | 2 | on: |
| 3 | + workflow_dispatch: |
3 | 4 | push: |
4 | 5 | branches: |
5 | 6 | - main |
6 | 7 | - master |
7 | | - pull_request: |
| 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/ |
8 | 9 | types: |
9 | 10 | - labeled |
| 11 | + - unlabeled |
10 | 12 |
|
11 | 13 | concurrency: |
12 | 14 | group: plan-release # only the latest one of these should ever be running |
13 | 15 | cancel-in-progress: true |
14 | 16 |
|
15 | 17 | jobs: |
16 | | - check-plan: |
17 | | - name: "Check Release Plan" |
| 18 | + should-run-release-plan-prepare: |
| 19 | + name: Should we run release-plan prepare? |
18 | 20 | runs-on: ubuntu-latest |
19 | 21 | outputs: |
20 | | - command: ${{ steps.check-release.outputs.command }} |
21 | | - |
| 22 | + should-prepare: ${{ steps.should-prepare.outputs.should-prepare }} |
22 | 23 | steps: |
23 | | - - uses: actions/checkout@v4 |
| 24 | + - uses: release-plan/actions/should-prepare-release@v1 |
24 | 25 | with: |
25 | | - fetch-depth: 0 |
26 | 26 | ref: 'master' |
27 | | - # This will only cause the `check-plan` job to have a "command" of `release` |
28 | | - # when the .release-plan.json file was changed on the last commit. |
29 | | - - id: check-release |
30 | | - 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 |
31 | 28 |
|
32 | | - prepare_release_notes: |
33 | | - name: Prepare Release Notes |
| 29 | + create-prepare-release-pr: |
| 30 | + name: Create Prepare Release PR |
34 | 31 | runs-on: ubuntu-latest |
35 | 32 | timeout-minutes: 5 |
36 | | - needs: check-plan |
| 33 | + needs: should-run-release-plan-prepare |
37 | 34 | permissions: |
38 | 35 | contents: write |
| 36 | + issues: read |
39 | 37 | pull-requests: write |
40 | | - outputs: |
41 | | - explanation: ${{ steps.explanation.outputs.text }} |
42 | | - # only run on push event 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' && needs.check-plan.outputs.command != 'release') || (github.event_name == 'pull_request' && github.event.pull_request.merged == true) |
45 | | - |
| 38 | + if: needs.should-run-release-plan-prepare.outputs.should-prepare == 'true' |
46 | 39 | 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 |
50 | 42 | with: |
51 | | - fetch-depth: 0 |
52 | 43 | ref: 'master' |
53 | | - - uses: actions/setup-node@v4 |
54 | | - with: |
55 | | - node-version: 18 |
56 | | - |
57 | | - - uses: pnpm/action-setup@v3 |
58 | | - with: |
59 | | - version: 8 |
60 | | - - run: pnpm install --frozen-lockfile |
61 | | - |
62 | | - - name: "Generate Explanation and Prep Changelogs" |
63 | | - id: explanation |
64 | | - run: | |
65 | | - set +e |
66 | | - |
67 | | - pnpm release-plan prepare 2> >(tee -a stderr.log >&2) |
68 | | - |
69 | | -
|
70 | | - if [ $? -ne 0 ]; then |
71 | | - echo 'text<<EOF' >> $GITHUB_OUTPUT |
72 | | - cat stderr.log >> $GITHUB_OUTPUT |
73 | | - echo 'EOF' >> $GITHUB_OUTPUT |
74 | | - else |
75 | | - echo 'text<<EOF' >> $GITHUB_OUTPUT |
76 | | - jq .description .release-plan.json -r >> $GITHUB_OUTPUT |
77 | | - echo 'EOF' >> $GITHUB_OUTPUT |
78 | | - fi |
79 | 44 | env: |
80 | 45 | GITHUB_AUTH: ${{ secrets.GITHUB_TOKEN }} |
| 46 | + id: explanation |
81 | 47 |
|
82 | | - - uses: peter-evans/create-pull-request@v6 |
| 48 | + - uses: peter-evans/create-pull-request@v8 |
| 49 | + name: Create Prepare Release PR |
83 | 50 | with: |
84 | | - commit-message: "Prepare Release using 'release-plan'" |
| 51 | + commit-message: "Prepare Release ${{ steps.explanation.outputs.new-version}} using 'release-plan'" |
85 | 52 | labels: "internal" |
| 53 | + sign-commits: true |
86 | 54 | branch: release-preview |
87 | | - title: Prepare Release |
| 55 | + title: Prepare Release ${{ steps.explanation.outputs.new-version }} |
88 | 56 | body: | |
89 | 57 | 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 👍 |
90 | 58 |
|
|
0 commit comments