Merge pull request #6 from DuncanMcPherson/publishing #7
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: 'Deploy package to npm' | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- master | |
env: | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
jobs: | |
build_pack_and_publish: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Cache node modules | |
id: cache-npm | |
uses: actions/cache@v3 | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-build-${{ hashFiles('**/package-lock.json') }} | |
- run: npm ci && npm run build | |
- run: npm whoami | |
- run: npm pack | |
- run: npm publish | |
coverage: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Cache node modules | |
id: cache-npm | |
uses: actions/cache@v3 | |
with: | |
path: ~/.npm | |
key: ${{ runner.os}}-build-${{ hashFiles('**/package-lock.json') }} | |
- run: npm ci && npm run test | |
- name: Upload coverage to codecov | |
if: always() | |
uses: codecov/codecov-action@v3 | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} |