Bump version → 1.0.0 #18
Workflow file for this run
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: release | |
on: | |
push: | |
branches: | |
- 'release/*' | |
jobs: | |
check: | |
outputs: | |
status: ${{ steps.current_pr.outputs.pr_found }} | |
runs-on: ubuntu-latest | |
permissions: | |
pull-requests: read | |
steps: | |
- name: Get current PR | |
uses: 8BitJonny/[email protected] | |
id: current_pr | |
release: | |
needs: check | |
if: needs.check.outputs.status == 'false' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout the repo | |
uses: actions/checkout@v4 | |
- name: Extract version from branch name | |
run: | | |
BRANCH_NAME="${{ github.event.push.ref }}" | |
VERSION=${GITHUB_REF##*/} | |
echo "RELEASE_VERSION=$VERSION" >> $GITHUB_ENV | |
- name: Get current date | |
run: | | |
echo "CURRENT_DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV | |
- name: Build changelog | |
id: build_changelog | |
uses: mikepenz/release-changelog-builder-action@v4 | |
with: | |
configurationJson: | | |
{ | |
"categories": [ | |
{ | |
"title": "### Features", | |
"labels": ["type: feature"] | |
}, | |
{ | |
"title": "### Bug fixes", | |
"labels": ["type: bug"] | |
}, | |
{ | |
"title": "### Tests", | |
"labels": ["type: test"] | |
}, | |
{ | |
"title": "### Documentation", | |
"labels": ["type: docs"] | |
}, | |
{ | |
"title": "### Admin", | |
"labels": ["type: admin"] | |
} | |
], | |
"template": "# [${{ env.RELEASE_VERSION }}](https://github.com/${{ github.repository }}/releases/tag/${{ env.RELEASE_VERSION }}) - ${{ env.CURRENT_DATE }}\n\n> Compare with [#{{FROM_TAG}}](https://github.com/${{ github.repository }}/compare/#{{FROM_TAG}}...${{ env.RELEASE_VERSION }})\n\n#{{CHANGELOG}}", | |
"pr_template": "- #{{TITLE}} by [@#{{AUTHOR}}](https://github.com/#{{AUTHOR}}) in [##{{NUMBER}}](#{{URL}})" | |
} | |
toTag: ${{ github.sha }} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Update changelog | |
run: | | |
printf "%s%s\n" "${{ steps.build_changelog.outputs.changelog }}" "$(cat CHANGELOG.md)" > CHANGELOG.md | |
- uses: EndBug/add-and-commit@v9 | |
with: | |
add: "CHANGELOG.md" | |
message: "Update CHANGELOG.md for ${{ env.RELEASE_VERSION }}" | |
push: 'origin ${{ github.event.push.ref }}' | |
- name: Create pull request | |
uses: repo-sync/pull-request@v2 | |
with: | |
destination_branch: ${{ github.event.repository.default_branch }} | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
pr_title: "Release ${{ env.RELEASE_VERSION }}" |