Changes generated by d8eadeb2ddedfd49397e49bf2102cf780d57e522 #51
Workflow file for this run
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: test & publish | |
on: push | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
container: | |
image: node:lts | |
steps: | |
- uses: actions/checkout@v3.3.0 | |
- run: npm install --save-dev jest typescript ts-jest @types/jest | |
- run: npm test | |
transpile: | |
runs-on: ubuntu-latest | |
container: | |
image: node:lts | |
needs: | |
- test | |
steps: | |
- uses: actions/checkout@v3.3.0 | |
- run: npm install | |
- run: npm install -g typescript | |
- run: tsc -p . | |
- uses: actions/upload-artifact@v3.1.1 | |
with: | |
path: "dist" | |
publish_to_npm: | |
if: github.ref == 'refs/heads/master' | |
runs-on: ubuntu-latest | |
container: | |
image: node:lts | |
needs: | |
- transpile | |
env: | |
DIST_FOLDER: "/dist/artifact" | |
steps: | |
- uses: actions/checkout@v3.3.0 | |
- uses: actions/download-artifact@v3.0.1 | |
with: | |
path: "/dist" | |
- run: cp package.json $DIST_FOLDER | |
- run: cp README.md $DIST_FOLDER | |
- run: npm install | |
- name: Authenticate w/NPM. | |
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_AUTH_TOKEN }}" > .npmrc | |
- name: Publish the library. | |
run: npm publish $DIST_FOLDER |