-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #122 from n-thumann/refactor_bump-version_action
Refactor bump-version GitHub action
- Loading branch information
Showing
1 changed file
with
24 additions
and
5 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 }}." | ||
}) |