Skip to content

INFRA16 - run Lighthouse against both mobile and desktop (#265) #83

INFRA16 - run Lighthouse against both mobile and desktop (#265)

INFRA16 - run Lighthouse against both mobile and desktop (#265) #83

name: Build and Deploy Firebase Functions
on:
push:
branches: [ "main"]
workflow_dispatch:
jobs:
deploy:
permissions:
contents: 'read'
id-token: 'write'
runs-on: ubuntu-latest
environment: demo
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- uses: pnpm/action-setup@v3
name: Install pnpm
with:
version: 9
run_install: false
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- run: cd functions && pnpm install --no-frozen-lockfile
- name: Make envfile for functions
uses: SpicyPizza/[email protected]
with:
envkey_PUBLIC_FIREBASE_CONFIG: ${{ secrets.FIREBASE_CONFIG }}
envkey_PUBLIC_FIREBASE_SERVICE_ACCOUNT: ${{ secrets.FIREBASE_SERVICE_ACCOUNT }}
envkey_PUBLIC_FIREBASE_STORAGE_BUCKET: ${{secrets.FIREBASE_STORAGE_BUCKET}}
envkey_PUBLIC_FIREBASE_FUNCTIONS_REGION: ${{ vars.REGION }}
file_name: .env
directory: functions
- name: Make envfile
uses: SpicyPizza/[email protected]
with:
envkey_PUBLIC_FIREBASE_CONFIG: ${{ secrets.FIREBASE_CONFIG }}
envkey_PUBLIC_FIREBASE_SERVICE_ACCOUNT: ${{ secrets.FIREBASE_SERVICE_ACCOUNT }}
envkey_PUBLIC_FIREBASE_STORAGE_BUCKET: ${{secrets.FIREBASE_STORAGE_BUCKET}}
envkey_PUBLIC_FIREBASE_FUNCTIONS_REGION: ${{ vars.REGION }}
file_name: .env
- run: cd functions && pnpm run build
- run: pnpm install -g firebase-tools
- run: firebase use ${{ vars.PROJECT_ID }} --token ${{ secrets.FIREBASE_TOKEN }}
- run: firebase deploy --only functions --token ${{ secrets.FIREBASE_TOKEN }}