Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 29 additions & 9 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,53 @@ name: Publish

on:
release:
types: [created]
types: [published]
workflow_dispatch:
inputs:
tag:
description: Existing release tag to publish
required: true
type: string

permissions:
contents: read

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- uses: actions/checkout@v6
with:
ref: ${{ inputs.tag || github.ref }}
- uses: actions/setup-node@v6
with:
node-version: 16
node-version: 24
package-manager-cache: false
- run: npm ci
- run: npm test
- run: npm run lint

publish-npm:
needs: test
permissions:
contents: read
id-token: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- uses: actions/checkout@v6
with:
ref: ${{ inputs.tag || github.ref }}
- uses: actions/setup-node@v6
with:
node-version: 16
node-version: 24
package-manager-cache: false
registry-url: https://registry.npmjs.org/
- run: npm ci
- run: npm run build
- run: npm run declarations
- run: npm run test:package
- run: npm publish
- name: Verify release version
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
RELEASE_TAG: ${{ inputs.tag || github.ref_name }}
run: node -e 'if (process.env.RELEASE_TAG !== "v" + require("./package.json").version) process.exit(1)'
- run: npm publish
Loading