# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: CFA Release

on:
  push:
    branches: [ master ]

jobs:
  build:
    runs-on: ubuntu-latest
        # See supported Node.js release schedule at https://nodejs.org/en/about/releases/

    steps:
    - name: Checkout repository
      uses: actions/checkout@v2
      with: 
        persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token
        fetch-depth: 0 # otherwise, you will failed to push refs to dest repo
    - name: Setup node
      uses: actions/setup-node@v2
      with:
        node-version: '14.x'
    - name: Install yarn and build
      run: |
        yarn
        tsc
    - name:  'Automated Version Bump'
      uses:  'phips28/gh-action-bump-version@master'
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      with:
        skip-tag:  'true'
    - name: Publish new version
      uses: JS-DevTools/npm-publish@v1
      with:
        token: ${{ secrets.NPM_TOKEN }}
