Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add auto-bump.yml #20

Merged
merged 1 commit into from
May 20, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions .github/workflows/auto-bump.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: auto bump version
on:
workflow_dispatch:
inputs:
newversion:
description: 'npm version [<newversion> | major | minor | patch | premajor | preminor | prepatch | prerelease | from-git]'
required: true
preid:
description: 'The "prerelease identifier" to use as a prefix for the "prerelease" part of a semver.'
required: false

permissions:
pull-requests: write
contents: write

jobs:
bump:
name: Bump
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Setup Git
run: |
git config user.name '${{ secrets.GIT_USER_NAME }}'
git config user.email '${{ secrets.GIT_USER_EMAIL }}'

- name: Bump version
run: |
npm version ${{ inputs.newversion }} --preid ${{ inputs.preid }} --git-tag-version false
- name: Commit
run: "git commit -am 'Bump version to $(jq -r .version < package.json)'"

- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
id: cpr
- name: Check outputs
if: ${{ steps.cpr.outputs.pull-request-number }}
run: |
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"

- name: Approve a PR
run: gh pr review --approve "${{ steps.cpr.outputs.pull-request-url }}"
- name: Enable auto-merge
run: gh pr merge --merge --auto "${{ steps.cpr.outputs.pull-request-url }}"