Skip to content

Commit 95ca8b4

Browse files
committed
Add GitHub Actions workflows for CI/CD
1 parent c6c9ee4 commit 95ca8b4

2 files changed

Lines changed: 65 additions & 0 deletions

File tree

.github/workflows/cd.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: CD
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
7+
jobs:
8+
build-test-publish:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
13+
- name: Set up Node.js
14+
uses: actions/setup-node@v4
15+
with:
16+
node-version: 20
17+
registry-url: https://registry.npmjs.org/
18+
19+
- name: Install dependencies
20+
run: npm ci
21+
22+
- name: Build
23+
run: npm run build
24+
25+
- name: Run checks (linting, type-checking, formatting)
26+
run: npm run check
27+
28+
- name: Run tests
29+
run: npm run test
30+
31+
- name: Publish package to npm
32+
if: ${{ vars.ENVIRONMENT == 'prod' }}
33+
run: npm publish --access public
34+
env:
35+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.github/workflows/ci.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
branches: [ main ]
6+
push:
7+
branches: [ main ]
8+
9+
jobs:
10+
build-and-test:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- name: Set up Node.js
16+
uses: actions/setup-node@v4
17+
with:
18+
node-version: 20
19+
20+
- name: Install dependencies
21+
run: npm ci
22+
23+
- name: Build
24+
run: npm run build
25+
26+
- name: Run checks (linting, type-checking, formatting)
27+
run: npm run check
28+
29+
- name: Run tests
30+
run: npm run test

0 commit comments

Comments
 (0)