This repository was archived by the owner on Sep 25, 2025. It is now read-only.
Publish #36
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 | |
on: | |
workflow_dispatch: | |
inputs: | |
versionClass: | |
type: choice | |
required: true | |
options: | |
- 'patch' | |
- 'minor' | |
- 'major' | |
concurrency: | |
group: ${{ github.workflow }} | |
cancel-in-progress: true | |
permissions: | |
id-token: write # Required for OIDC | |
contents: write # create tag and release | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5 | |
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5 | |
with: | |
node-version-file: '.node-version' | |
cache: 'yarn' | |
registry-url: 'https://registry.npmjs.org' | |
# Trusted publishing requires npm CLI version 11.5.1 or later. | |
- name: Ensure npm >= 11.5.1 | |
run: npm i -g npm@^11.5.1 | |
- name: Install dependencies | |
run: yarn install --frozen-lockfile | |
- name: Bump version and publish | |
id: bump-version | |
run: | | |
git config user.name '[bot] github action (${{ github.workflow }})' | |
git config user.email '[email protected]' | |
yarn version --${{ github.event_name == 'schedule' && 'patch' || github.event.inputs.versionClass }} | |
yarn run publish | |
echo "new_version=$(jq -r .version package.json)" >> "$GITHUB_OUTPUT" | |
- name: Create release | |
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
await github.rest.repos.createRelease({ | |
owner: "${{github.repository_owner}}", | |
repo: "${{github.repository}}".split('/')[1], | |
tag_name: "v${{ steps.bump-version.outputs.new_version }}", | |
generate_release_notes: true, | |
}) |