Skip to content

Commit

Permalink
Merge pull request #122 from n-thumann/refactor_bump-version_action
Browse files Browse the repository at this point in the history
Refactor bump-version GitHub action
  • Loading branch information
n-thumann authored Dec 21, 2021
2 parents 594e59a + 6d4e018 commit 814fa00
Showing 1 changed file with 24 additions and 5 deletions.
29 changes: 24 additions & 5 deletions .github/workflows/bump-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,30 @@ jobs:

- name: Setup Git
run: |
git config user.name "Nicolas Thumann"
git config user.email "[email protected]"
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
- name: Bump version
run: npm version ${{ github.event.inputs.version }}
run: >
echo "BUMPED_VERSION=$(
npm version --commit-hooks false --git-tag-version false patch
)" | tee -a $GITHUB_ENV
- name: Push latest version
run: git push origin main --follow-tags
- name: Checkout and push branch
run: |
git checkout -b bump_version_${{ env.BUMPED_VERSION }}
git push origin bump_version_${{ env.BUMPED_VERSION }}
- name: Create PR
uses: actions/github-script@v5
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
github.rest.pulls.create({
owner: context.repo.owner,
repo: context.repo.repo,
title: "Bump version to ${{ env.BUMPED_VERSION }}"
head: bump_version_${{ env.BUMPED_VERSION }},
base: "main",
body: "This PR bumps the version to ${{ env.bumped_tag }}, as requested by @${{ github.actor }} in https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}."
})

0 comments on commit 814fa00

Please sign in to comment.