adding coverage and xml reports #177
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: Build and Publish | |
on: | |
push: | |
branches: [ main ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [18.13] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set Version | |
run: npm --no-git-tag-version version 6.0.${{ github.run_number }} | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Install | |
run: npm ci | |
- name: Test | |
run: npm test | |
- name: Coverage Report | |
if: success() || failure() | |
uses: ArtiomTr/jest-coverage-report-action@v2 | |
- name: Publish Test Report | |
uses: mikepenz/action-junit-report@v4 | |
if: success() || failure() | |
with: | |
report_paths: 'junit.xml' | |
- name: Production Build | |
run: npm run build | |
- name: Authenticate with NPM registry | |
if: github.ref == 'refs/heads/master' | |
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > .npmrc | |
- name: Publish NPM package | |
if: github.ref == 'refs/heads/master' | |
run: npm publish --access public |