Skip to content

Fix: Fixing Linting Workflow Issues #20

Fix: Fixing Linting Workflow Issues

Fix: Fixing Linting Workflow Issues #20

Workflow file for this run

name: Publish NPM Package
on:
push:
branches: 'master'
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
- id: actual_version
run: echo "actual_version=$(npm view checkerz version)" >> $GITHUB_OUTPUT
- run: sudo apt-get install jq
- id: curr_version
run: echo "curr_version=$(jq -r .version package.json)" >> $GITHUB_OUTPUT
- run: npm ci
- run: npm test
outputs:
curr_version: ${{ steps.curr_version.outputs.curr_version }}
actual_version: ${{ steps.actual_version.outputs.actual_version }}
publish-npm:
needs: test
runs-on: ubuntu-latest
if: ${{ needs.test.result == 'success' && needs.test.outputs.curr_version != needs.test.outputs.actual_version }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
registry-url: https://registry.npmjs.org/
# Remove "type": "module" from package.json
- run: |
sed -i.bak '/"type": "module"/d' package.json
# Install Dependencies
- run: npm ci
# Build for ES5 & ES6
- run: npm run build
- run: rm ./dist/Checkerz_ES5.js.LICENSE.txt
# Publish the package.
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}