1 | name: Release Plan Review
|
2 | on:
|
3 | push:
|
4 | branches:
|
5 | - main
|
6 | - master
|
7 | pull_request:
|
8 | types:
|
9 | - labeled
|
10 |
|
11 | concurrency:
|
12 | group: plan-release
|
13 | cancel-in-progress: true
|
14 |
|
15 | jobs:
|
16 | check-plan:
|
17 | name: "Check Release Plan"
|
18 | runs-on: ubuntu-latest
|
19 | outputs:
|
20 | command: ${{ steps.check-release.outputs.command }}
|
21 |
|
22 | steps:
|
23 | - uses: actions/checkout@v4
|
24 | with:
|
25 | fetch-depth: 0
|
26 | ref: 'master'
|
27 |
|
28 |
|
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
|
31 |
|
32 | prepare_release_notes:
|
33 | name: Prepare Release Notes
|
34 | runs-on: ubuntu-latest
|
35 | timeout-minutes: 5
|
36 | needs: check-plan
|
37 | permissions:
|
38 | contents: write
|
39 | pull-requests: write
|
40 | outputs:
|
41 | explanation: ${{ steps.explanation.outputs.text }}
|
42 |
|
43 |
|
44 | if: (github.event_name == 'push' && needs.check-plan.outputs.command != 'release') || (github.event_name == 'pull_request' && github.event.pull_request.merged == true)
|
45 |
|
46 | steps:
|
47 | - uses: actions/checkout@v4
|
48 |
|
49 |
|
50 | with:
|
51 | fetch-depth: 0
|
52 | - uses: actions/setup-node@v4
|
53 | with:
|
54 | node-version: 18
|
55 |
|
56 | - run: npm ci
|
57 |
|
58 | - name: "Generate Explanation and Prep Changelogs"
|
59 | id: explanation
|
60 | run: |
|
61 | set -x
|
62 |
|
63 | npx release-plan prepare
|
64 |
|
65 | echo 'text<<EOF' >> $GITHUB_OUTPUT
|
66 | jq .description .release-plan.json -r >> $GITHUB_OUTPUT
|
67 | echo 'EOF' >> $GITHUB_OUTPUT
|
68 | env:
|
69 | GITHUB_AUTH: ${{ secrets.GITHUB_TOKEN }}
|
70 |
|
71 | - uses: peter-evans/create-pull-request@v6
|
72 | with:
|
73 | commit-message: "Prepare Release using 'release-plan'"
|
74 | labels: "internal"
|
75 | branch: release-preview
|
76 | title: Prepare Release
|
77 | body: |
|
78 | 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 👍
|
79 |
|
80 | -----------------------------------------
|
81 |
|
82 | ${{ steps.explanation.outputs.text }}
|
83 |
|
\ | No newline at end of file |