Create Release PR and draft Github release. #86
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
| name: "Create Release PR and draft Github release." | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: New release version (e.g. 0.46.0) | |
| type: string | |
| required: true | |
| target_branch: | |
| description: Target branch to create a release/PR to | |
| type: string | |
| required: true | |
| default: master | |
| jobs: | |
| create-release-pr: | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| token: "${{ secrets.RENKUBOT_GITHUB_TOKEN }}" | |
| ref: '${{ github.event.inputs.target_branch}}' | |
| - name: Setup Git | |
| run: | | |
| git config --global --add user.name "Renku Bot" | |
| git config --global --add user.email "renku@datascience.ch" | |
| git config push.autoSetupRemote true | |
| - name: Create Branch | |
| run: git checkout -b "release-${{ github.event.inputs.version }}" | |
| - name: Commit changes | |
| run: | | |
| git add CHANGELOG.rst | |
| git commit -m "chore: create release ${{ github.event.inputs.version }}" --allow-empty | |
| git push | |
| - name: Create Pull Request | |
| uses: actions/github-script@v7 | |
| with: | |
| github-token: ${{ secrets.RENKUBOT_GITHUB_TOKEN }} | |
| script: | | |
| const { repo, owner } = context.repo; | |
| const result = await github.rest.pulls.create({ | |
| title: 'release ${{ github.event.inputs.version }}', | |
| owner, | |
| repo, | |
| head: 'release-${{ github.event.inputs.version }}', | |
| base: '${{ github.event.inputs.target_branch }}', | |
| draft: true, | |
| body: [ | |
| 'Release ${{ github.event.inputs.version }}', | |
| '', | |
| 'This PR is auto-generated by [actions/github-script](https://github.com/actions/github-script).', | |
| '', | |
| '/deploy #slow ', | |
| ].join('\n') | |
| }); | |
| github.rest.issues.addLabels({ | |
| owner, | |
| repo, | |
| issue_number: result.data.number, | |
| labels: ['release'] | |
| }); | |
| - uses: release-drafter/release-drafter@v6 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tag: "${{ github.event.inputs.version }}" | |
| name: "${{ github.event.inputs.version }}" | |
| version: "${{ github.event.inputs.version }}" | |
| disable-autolabeler: true | |
| disable-releaser: true |