Skip to content

Commit 2a4cea2

Browse files
committed
chore: create NPM publish workflow
1 parent 6824480 commit 2a4cea2

1 file changed

Lines changed: 32 additions & 0 deletions

File tree

.github/workflows/publish.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Publish NPM
2+
on:
3+
push:
4+
branches:
5+
- main
6+
tags: v*
7+
workflow_dispatch:
8+
inputs:
9+
version:
10+
description: 'Optional version to publish (major.minor.patch). If not provided, the current version specified in package.json will be published.'
11+
required: false
12+
13+
jobs:
14+
build:
15+
runs-on: ubuntu-latest
16+
17+
permissions:
18+
contents: read
19+
id-token: write
20+
21+
steps:
22+
- uses: actions/checkout@v6
23+
- uses: actions/setup-node@v6
24+
with:
25+
node-version: "24"
26+
registry-url: "https://registry.npmjs.org"
27+
- run: npm install
28+
- run: npm test
29+
- name: Set package version (optional)
30+
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.version != '' }}
31+
run: npm version "${{ github.event.inputs.version }}" --no-git-tag-version
32+
- run: npm publish --ignore-scripts --provenance --access public

0 commit comments

Comments
 (0)