Cleanup npm package #146
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs | |
name: Node.js CI | |
on: | |
push: | |
branches: ['main'] | |
tags: ['*'] | |
pull_request: | |
branches: ['main'] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Use Node.js 20.x | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 20.x | |
cache: 'yarn' | |
- name: Install dependencies | |
run: yarn install --immutable | |
- name: Lint code | |
run: yarn eslint . | |
- name: Build code | |
run: yarn run build | |
- name: Test code | |
run: yarn test | |
- name: SonarCloud Scanning | |
uses: SonarSource/sonarcloud-github-action@master | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
- uses: actions/cache@v2 | |
id: package-build | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
path: ./* | |
key: ${{ github.sha }} | |
release: | |
runs-on: ubuntu-latest | |
if: startsWith(github.ref, 'refs/tags/') | |
needs: [build] | |
steps: | |
- uses: actions/cache@v2 | |
id: package-build | |
with: | |
path: ./* | |
key: ${{ github.sha }} | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: '20.x' | |
registry-url: 'https://registry.npmjs.org' | |
- run: npm publish | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |