Create Release PR #15
Workflow file for this run
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: | |
| release-type: | |
| description: 'Release type' | |
| required: true | |
| type: choice | |
| options: | |
| - '--preid beta' | |
| - '--conventional-graduate' | |
| concurrency: | |
| group: "release-pr" | |
| cancel-in-progress: false | |
| jobs: | |
| create-release-pr: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| env: | |
| RELEASE_BRANCH: zcli-release | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version-file: '.node-version' | |
| cache: "yarn" | |
| - name: Configure git | |
| run: | | |
| git config --global user.name "${{ github.actor }}" | |
| git config --global user.email "${{ github.actor }}@users.noreply.github.com" | |
| - name: Check if release branch exists | |
| run: | | |
| if git ls-remote --exit-code --heads origin "$RELEASE_BRANCH" >/dev/null 2>&1; then | |
| echo "Error: Release branch '$RELEASE_BRANCH' already exists on remote." | |
| echo 'Please close/merge the existing release PR first, then delete the branch.' | |
| exit 1 | |
| fi | |
| - name: Create release branch | |
| run: | | |
| git checkout -b "$RELEASE_BRANCH" | |
| - name: Install dependencies | |
| run: | | |
| yarn install --frozen-lockfile | |
| - name: Version bump and update changelog | |
| id: version_bump | |
| run: | | |
| yarn lerna version \ | |
| --conventional-commits \ | |
| ${{ inputs.release-type }} \ | |
| --no-git-tag-version \ | |
| --yes | |
| VERSION=$(node -p "require('./lerna.json').version") | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| - name: Commit and push changes | |
| run: | | |
| git commit -am "chore(release): version bump" | |
| git push origin $RELEASE_BRANCH | |
| - name: Create Pull Request | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| VERSION="${{ steps.version_bump.outputs.version }}" | |
| gh pr create \ | |
| --base master \ | |
| --head $RELEASE_BRANCH \ | |
| --title "chore(release): v$VERSION" \ | |
| --body "## Release v$VERSION | |
| Version bump and changelog updates. | |
| Merging this PR will trigger the release process." |