Ankush Menat | 0340bfc | 2023-07-12 12:17:20 +0530 | [diff] [blame] | 1 | # This action: |
| 2 | # |
| 3 | # 1. Generates release notes using github API. |
| 4 | # 2. Strips unnecessary info like chore/style etc from notes. |
| 5 | # 3. Updates release info. |
| 6 | |
| 7 | # This action needs to be maintained on all branches that do releases. |
| 8 | |
| 9 | name: 'Release Notes' |
| 10 | |
| 11 | on: |
| 12 | workflow_dispatch: |
| 13 | inputs: |
| 14 | tag_name: |
| 15 | description: 'Tag of release like v13.0.0' |
| 16 | required: true |
| 17 | type: string |
| 18 | release: |
| 19 | types: [released] |
| 20 | |
| 21 | permissions: |
| 22 | contents: read |
| 23 | |
| 24 | jobs: |
| 25 | regen-notes: |
| 26 | name: 'Regenerate release notes' |
| 27 | runs-on: ubuntu-latest |
| 28 | |
| 29 | steps: |
| 30 | - name: Update notes |
| 31 | run: | |
Ankush Menat | b5f6a1c | 2023-07-13 21:03:46 +0530 | [diff] [blame] | 32 | NEW_NOTES=$(gh api --method POST -H "Accept: application/vnd.github+json" /repos/frappe/erpnext/releases/generate-notes -f tag_name=$RELEASE_TAG | jq -r '.body' | sed -E '/^\* (chore|ci|test|docs|style)/d' ) |
| 33 | RELEASE_ID=$(gh api -H "Accept: application/vnd.github+json" /repos/frappe/erpnext/releases/tags/$RELEASE_TAG | jq -r '.id') |
| 34 | gh api --method PATCH -H "Accept: application/vnd.github+json" /repos/frappe/erpnext/releases/$RELEASE_ID -f body="$NEW_NOTES" |
Ankush Menat | 0340bfc | 2023-07-12 12:17:20 +0530 | [diff] [blame] | 35 | |
| 36 | env: |
| 37 | GH_TOKEN: ${{ secrets.RELEASE_TOKEN }} |
| 38 | RELEASE_TAG: ${{ github.event.inputs.tag_name || github.event.release.tag_name }} |