name: "build-test"
on:
  push:

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v1
    - name: Cached install
      uses: bahmutov/npm-install@v1.1.0
    - name: Test
      run: yarn test
  build:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v1
    - name: Cached install
      uses: bahmutov/npm-install@v1.1.0
    - name: Build
      run: yarn build
    - name: Upload Build
      uses: actions/upload-artifact@v1
      with:
        name: build
        path: build
  release:
    if: github.ref == 'refs/heads/master'
    runs-on: ubuntu-latest
    needs:
    - test
    - build
    steps:
    - name: Download Build
      uses: actions/download-artifact@v1
      with:
        name: build
        path: build
    - name: Upload Build to S3
      run: |
        aws s3 cp --recursive build s3://pi-base-viewer
      env:
        AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
        AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

name: "build-test"
on:
  push:

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v1
    - name: Cached install
      uses: bahmutov/npm-install@v1.1.0
    - name: Test
      run: yarn test
  build:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v1
    - name: Cached install
      uses: bahmutov/npm-install@v1.1.0
    - name: Build
      run: yarn build
      env:
        REACT_APP_BUNDLE_HOST: https://pi-base-bundles.s3.us-east-2.amazonaws.com
    - name: Upload Build
      uses: actions/upload-artifact@v1
      with:
        name: build
        path: build
  release:
    if: github.ref == 'refs/heads/master'
    runs-on: ubuntu-latest
    needs:
    - test
    - build
    steps:
    - name: Download Build
      uses: actions/download-artifact@v1
      with:
        name: build
        path: build
    - name: Upload Build to S3
      run: |
        aws s3 cp --recursive --acl public-read build s3://pi-base-viewer
      env:
        AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
        AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

Set bundle host to S3 at build time; upload files as public
Set bundle host to S3 at build time; upload files as public
