This repository has been archived by the owner on Oct 10, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 45
77 lines (62 loc) · 1.61 KB
/
build_publish.yaml
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
name: Build and Publish
on:
push:
branches: ["main"]
# We only deploy on tags and main branch
tags:
# Only run on tags that match the following regex
# This will match tags like 1.0.0, 1.0.1, etc.
- "[0-9]+.[0-9]+.[0-9]+"
# Build on pull requests
pull_request:
jobs:
lint_and_test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18, 20, 22]
steps:
# Checkout the repository
- name: Checkout
uses: actions/checkout@v4
# Set node version
- name: set node version
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
# Install Build stuff
- name: Install Dependencies
run: |
npm install
# Eslint
- name: ESlint check
run: |
npm run lint
# Run tests
- name: Run tests
run: |
npm run test
# Build TypeScript Examples
- name: Build typescript examples
run: |
cd examples/typescript
npm install
npx tsc --build --verbose tsconfig.json
publish:
needs: lint_and_test
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags')
steps:
# Checkout the repository
- name: Checkout
uses: actions/checkout@v4
# Set node version
- name: set node version
uses: actions/setup-node@v4
with:
node-version: 18
# Publish module
- name: Publish
run: |
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" >> .npmrc
npm publish