name: CI - Main App

on:
  push:
    branches: [ master ]
    paths:
      - "main/**"

jobs:

  build:
    name: Firebase Deploy
    runs-on: ubuntu-latest

    steps:
      - name: Checkout Repo
        uses: actions/checkout@master

      - name: Setup Node
        uses: actions/setup-node@master
        with:
          node-version: '12.x'

      - name: Install Dependencies
        working-directory: ./main
        run: npm install

      - name: Build
        working-directory: ./main
        run: npm run build:prod

      - name: Deploy to Firebase
        uses: w9jds/firebase-action@master
        with:
          args: deploy --only hosting
        env:
          FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
          PROJECT_ID: "default"
          PROJECT_PATH: "./main"
