# 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: Node.js CI

on:
  push:
    branches: [ master, develop ]
  pull_request:
    branches: [ master, develop ]

jobs:
  build:

    runs-on: ubuntu-latest

    strategy:
      matrix:
        node-version: [10.x, 12.x]

    steps:
    - uses: actions/checkout@v2
    - name: Use Node.js ${{ matrix.node-version }}
      uses: actions/setup-node@v1
      with:
        node-version: ${{ matrix.node-version }}
    - run: npm ci
    - run: npm run build --if-present
    - run: npm test
      env:
        CI: true
  
  publish:

    needs: build

    runs-on: ubuntu-latest

    steps:
    - name: Deploy to GitHub Pages
      if: success()
      uses: crazy-max/ghaction-github-pages@v2
      with:
        build_dir: dist
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# 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: Node.js CI

on:
  push:
    branches: [ master, develop ]
  pull_request:
    branches: [ master, develop ]

jobs:
  build:

    runs-on: ubuntu-latest

    strategy:
      matrix:
        node-version: [12.x]

    steps:
    - uses: actions/checkout@v2
    - name: Use Node.js ${{ matrix.node-version }}
      uses: actions/setup-node@v1
      with:
        node-version: ${{ matrix.node-version }}
    - run: npm ci
    - run: npm run build --if-present
    - run: npm test
      env:
        CI: true
    - name: Upload build directory for publishing
      uses: actions/upload-artifact@v1
      with:
        name: dist-folder
        path: dist/

  publish:

    needs: build

    runs-on: ubuntu-latest

    steps:
    - name: Download dist folder
        uses: actions/download-artifact@v1
        with:
          name: dist-folder
    - name: Deploy to GitHub Pages
      if: success()
      uses: crazy-max/ghaction-github-pages@v2
      with:
        build_dir: dist
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Use artifacts to transfer build between jobs
Use artifacts to transfer build between jobs
