Skip to content

Publish release

Publish release #14

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@v4
with:
node-version: 22
registry-url: 'https://registry.npmjs.org'
cache: pnpm
- run: pnpm install --frozen-lockfile
env:
NODE_AUTH_TOKEN: ${{ secrets.PYTHON_NODE_NPM_TOKEN }}
- 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 }}