Prepare release #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: Prepare release | |
| description: | | |
| Bumps the version in package.json and creates a release PR. Once merged, the new | |
| version will be published to npm. | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: "Exact version to bump to or one of major, minor, patch" | |
| required: true | |
| default: "patch" | |
| permissions: {} | |
| jobs: | |
| create-pr: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: GitHubSecurityLab/actions-permissions/monitor@v1 | |
| - uses: mongodb-js/devtools-shared/actions/setup-bot-token@main | |
| id: app-token | |
| with: | |
| app-id: ${{ vars.DEVTOOLS_BOT_APP_ID }} | |
| private-key: ${{ secrets.DEVTOOLS_BOT_PRIVATE_KEY }} | |
| - uses: actions/checkout@v5 | |
| - uses: pnpm/action-setup@v4 | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version-file: package.json | |
| registry-url: "https://registry.npmjs.org" | |
| cache: "pnpm" | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Bump version | |
| id: bump-version | |
| run: | | |
| echo "NEW_VERSION=$(pnpm version ${{ inputs.version }} --no-git-tag-version)" >> $GITHUB_OUTPUT | |
| pnpm run build:update-package-version | |
| - name: Update server.json version and arguments | |
| run: | | |
| pnpm run generate:arguments | |
| - name: Create release PR | |
| uses: peter-evans/create-pull-request@84ae59a2cdc2258d6fa0732dd66352dddae2a412 # 7.0.9 | |
| id: create-pr | |
| with: | |
| title: "chore: release ${{ steps.bump-version.outputs.NEW_VERSION }}" | |
| token: ${{ steps.app-token.outputs.token }} | |
| commit-message: "chore: release ${{ steps.bump-version.outputs.NEW_VERSION }}" | |
| body: | | |
| This PR bumps the package version to ${{ steps.bump-version.outputs.NEW_VERSION }}. | |
| Once merged, the new version will be published to npm. | |
| base: main | |
| branch: chore_release_${{ steps.bump-version.outputs.NEW_VERSION }} | |
| author: "${{ steps.app-token.outputs.app-slug}}[bot] <${{ steps.app-token.outputs.app-email }}>" | |
| committer: "${{ steps.app-token.outputs.app-slug}}[bot] <${{ steps.app-token.outputs.app-email }}>" | |
| - name: Set auto merge | |
| env: | |
| GH_TOKEN: ${{ steps.app-token.outputs.token }} | |
| run: | | |
| gh pr merge ${{ steps.create-pr.outputs.pull-request-number }} --auto --squash |