Skip to content

Merge pull request #2481 from davidkassa/dependabot/npm_and_yarn/deve… #466

Merge pull request #2481 from davidkassa/dependabot/npm_and_yarn/deve…

Merge pull request #2481 from davidkassa/dependabot/npm_and_yarn/deve… #466

name: Deploy Staging
on:
workflow_dispatch:
push:
branches:
- develop
schedule:
- cron: "0 3 20 * *"
# https://ashishb.net/tech/common-pitfalls-of-github-actions/
jobs:
build_and_deploy:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
runs-on: ubuntu-latest
steps:
- name: Setup Node.js environment
uses: actions/setup-node@v3
with:
# Version Spec of the version to use. Examples: 12.x, 10.15.1, >=10.15.0
node-version: 18
- name: Checkout
uses: actions/checkout@v3
# /~https://github.com/actions/cache/blob/main/examples.md#node---npm
- name: Get npm cache directory
id: npm-cache-dir
shell: bash
run: echo "dir=$(npm config get cache)" >> ${GITHUB_OUTPUT}
- uses: actions/cache@v3
id: npm-cache # use this to check for `cache-hit` ==> if: steps.npm-cache.outputs.cache-hit != 'true'
with:
path: ${{ steps.npm-cache-dir.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Build
run: |
npm ci
cd ./functions && npm ci && cd ..
npm run test:unit
npm run build-staging
- name: Deploy
run: |
npm i -g firebase-tools
firebase deploy --token ${{ secrets.FIREBASE_DEPLOY_KEY }} --project staging
# Doesn't support Node 14: /~https://github.com/w9jds/firebase-action/issues/83
#uses: w9jds/firebase-action@v2.0.0
#with:
# args: deploy --project staging
#env:
# FIREBASE_TOKEN: ${{ secrets.FIREBASE_DEPLOY_KEY }}