Skip to content

Bump serve-static and express #255

Bump serve-static and express

Bump serve-static and express #255

name: Deploy to Firebase Hosting on PR
on: pull_request
permissions:
checks: write
contents: read
pull-requests: write
env:
HOSTING_ENV: ${{ vars.HOSTING_ENV_DEV }}
jobs:
code_check:
name: Code check
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 20
cache: "npm"
cache-dependency-path: |
shared/package-lock.json
hosting/package-lock.json
functions/package-lock.json
- name: Run code checking and formatting (shared)
run: npm ci && npm run codecheck
working-directory: ./shared
- name: Run code checking and formatting (functions)
run: npm ci && npm run codecheck
working-directory: ./functions
- name: Run code checking and formatting (hosting)
run: npm ci && npm run codecheck
working-directory: ./hosting
- name: Ensure code is unchanged
run: git diff --exit-code
build_and_deploy:
name: Build and deploy
needs: code_check
if: ${{ github.event.pull_request.head.repo.full_name == github.repository }}
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 20
cache: "npm"
cache-dependency-path: |
shared/package-lock.json
hosting/package-lock.json
functions/package-lock.json
- name: Cache build
uses: actions/cache@v4
with:
path: |
hosting/.next/cache
# Generate a new cache whenever packages or source files change.
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx') }}
# If source files changed but packages didn't, rebuild from a prior cache.
restore-keys: |
${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-
- name: Set hosting environment
run: echo $HOSTING_ENV > hosting/.env
- name: Build shared code
run: npm ci && npm run build
working-directory: ./shared
- name: Build functions code
run: npm ci && npm run build
working-directory: ./functions
- name: Build web application
run: npm ci && npm run build
working-directory: ./hosting
- uses: FirebaseExtended/action-hosting-deploy@v0
env:
FIREBASE_CLI_EXPERIMENTS: webframeworks
with:
repoToken: ${{ secrets.GITHUB_TOKEN }}
firebaseServiceAccount: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_TANAM_TESTING }}
projectId: tanam-testing
expires: 7d