.github/workflows/push.yml
name: Node.js CI
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-22.04
strategy:
matrix:
node: [ '18.12', '18', '20', '22' ]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: 'npm'
- run: npm ci
- run: npm run lint
- run: npm run test -- --coverage
- uses: paambaati/codeclimate-action@v6.0.0
env:
CC_TEST_REPORTER_ID: 47283c50a0f1654abe1454ac936de832b4c668e579eb10c1aefa1545e4e77e1d
- run: npm run e2e
deploy:
runs-on: ubuntu-22.04
if: startsWith(github.ref, 'refs/tags/v')
needs: build
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4
- name: Get full tag
id: full_tag
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> "$GITHUB_OUTPUT"
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- run: npm ci
- run: npm run build
- run: npm config set '//registry.npmjs.org/:_authToken' "${NPM_AUTH_TOKEN}"
env:
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
- run: npm publish --provenance
- run: ./bin/smoke.sh
env:
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
TAG: ${{ steps.full_tag.outputs.VERSION }}