# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages

name: FHIR.ts Publish

on:
  push:
    branches: 
      - main
    paths-ignore:
      - '**.md'
      - '**.yml'

jobs:
  release:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-node@v1
        with:
          node-version: 12
          registry-url: https://registry.npmjs.org
      - name: Install Dependencies 
        run: npm install
      - name: Run audit
        run: npm run audit
      - name: Compile Typescript
        run: npm run-script build
      - name: Run test with coverage
        run: npm run-script coverage
      - name: Publish to NPM
        run: npm publish --access public
        env:
          NODE_AUTH_TOKEN: ${{secrets.NPM_AUTH_TOKEN}}

