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