-
Notifications
You must be signed in to change notification settings - Fork 4
43 lines (35 loc) · 956 Bytes
/
Copy pathpublish.yml
File metadata and controls
43 lines (35 loc) · 956 Bytes
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
name: Publish to npm
on:
release:
types: [published]
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
- name: Install dependencies
run: bun install
- name: Run tests
run: bun run test
- name: Build package
run: bun run build
- name: Configure npm auth
if: env.NPM_TOKEN != ''
run: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Publish to npm
run: |
if [ -n "${NPM_TOKEN}" ]; then
bun publish --access public
else
npm publish --provenance --access public
fi
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}