Create release pull request #13
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
# Copyright (c) 2023 DeNA Co., Ltd. | |
# This software is released under the MIT License. | |
name: Create release pull request | |
# Must manually add the label `skip-changelog` to the repository before running this workflow. | |
on: | |
workflow_dispatch: | |
permissions: write-all | |
jobs: | |
create-release-pr: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Get draft release version | |
uses: cardinalby/git-get-release-action@v1 | |
with: | |
latest: true | |
draft: true | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
id: get-draft-release | |
# Fail this step if not found draft release | |
- name: Generate next version number (remove prefix) | |
run: | | |
tag_with_prefix=${{ steps.get-draft-release.outputs.tag_name }} | |
without_prefix=${tag_with_prefix:1} | |
echo "version=$without_prefix" >> "$GITHUB_OUTPUT" | |
id: next-version | |
- uses: actions/checkout@v4 | |
with: | |
ref: master | |
- name: Bump version and create pull-request | |
run: | | |
git config user.name github-actions | |
git config user.email [email protected] | |
git checkout -b release/${{ steps.next-version.outputs.version }} | |
npm version --no-git-tag-version ${{ steps.next-version.outputs.version }} | |
git add . | |
git commit -m"Bump version to v${{ steps.next-version.outputs.version }}" | |
git push origin HEAD | |
gh pr create --title "Release v${{ steps.next-version.outputs.version }}" --body-file ".github/release-pr-template.md" --reviewer ${{ github.actor }} --label "skip-changelog" | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |