Skip to content

add: github actions

add: github actions #1

Workflow file for this run

name: CI
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '18' # Set the Node.js version
- name: Install dependencies
run: npm install
- name: Lint code
run: npm run lint
- name: Format code
run: npm run format
- name: Run tests
run: npm test
- name: Generate test coverage report
run: npm run test -- --coverage
- name: Publish to npm
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
run: |
npm config set //registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}
npm publish
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}