Skip to content

Commit b8b585a

Browse files
committed
Add workflows
1 parent d802675 commit b8b585a

File tree

2 files changed

+88
-0
lines changed

2 files changed

+88
-0
lines changed

.github/workflows/node.js.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs
3+
4+
name: Node.js CI
5+
6+
on:
7+
push:
8+
branches: [ "main" ]
9+
pull_request:
10+
branches: [ "main" ]
11+
12+
jobs:
13+
build:
14+
15+
runs-on: ubuntu-latest
16+
17+
strategy:
18+
matrix:
19+
node-version: [24.x]
20+
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
21+
22+
steps:
23+
- uses: actions/checkout@v4
24+
- name: Use Node.js ${{ matrix.node-version }}
25+
uses: actions/setup-node@v4
26+
with:
27+
node-version: ${{ matrix.node-version }}
28+
cache: 'npm'
29+
- run: npm ci
30+
# - name: Install Playwright Browsers
31+
# run: npx playwright install --with-deps chromium
32+
- run: npm run build --if-present
33+
- run: npm test

.github/workflows/npm-publish.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# This workflow will run tests using node and then publish a package to npm when a release is created
2+
# Uses OIDC trusted publishing - no npm token required!
3+
# For more information see: https://docs.npmjs.com/trusted-publishers/
4+
5+
name: Node.js Package
6+
7+
on:
8+
release:
9+
types: [created]
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
- uses: actions/setup-node@v4
17+
with:
18+
node-version: 24
19+
cache: 'npm'
20+
21+
- run: npm ci
22+
# - name: Install Playwright Browsers
23+
# run: npx playwright install --with-deps chromium
24+
- run: npm run build --if-present
25+
- run: npm test
26+
27+
# Upload the built dist folder as an artifact
28+
- name: Upload dist folder
29+
uses: actions/upload-artifact@v4
30+
with:
31+
name: dist
32+
path: dist/
33+
34+
publish-npm:
35+
needs: build
36+
runs-on: ubuntu-latest
37+
permissions:
38+
id-token: write # Required for OIDC authentication
39+
contents: read
40+
steps:
41+
- uses: actions/checkout@v4
42+
- uses: actions/setup-node@v4
43+
with:
44+
node-version: 24
45+
registry-url: https://registry.npmjs.org/
46+
47+
# Download the built dist folder from the build job
48+
- name: Download dist folder
49+
uses: actions/download-artifact@v4
50+
with:
51+
name: dist
52+
path: dist/
53+
54+
- run: npm ci --omit=dev
55+
- run: npm publish --provenance --access public

0 commit comments

Comments
 (0)