ci: handle pushing tags to the repo #6
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 PR | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
version-bump: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
pull-requests: write | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Configure Git | |
run: | | |
git config --global user.name 'GitHub Actions' | |
git config --global user.email '[email protected]' | |
- name: Check Commit Message | |
id: check_commit | |
run: | | |
commit_message=$(git log -1 --pretty=%B) | |
if [[ "$commit_message" == "chore(release):"* ]]; then | |
echo "is_release=true" >> $GITHUB_OUTPUT | |
else | |
echo "is_release=false" >> $GITHUB_OUTPUT | |
fi | |
- uses: oven-sh/setup-bun@v2 | |
- name: generate changelog and bump version | |
if: steps.check_commit.outputs.is_release == 'false' | |
run: bunx standard-version | |
- name: Create Pull Request | |
if: steps.check_commit.outputs.is_release == 'false' | |
uses: peter-evans/create-pull-request@v6 | |
with: | |
commit-message: "chore(release): bump version" | |
title: "Bump Version" | |
body: "Automated version bump using standard-version" | |
branch: version-bump | |
delete-branch: true | |
base: main | |
- name: tag current package version and push | |
if: steps.check_commit.outputs.is_release == 'true' | |
run: | | |
git tag v$(npm pkg get version) | |
git push --tags |