name: gh-pages

on:
  push:
    branches:
      - master

jobs:
  build-and-deploy:
    runs-on: ubuntu-18.04
    steps:
      - uses: actions/checkout@v2

      - name: Setup deno
        uses: denolib/setup-deno@v2
        with:
          deno-version: v1.16.0

      - name: Build gh-pages
        run: |
          deno --version
          deno install -qAn vr https://deno.land/x/velociraptor@1.3.0/cli.ts
          vr install:gustwind
          vr build:site

      - name: Deploy gh-pages
        uses: peaceiris/actions-gh-pages@v3
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          publish_dir: ./public
name: gh-pages

on:
  push:
    branches:
      - master

jobs:
  build-and-deploy:
    runs-on: ubuntu-18.04
    steps:
      - uses: actions/checkout@v2

      - name: Setup deno
        uses: denolib/setup-deno@v2
        with:
          deno-version: v1.16.0

      - name: Build gh-pages
        run: |
          deno --version
          deno install -qAn vr https://deno.land/x/velociraptor@1.3.0/cli.ts
          vr install:gustwind
          vr build:site

      - name: Deploy gh-pages
        uses: peaceiris/actions-gh-pages@v3
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          publish_dir: ./public

      - name: Get tag version
        if: startsWith(github.ref, 'refs/tags/')
        id: get_tag_version
        run: echo ::set-output name=TAG_VERSION::${GITHUB_REF/refs\/tags\//}

      - uses: actions/setup-node@v2
        with:
          node-version: '16.x'
          registry-url: 'https://registry.npmjs.org'

      - name: npm build
        run: vr build ${{steps.get_tag_version.outputs.TAG_VERSION}}

      - name: npm publish
        uses: mmarchini-oss/npm-otp-publish@v0
        if: startsWith(github.ref, 'refs/tags/')
        with:
          npm_token: ${{ secrets.NPM_TOKEN }}
          github_token: ${{ secrets.GITHUB_TOKEN }}
          github_actor: ${{ github.actor }}
        run: |
          cd npm
          npm publish

Set up a publish script
chore: Set up a publish script
