Skip to content

Commit bb39e5a

Browse files
author
Alok Kumar
committed
RV [CLEANUP-CI] -> added CI/CD & cleanup the code
1 parent ef5c0fe commit bb39e5a

2 files changed

Lines changed: 70 additions & 0 deletions

File tree

.github/workflows/publish.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Publish Package to NPM
2+
3+
on:
4+
release:
5+
types: [created]
6+
7+
jobs:
8+
build-and-publish:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout code
12+
uses: actions/checkout@v4
13+
14+
- name: Setup Node.js
15+
uses: actions/setup-node@v4
16+
with:
17+
node-version: '20.x'
18+
registry-url: 'https://registry.npmjs.org'
19+
20+
- name: Install dependencies
21+
run: npm ci
22+
23+
- name: Type check
24+
run: npm run typecheck
25+
26+
- name: Run tests
27+
run: npm test
28+
29+
- name: Build
30+
run: npm run build
31+
32+
- name: Publish to NPM
33+
run: npm publish
34+
env:
35+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.github/workflows/test.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Test
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v4
15+
16+
- name: Setup Node.js
17+
uses: actions/setup-node@v4
18+
with:
19+
node-version: '20.x'
20+
cache: 'npm'
21+
22+
- name: Install dependencies
23+
run: npm ci
24+
25+
- name: Type check
26+
run: npm run typecheck
27+
28+
- name: Run tests
29+
run: npm test
30+
31+
- name: Upload coverage reports
32+
uses: codecov/codecov-action@v3
33+
with:
34+
token: ${{ secrets.CODECOV_TOKEN }}
35+
fail_ci_if_error: true

0 commit comments

Comments
 (0)