Create release pull request #11
This file contains 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 pull request | |
on: | |
workflow_dispatch: | |
jobs: | |
create-release-pull-request: | |
runs-on: ubuntu-24.04 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: main | |
persist-credentials: false | |
# This is needed to get all changes from develop in the PR | |
# It won't work if we checkout from develop, see https://github.com/peter-evans/create-pull-request/issues/2841 | |
# See https://github.com/peter-evans/create-pull-request/blob/main/docs/examples.md#keep-a-branch-up-to-date-with-another | |
- name: Fetch develop branch | |
run: | | |
git fetch origin develop:develop | |
git reset --hard develop | |
- name: Create release draft | |
uses: release-drafter/release-drafter@v6 | |
id: release-drafter | |
with: | |
# release-drafter should be based on develop to get the correct content as pull requests are merged into develop | |
# Note that the target commitish of the release should be updated to refs/heads/main when published | |
# (Otherwise the tag will point to the last commit on develop branch instead of the last commit of main branch) | |
commitish: refs/heads/develop | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Update CHANGELOG.md | |
uses: stefanzweifel/changelog-updater-action@v1 | |
with: | |
latest-version: ${{ steps.release-drafter.outputs.tag_name }} | |
release-notes: ${{ steps.release-drafter.outputs.body }} | |
- name: Update files with release version | |
run: | | |
./scripts/update-files-with-release-version.sh ${{ steps.release-drafter.outputs.tag_name }} | |
# If using default Github token, the created pull request won't trigger workflows with pull_request event | |
# See https://github.com/peter-evans/create-pull-request/blob/main/docs/concepts-guidelines.md#triggering-further-workflow-runs | |
- name: Generate Github token to create PR | |
uses: actions/create-github-app-token@v1 | |
id: github-token | |
with: | |
app-id: ${{ secrets.ALMA_CREATE_TEAM_PRS_APP_ID }} | |
private-key: ${{ secrets.ALMA_CREATE_TEAM_PRS_APP_PEM }} | |
repositories: alma-php-client | |
- name: Create Pull Request | |
uses: peter-evans/create-pull-request@v7 | |
with: | |
token: ${{ steps.github-token.outputs.token }} | |
commit-message: 'chore: update version' | |
title: Release ${{ steps.release-drafter.outputs.tag_name }} | |
body: | | |
Update version to ${{ steps.release-drafter.outputs.tag_name }} | |
### Checklist of actions to be done before merging | |
- [ ] Review and update the CHANGELOG.md if needed | |
- [ ] Review and update the Github release draft if needed | |
- [ ] Review the files updated with the new version number in the commit named "chore: update version" | |
branch: release/${{ steps.release-drafter.outputs.tag_name }} | |
base: main | |
labels: release |