Skip to content
This repository was archived by the owner on Oct 25, 2025. It is now read-only.

Commit 67e5a73

Browse files
committed
add publish workflow
1 parent 1892dab commit 67e5a73

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed

.github/workflows/publish.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Publish
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
type:
7+
description: "Release type"
8+
required: true
9+
type: choice
10+
default: prerelease
11+
options: [prerelease, patch, minor, major]
12+
13+
permissions:
14+
contents: write
15+
id-token: write
16+
17+
concurrency:
18+
group: release
19+
cancel-in-progress: false
20+
21+
jobs:
22+
release:
23+
runs-on: ubuntu-latest
24+
steps:
25+
- name: Checkout
26+
uses: actions/checkout@v5
27+
28+
- name: Setup Node.js
29+
uses: actions/setup-node@v4
30+
with:
31+
node-version: 24
32+
registry-url: 'https://registry.npmjs.org'
33+
34+
- name: Bump version
35+
id: bump
36+
run: |
37+
git config user.name "github-actions[bot]"
38+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
39+
if [ "${{ github.event.inputs.type }}" = "prerelease" ]; then
40+
npm version prerelease --preid=pre -m "release: %s"
41+
# TODO: temporarily publishing prereleases as 'latest', change after 0.0.1
42+
echo "tag=latest" >> $GITHUB_OUTPUT
43+
else
44+
npm version "${{ github.event.inputs.type }}" -m "release: %s"
45+
echo "tag=latest" >> $GITHUB_OUTPUT
46+
fi
47+
48+
- name: Push changes
49+
run: git push --follow-tags
50+
51+
- name: Install & test
52+
run: npm ci
53+
54+
- name: Publish to npm
55+
run: npm publish --access public --provenance --tag "${{ steps.bump.outputs.tag }}"
56+
env:
57+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)