fix: package.json & package-lock.json to reduce vulnerabilities #137
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
name: CI | |
on: [ push, pull_request ] | |
jobs: | |
lockfile-lint: | |
name: Lockfile lint | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: '14' | |
- name: lint lock file | |
run: npx lockfile-lint --path package-lock.json --allowed-hosts npm --validate-https | |
test: | |
runs-on: ubuntu-latest | |
env: | |
FORCE_COLOR: 3 | |
strategy: | |
matrix: | |
node-version: [10.x, 12.x, 14.x, 16.x] | |
needs: lockfile-lint | |
name: Unit Tests Node ${{ matrix.node }} (${{ matrix.platform }}) | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- uses: actions/cache@v2 | |
with: | |
path: '**/node_modules' | |
key: ${{ matrix.node-version }}-node-${{ hashFiles('**/package-lock.json') }} | |
- name: install dependencies | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: npm ci | |
- name: Units Tests + Prepare Coveralls | |
run: npm run test:ci | |
- name: Coveralls | |
uses: coverallsapp/github-action@master | |
if: matrix.node-version == '14.x' | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
release: | |
name: release | |
permissions: | |
actions: write | |
checks: write | |
contents: write | |
deployments: write | |
issues: write | |
packages: write | |
pull-requests: write | |
repository-projects: write | |
security-events: write | |
statuses: write | |
needs: [ test, lockfile-lint ] | |
runs-on: 'ubuntu-latest' | |
if: github.event_name == 'push' && github.ref == 'refs/heads/master' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Setup Node | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '14.x' | |
- name: Install dependencies | |
run: npm ci --ignore-scripts | |
- name: Release | |
env: | |
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
NPM_TOKEN: ${{secrets.NPM_TOKEN }} | |
run: npx semantic-release |