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