-
Notifications
You must be signed in to change notification settings - Fork 42
55 lines (47 loc) · 1.46 KB
/
publish.yml
File metadata and controls
55 lines (47 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
name: Publish npm Package
on:
push:
tags:
- "v*"
workflow_dispatch:
inputs:
dry_run:
description: "Run packaging checks without publishing"
required: false
default: true
type: boolean
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- uses: actions/setup-node@v4
with:
node-version: "20"
registry-url: "https://registry.npmjs.org"
- name: Validate tag matches package version
if: github.event_name == 'push'
run: |
TAG_VERSION="${GITHUB_REF_NAME#v}"
PKG_VERSION="$(node -p "require('./package.json').version")"
echo "tag=$TAG_VERSION package=$PKG_VERSION"
if [ "$TAG_VERSION" != "$PKG_VERSION" ]; then
echo "Tag version and package.json version must match"
exit 1
fi
- run: bun install
- run: bun run build
- run: bun run test:ci:unit
# Integration tests skipped in publish - already validated on push to main
- run: npm pack --dry-run
- name: Publish to npm
if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && inputs.dry_run == false)
run: npm publish --access public --provenance
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}