Create Release PR #3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Adapted from https://github.com/DisnakeDev/disnake/blob/master/.github/workflows/create-release-pr.yaml | |
| name: Create Release PR | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: "The new version number, e.g. `1.2.3`." | |
| type: string | |
| required: true | |
| permissions: {} | |
| jobs: | |
| create-release-pr: | |
| name: Create Release PR | |
| runs-on: ubuntu-latest | |
| env: | |
| VERSION_INPUT: ${{ inputs.version }} | |
| steps: | |
| # https://docs.github.com/en/apps/creating-github-apps/authenticating-with-a-github-app/making-authenticated-api-requests-with-a-github-app-in-a-github-actions-workflow | |
| - name: Generate app token | |
| id: generate_token | |
| uses: actions/create-github-app-token@f2acddfb5195534d487896a656232b016a682f3c # v1.9.0 | |
| with: | |
| app-id: ${{ secrets.BOT_APP_ID }} | |
| private-key: ${{ secrets.BOT_PRIVATE_KEY }} | |
| - uses: actions/checkout@v4 | |
| with: | |
| token: ${{ steps.generate_token.outputs.token }} | |
| persist-credentials: false | |
| - name: Set git name/email | |
| env: | |
| GIT_USER: ${{ vars.GIT_APP_USER_NAME }} | |
| GIT_EMAIL: ${{ vars.GIT_APP_USER_EMAIL }} | |
| run: | | |
| git config user.name "$GIT_USER" | |
| git config user.email "$GIT_EMAIL" | |
| - name: Bootstrap disnake-compass | |
| uses: ./.github/actions/bootstrap | |
| with: | |
| python-version: '3.10' | |
| - name: Update version | |
| run: | | |
| poetry run python scripts/versiontool.py --set "$VERSION_INPUT" | |
| git commit -a -m "chore: update version to $VERSION_INPUT" | |
| - name: Build changelog | |
| run: | | |
| poetry run towncrier build --yes --version "$VERSION_INPUT" | |
| git commit -a -m "docs: build changelog" | |
| - name: Create pull request | |
| uses: peter-evans/create-pull-request@70a41aba780001da0a30141984ae2a0c95d8704e # v6.0.2 | |
| with: | |
| token: ${{ steps.generate_token.outputs.token }} | |
| branch: auto/release-v${{ inputs.version }} | |
| delete-branch: true | |
| title: "chore(release): v${{ inputs.version }}" | |
| body: | | |
| Automated release PR, triggered by @${{ github.actor }} for ${{ github.sha }}. | |
| ### Tasks | |
| - [ ] Add changelogs from backports, if applicable. | |
| - [ ] Once merged, create + push a tag. | |
| <sub>https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}</sub> | |
| labels: | | |
| t: release | |
| assignees: | | |
| ${{ github.actor }} |