Skip to content

Commit ca8f591

Browse files
committed
Set up CI/CD pipeline with GitHub Actions
- Add workflow for automated testing, linting, and npm deployment - Update package.json with lint script - Create .npmignore file - Update .gitignore to exclude .npmrc
1 parent bc59731 commit ca8f591

File tree

5 files changed

+1663
-731
lines changed

5 files changed

+1663
-731
lines changed

.github/workflows/ci-cd.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: CI/CD
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+
- uses: actions/checkout@v2
14+
- name: Use Node.js
15+
uses: actions/setup-node@v2
16+
with:
17+
node-version: '14.x'
18+
- run: npm ci
19+
- run: npm run build
20+
- run: npm test
21+
22+
lint:
23+
runs-on: ubuntu-latest
24+
steps:
25+
- uses: actions/checkout@v2
26+
- name: Use Node.js
27+
uses: actions/setup-node@v2
28+
with:
29+
node-version: '14.x'
30+
- run: npm ci
31+
- run: npm run lint
32+
33+
deploy:
34+
needs: [test, lint]
35+
runs-on: ubuntu-latest
36+
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
37+
steps:
38+
- uses: actions/checkout@v2
39+
- name: Use Node.js
40+
uses: actions/setup-node@v2
41+
with:
42+
node-version: '14.x'
43+
- run: npm ci
44+
- run: npm run build
45+
- name: Deploy to npm
46+
run: |
47+
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
48+
npm publish
49+
env:
50+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,4 +66,6 @@ jspm_packages/
6666
.parcel-cache
6767

6868
# Next.js build output
69-
.next
69+
.next
70+
71+
.npmrc

0 commit comments

Comments
 (0)