name: Build and Deploy
on: [push, pull_request]

jobs:
  build:
    name: Build
    runs-on: ubuntu-latest
    steps:
      - name: Checkout Repo
        uses: actions/checkout@master
      - uses: actions/cache@v1
        with:
          path: ~/.npm
          key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
          restore-keys: |
            ${{ runner.os }}-node-
      - name: Install Dependencies
        run: npm install
      - name: Build
        run: npm run build
      - name: Test
        run: npm run test
      - name: Lint
        run: npm run lint
      - name: Prepare Cloud Function
        if: github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/master'
        run: npm run generate
      - name: Deploy to develop Firebase
        if: github.ref == 'refs/heads/develop'
        uses: w9jds/firebase-action@master
        with:
          args: deploy
        env:
          FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
          PROJECT_ID: ${{ secrets.PROJECT_DEV_ID }}
      - name: Deploy to production Firebase
        if: github.ref == 'refs/heads/master'
        uses: w9jds/firebase-action@master
        with:
          args: deploy
        env:
          FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
          PROJECT_ID: ${{ secrets.PROJECT_PROD_ID }}

name: Build and Deploy
on: [push, pull_request]

jobs:
  build:
    name: Build
    runs-on: ubuntu-latest
    steps:
      - name: Checkout Repo
        uses: actions/checkout@master
      - uses: actions/setup-node@v2
        with:
          node-version: 10.20.1
      - uses: actions/cache@v1
        with:
          path: ~/.npm
          key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
          restore-keys: |
            ${{ runner.os }}-node-
      - name: Install Dependencies
        run: npm install
      - name: Build
        run: npm run build
      - name: Test
        run: npm run test
      - name: Lint
        run: npm run lint
      - name: Prepare Cloud Function
        if: github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/master'
        run: npm run generate
      - name: Deploy to develop Firebase
        if: github.ref == 'refs/heads/develop'
        uses: w9jds/firebase-action@master
        with:
          args: deploy
        env:
          FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
          PROJECT_ID: ${{ secrets.PROJECT_DEV_ID }}
      - name: Deploy to production Firebase
        if: github.ref == 'refs/heads/master'
        uses: w9jds/firebase-action@master
        with:
          args: deploy
        env:
          FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
          PROJECT_ID: ${{ secrets.PROJECT_PROD_ID }}

Add setup-node to specify node-version
Add setup-node to specify node-version
