Skip to content

Commit

Permalink
Merge pull request #8 from aashutoshrathi/setup/ci
Browse files Browse the repository at this point in the history
👷🏻 Setup CI & CD
  • Loading branch information
aashutoshrathi committed Jan 25, 2024
2 parents 03252fc + 1a168d6 commit fa4e7bc
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 1 deletion.
21 changes: 21 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Publish to NPM
on:
release:
types: [created]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '18.x'
registry-url: 'https://registry.npmjs.org'
- name: Install dependencies and build 🔧
run: npm i && npm run build
- name: Publish package on NPM 📦
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
34 changes: 34 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Test

on:
push:
paths-ignore:
- 'README.md'
branches:
- main
pull_request:
paths-ignore:
- 'README.md'
branches:
- main

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- ubuntu-latest
- windows-latest
node: [16.x, 18.x]

steps:
- uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
- name: Install modules
run: npm i
- name: Run tests
run: npm test
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
"exports": "./build/index.js",
"scripts": {
"build": "tsc -b",
"test": "vitest"
"test:watch": "vitest",
"test": "vitest run"
},
"files": [
"build",
Expand Down

0 comments on commit fa4e7bc

Please sign in to comment.