name: Publish to GitHub Package Registry

on: [push]

jobs:
  build:

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v1
    - name: Use Node.js 16.x
      uses: actions/setup-node@v1
      with:
        registry-url: https://npm.pkg.github.com/
        node-version: 16.x
        scope: '@kishiman'
    - name: npm install, build, and test
      run: |
        npm install
        npm run build --if-present
        npm test      
    - name: publish
      run: |
        echo "//registry.npmjs.org/:_authToken=\${{ secrets.PERSONAL_ACCESS_TOKEN }}" > ~/.npmrc
        npm run deploy
