Prepare Release #62
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 | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'Version to prepare as (e.g. patch, minor, major)' | |
| type: choice | |
| options: | |
| - patch | |
| - minor | |
| - major | |
| - prepatch | |
| - preminor | |
| - premajor | |
| - prerelease | |
| required: true | |
| preid: | |
| description: 'Prerelease identifier (e.g. alpha, beta, rc). Only used if version is a prerelease type' | |
| type: choice | |
| required: false | |
| options: | |
| - alpha | |
| - beta | |
| - rc | |
| force: | |
| description: 'Force prepare even if no changes detected' | |
| required: false | |
| type: boolean | |
| push: | |
| branches: | |
| - release/** | |
| permissions: | |
| actions: write | |
| checks: write | |
| contents: write | |
| pull-requests: write | |
| jobs: | |
| prepare-release: | |
| runs-on: ubuntu-latest | |
| name: Prepare Release | |
| steps: | |
| - uses: actions/create-github-app-token@v3 | |
| id: generate-token | |
| with: | |
| app-id: 2384674 | |
| private-key: ${{ secrets.RELEASE_APP_PRIVATE_KEY }} | |
| - name: Checkout repository | |
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7 | |
| with: | |
| token: ${{ steps.generate-token.outputs.token }} | |
| persist-credentials: true | |
| - name: Set up pnpm | |
| uses: pnpm/action-setup@08c4be7e2e672a47d11bd04269e27e5f3e8529cb # v6 | |
| with: | |
| run_install: true | |
| - name: Set up Node.js | |
| uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6 | |
| with: | |
| node-version: '24' | |
| cache: 'pnpm' | |
| - name: Compile | |
| run: pnpm compile | |
| - name: Bump version | |
| run: ./scripts/bump-version.sh ${{ github.event.inputs.version }} --preid='${{ github.event.inputs.preid }}' | |
| - name: Generate docs | |
| run: pnpm docs:gen:md | |
| - name: Set up committer | |
| run: | | |
| git config --global user.name "github-actions[bot]" | |
| git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
| - name: Prepare release | |
| if: github.event_name == 'workflow_dispatch' | |
| run: ./scripts/prepare-release.sh --create-pr --force=${{ github.event.inputs.force }} | |
| env: | |
| GH_TOKEN: ${{ steps.generate-token.outputs.token }} | |
| - name: Get release version | |
| id: get_release_version | |
| run: echo "version=$(cat .release-version)" >> $GITHUB_OUTPUT | |
| - name: Pack | |
| run: pnpm pack -r | |
| - name: Push artifacts | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| with: | |
| name: pki-lite-${{ steps.get_release_version.outputs.version }} | |
| path: ./*.tgz | |
| - name: Test publish | |
| run: pnpm publish -r --dry-run --publish-branch=$(git branch --show-current) --no-git-checks |