Create Release PR #7
This file contains hidden or 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
| name: Create Release PR | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| semver: | |
| description: 'New Version(semver)' | |
| required: true | |
| default: 'patch' | |
| type: choice | |
| options: | |
| - patch | |
| - minor | |
| - major | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| jobs: | |
| create-release-pr: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0 | |
| with: | |
| persist-credentials: false | |
| - name: Install pnpm | |
| uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 | |
| with: | |
| node-version: 22 | |
| cache: 'pnpm' | |
| - name: Install dependencies | |
| run: pnpm install | |
| - name: Update Version | |
| run: | | |
| git config --global user.email "${GIT_AUTHOR_EMAIL}" | |
| git config --global user.name "${GIT_AUTHOR_NAME}" | |
| pnpm run ci:versionup:${SEMVER} | |
| env: | |
| SEMVER: ${{ github.event.inputs.semver }} | |
| GIT_AUTHOR_NAME: ${{ github.actor }} | |
| GIT_AUTHOR_EMAIL: ${{ github.actor }}@users.noreply.github.com | |
| - name: Set PACKAGE_VERSION | |
| run: echo "PACKAGE_VERSION=$(cat lerna.json | jq -r .version)" >> $GITHUB_ENV | |
| - name: Set GitHub Release Note | |
| id: release_note | |
| uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 | |
| with: | |
| script: | | |
| const result = await exec.getExecOutput(`gh api "/repos/{owner}/{repo}/releases/generate-notes" -f tag_name="v${process.env.PACKAGE_VERSION}" --jq .body`, [], { | |
| ignoreReturnCode: true, | |
| }) | |
| core.setOutput('stdout', result.stdout) | |
| env: | |
| PACKAGE_VERSION: ${{ env.PACKAGE_VERSION }} | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Create Pull Request | |
| id: cpr | |
| uses: peter-evans/create-pull-request@5e914681df9dc83aa4e4905692ca88beb2f9e91f # v7.0.5 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| commit-message: "chore(release): v${{ env.PACKAGE_VERSION }}" | |
| committer: GitHub <[email protected]> | |
| author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com> | |
| assignees: ${{ github.actor }} | |
| signoff: false | |
| branch: release/${{ env.PACKAGE_VERSION }} | |
| branch-suffix: timestamp | |
| delete-branch: true | |
| title: 'v${{ env.PACKAGE_VERSION }}' | |
| body: | | |
| ${{ steps.release_note.outputs.stdout }} | |
| labels: "Type: Release" | |
| - name: Check Pull Request | |
| run: | | |
| echo "Pull Request Number - ${STEPS_CPR_OUTPUTS_PULL_REQUEST_NUMBER}" | |
| echo "Pull Request URL - ${STEPS_CPR_OUTPUTS_PULL_REQUEST_URL}" | |
| env: | |
| STEPS_CPR_OUTPUTS_PULL_REQUEST_NUMBER: ${{ steps.cpr.outputs.pull-request-number }} | |
| STEPS_CPR_OUTPUTS_PULL_REQUEST_URL: ${{ steps.cpr.outputs.pull-request-url }} |