Skip to content

Commit 3d1c5d1

Browse files
authored
feat: add publish workflows (#329)
Adds a publish workflow and updates a few dev scripts/dependencies to reduce the install size and security audit notices.
1 parent bd11864 commit 3d1c5d1

File tree

5 files changed

+2199
-8880
lines changed

5 files changed

+2199
-8880
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -26,20 +26,3 @@ jobs:
2626
node-version: ${{ matrix.node_version }}
2727
- run: npm ci
2828
- run: npm test
29-
30-
publish-npm:
31-
if: ${{ github.event_name == 'push' }}
32-
needs: build
33-
runs-on: ubuntu-latest
34-
steps:
35-
- uses: actions/checkout@v4
36-
- uses: actions/setup-node@v4
37-
with:
38-
node-version: 22
39-
registry-url: https://registry.npmjs.org/
40-
- run: npm ci
41-
- run: npm whoami
42-
- run: npm run release
43-
env:
44-
NPM_TOKEN: ${{secrets.NPM_TOKEN}}
45-
GITHUB_TOKEN: ${{secrets.GH_RELEASE_TOKEN}}

.github/workflows/npm-publish.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages
3+
4+
name: Publish to npm
5+
6+
on:
7+
release:
8+
types: [published]
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
- uses: actions/setup-node@v4
16+
with:
17+
node-version: 22
18+
- run: npm ci
19+
- run: npm test
20+
21+
publish-npm:
22+
needs: build
23+
runs-on: ubuntu-latest
24+
permissions:
25+
id-token: write
26+
steps:
27+
- uses: actions/checkout@v4
28+
- uses: actions/setup-node@v4
29+
with:
30+
node-version: 22.x
31+
registry-url: 'https://registry.npmjs.org'
32+
cache: 'npm'
33+
- run: npm ci
34+
- run: npm version ${TAG_NAME} --git-tag-version=false
35+
env:
36+
TAG_NAME: ${{ github.ref_name }}
37+
- run: npm publish --provenance --access public --tag next
38+
if: "github.event.release.prerelease"
39+
env:
40+
NODE_AUTH_TOKEN: ${{ secrets.npm_secret }}
41+
- run: npm publish --provenance --access public
42+
if: "!github.event.release.prerelease"
43+
env:
44+
NODE_AUTH_TOKEN: ${{ secrets.npm_secret }}

.releaserc.json

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)