name: Publish
on:
  push:
    branches:
      - 'master'


jobs:
  publish:
    runs-on: ubuntu-18.04
    strategy:
      matrix:
        node-version: [12]
    steps:
      - name: Checkout
        uses: actions/checkout@v2
        with:
          fetch-depth: 0        
      - uses: actions/setup-node@v1
        with:
          node-version: ${{ matrix.node-version }}
      - name: Get yarn cache
        id: yarn-cache
        run: echo "::set-output name=dir::$(yarn cache dir)"
      - uses: actions/cache@v2
        with:
          path: ${{ steps.yarn-cache.outputs.dir }}
          key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
      - name: Install Dependencies
        run: yarn
      - name: Publish Package
        run: yarn ci:publish
        env:
          GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
          NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
