Skip to content

Commit

Permalink
add: github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
talhag3 committed Aug 17, 2024
1 parent 2484610 commit 17cce79
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
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 }}

0 comments on commit 17cce79

Please sign in to comment.