Publish release #30
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: main | |
| permissions: | |
| id-token: write | |
| contents: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: latest | |
| - name: Use supported Node.js Version | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| registry-url: 'https://registry.npmjs.org' | |
| cache: 'pnpm' | |
| - name: Restore cached dependencies | |
| uses: actions/cache@v3 | |
| with: | |
| path: ~/.pnpm-store | |
| key: node-modules-${{ hashFiles('package.json') }} | |
| - name: Install dependencies | |
| run: pnpm install | |
| - name: Bump Version | |
| run: node scripts/bump-version.ts "${{ inputs.version }}" "${{ github.actor }}" | |
| env: | |
| GITHUB_ACTIONS: 'true' | |
| - name: Push changes | |
| run: git push origin HEAD:${{ github.ref }} | |
| - name: Update npm | |
| run: npm install -g npm@latest | |
| - name: Publish to NPM | |
| run: pnpm publish --access public --tag ${{ inputs.prerelease == true && 'next' || 'latest' }} --publish-branch ${{ github.ref_name }} --no-git-checks | |
| - name: 'Create release notes' | |
| run: | | |
| pnpx @matteo.collina/release-notes -a ${{ secrets.GH_RELEASE_TOKEN }} -t v${{ inputs.version }} -r kafka -o platformatic ${{ github.event.inputs.prerelease == 'true' && '-p' || '' }} -c ${{ github.ref }} |