name: ganache-cli CD

on:
  push:
    branches: [ master, beta, alpha ]

jobs:
  release:
    runs-on: ubuntu-18.04
    steps:
    - uses: actions/checkout@v2
    - uses: actions/setup-node@v1
      with:
        node-version: '10'

    - name: Apply workaround for git:// packages
      run: git config --global url.https://github.com/.insteadOf ssh://git@github.com/

    - name: Install
      run: npm ci

    - name: Build
      run: npm run build

    - name: Release
      env:
        NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
        GH_TOKEN:  ${{ secrets.GITHUB_TOKEN }}
        NPM_OTP_KEY: ${{ secrets.NPM_OTP_KEY }}
      run: npm run otp && npx semantic-release
