-
Notifications
You must be signed in to change notification settings - Fork 0
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 #183 from t-yng/chore/release-ci-workflow
- Loading branch information
Showing
2 changed files
with
68 additions
and
35 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 |
---|---|---|
@@ -0,0 +1,53 @@ | ||
name: create_release_pr | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
release-version: | ||
description: 'select release semantic version (patch, minor, major)' | ||
required: true | ||
type: choice | ||
options: | ||
- 'patch' | ||
- 'minor' | ||
- 'major' | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16 | ||
|
||
# アップデート後のバージョンを環境変数にセット | ||
- name: Get new version | ||
id: new-version | ||
run: | | ||
echo "NEW_VERSION=$(npm --no-git-tag-version version $RELEASE_TYPE)" >> $GITHUB_ENV | ||
# package.jsonのバージョンをアップデートしてコミット | ||
- name: Update package.json version | ||
run: | | ||
NEW_VERSION=$(npm --no-git-tag-version version ${{ env.RELEASE_VERSION }}) | ||
git add package.json | ||
git commit -m "chore: release $NEW_VERSION" | ||
env: | ||
RELEASE_VERSION: ${{ github.event.inputs.release-version }} | ||
|
||
- name: Create Pull Request | ||
id: cpr | ||
uses: peter-evans/create-pull-request@v5 | ||
with: | ||
branch: release/v${{ env.NEW_VERSION }} | ||
title: release ${{ env.NEW_VERSION }} | ||
labels: release | ||
|
||
- name: Enable Pull Request Automerge | ||
run: gh pr merge --merge --auto "${{ steps.cpr.outputs.pull-request-number }}" | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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