Skip to content

Fixing dependencies #13

Fixing dependencies

Fixing dependencies #13

Workflow file for this run

name: Build and deploy
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
test:
name: Testing
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
type:
- unit
- e2e
timeout-minutes: 30
env:
WEBHOOK_URL_GOOGLE_CHAT: ${{ secrets.WEBHOOK_URL_GOOGLE_CHAT }}
WEBHOOK_URL_SLACK: ${{ secrets.WEBHOOK_URL_SLACK }}
steps:
- uses: actions/checkout@v4
name: Checkout code
- uses: actions/setup-node@v4
with:
node-version: 18
cache: npm
cache-dependency-path: functions/package-lock.json
- name: Install global NPM tools
run: |
npm install -g firebase-tools@latest
firebase --version
- run: npm ci --prefix functions # Use npm ci for faster installs
- run: npm run build --prefix functions
- name: Run testing
run: npm run test:${{ matrix.type }} --prefix functions
publish:
name: Publish
needs: test
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
name: Checkout code
- uses: actions/setup-node@v4
with:
node-version: 18
cache: npm
cache-dependency-path: functions/package-lock.json
- name: Install global NPM tools
run: |
npm install -g firebase-tools@latest
firebase --version
# The variable `FIREBASE_SA` must be a base64 encoded string
# of the service account JSON to avoid problems with quote escaping and
# conversion of '\n' characters generating invalid JSON
- name: Set service account for Firebase CLI
run: |
echo "GOOGLE_APPLICATION_CREDENTIALS=$(pwd)/service_account.json" >> $GITHUB_ENV
echo ${{ secrets.FIREBASE_SA }} | base64 -d -i - > service_account.json
- run: npm ci --prefix functions
- run: npm run build --prefix functions
- run: >-
firebase ext:dev:upload
--repo https://github.com/oddbit/firebase-alerts
--force
oddbit/firebase-alerts
# Try to save potential log files if something went wrong
- name: Upload debug log
uses: actions/upload-artifact@v4
if: ${{ failure() }}
with:
name: debug-log-functions
path: firebase-debug.log
if-no-files-found: ignore