Publish release #19
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: Publish release | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: "The version number to tag and release" | |
| required: true | |
| type: string | |
| prerelease: | |
| description: "Release as pre-release" | |
| required: false | |
| type: boolean | |
| default: false | |
| jobs: | |
| release-npm: | |
| runs-on: ubuntu-latest | |
| environment: npm | |
| permissions: | |
| contents: write | |
| id-token: write | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: pnpm/action-setup@v4 | |
| with: | |
| version: latest | |
| - uses: actions/setup-node@v5 | |
| with: | |
| node-version: 22 | |
| registry-url: 'https://registry.npmjs.org' | |
| cache: pnpm | |
| - run: pnpm install --frozen-lockfile | |
| - name: Bump version and commit | |
| run: | | |
| pnpm version ${{ inputs.version }} --no-git-tag-version | |
| git config --global user.name "${{ github.actor }}" | |
| git config --global user.email "${{ github.actor }}@users.noreply.github.com" | |
| git commit -a -m "Bumped v${{ inputs.version }}" | |
| - run: npm install -g npm@latest | |
| - run: npm publish --tag ${{ inputs.prerelease == true && 'next' || 'latest' }} | |
| env: | |
| GITHUB_TOKEN: ${{ github.token }} | |
| - name: Push release commit if publish succeeded | |
| run: git push origin HEAD:${{ github.ref }} | |
| - name: Create release notes | |
| run: | | |
| npx @matteo.collina/release-notes -a ${{ secrets.GITHUB_TOKEN }} -t v${{ inputs.version }} -r ${{ github.repository }} ${{ github.event.inputs.prerelease == 'true' && '-p' || '' }} -c ${{ github.ref }} |