Skip to content

Commit 1deeb34

Browse files
Merge pull request #37 from codedbychavez/add-ci-pipeline
Add GitHub actions workflow
2 parents ee0ff7a + 95bb11b commit 1deeb34

File tree

1 file changed

+65
-0
lines changed

1 file changed

+65
-0
lines changed

.github/workflows/ci.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: CI
2+
3+
on:
4+
schedule:
5+
- cron: "0 0 * * *"
6+
push:
7+
branches:
8+
- "main"
9+
tags: ["v[0-9]+.[0-9]+.[0-9]+"]
10+
pull_request:
11+
branches:
12+
- "main"
13+
14+
workflow_dispatch:
15+
inputs:
16+
logLevel:
17+
description: "Log level"
18+
required: true
19+
default: "warning"
20+
type: choice
21+
options:
22+
- info
23+
- warning
24+
- debug
25+
26+
jobs:
27+
test:
28+
runs-on: ubuntu-latest
29+
name: Run unit and integration tests
30+
strategy:
31+
matrix:
32+
version: [18, 20]
33+
steps:
34+
- uses: actions/checkout@v4
35+
- name: Using Node.js ${{ matrix.version }}
36+
uses: actions/setup-node@v4
37+
with:
38+
node-version: ${{ matrix.version }}
39+
- name: Install dependencies
40+
run: npm install
41+
- name: Run tests
42+
run: npm test
43+
44+
build_and_publish:
45+
needs: [test]
46+
runs-on: ubuntu-latest
47+
if: startsWith(github.ref, 'refs/tags')
48+
steps:
49+
- uses: actions/checkout@v4
50+
51+
- uses: actions/setup-node@v4
52+
with:
53+
node-version: 20
54+
registry-url: "https://registry.npmjs.org"
55+
56+
- name: Install dependencies
57+
run: npm install
58+
59+
- name: Build
60+
run: npm run build
61+
62+
- name: Publish
63+
run: npm publish
64+
env:
65+
NPM_PUBLISH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)