Skip to content

chore(deps): bump word-wrap from 1.2.3 to 1.2.4 in /functions #192

chore(deps): bump word-wrap from 1.2.3 to 1.2.4 in /functions

chore(deps): bump word-wrap from 1.2.3 to 1.2.4 in /functions #192

name: Deploy Functions
on:
workflow_dispatch:
inputs:
functions:
description: 'List of functions to run'
default: 'all'
required: true
push:
branches:
- main
paths:
- 'functions/**/*'
- '.github/workflows/functions.workflow.yml'
jobs:
deploy:
timeout-minutes: 15
name: Deploy
runs-on: ubuntu-latest
env:
project: 'jaspero-jms'
steps:
- name: Checkout Repo
uses: actions/checkout@v2
- name: Use Node.js 18.16.0
uses: actions/setup-node@v2
with:
node-version: 18.16.0
- name: Cache dependencies
id: cache
uses: actions/cache@v3
with:
path: |
.github/utils/node_modules
definitions/node_modules
functions/node_modules
key: npm-${{ hashFiles('functions/package-lock.json') }}-${{ hashFiles('definitions/package-lock.json') }}-${{ hashFiles('.github/utils/package-lock.json') }}
- name: Install GitHub Utils Dependencies
if: github.event_name != 'workflow_dispatch' && steps.cache.outputs.cache-hit != 'true'
run: |
npm ci --prefix .github/utils --ignore-scripts
- id: file_changes
if: github.event_name != 'workflow_dispatch'
uses: trilom/[email protected]
- name: Detect file changes
if: github.event_name != 'workflow_dispatch'
id: changes
run: |
echo ::set-output name=CHANGES::$(node ./.github/utils/function-changes.js '${{ steps.file_changes.outputs.files_modified}}' '${{ steps.file_changes.outputs.files_added}}')
- name: Install Definitions Package
if: (steps.changes.outputs.CHANGES || github.event_name == 'workflow_dispatch') && steps.cache.outputs.cache-hit != 'true'
run: npm --prefix definitions ci --ignore-scripts
- name: Prepare Definitions Package
if: steps.changes.outputs.CHANGES || github.event_name == 'workflow_dispatch'
run: |
npm --prefix functions run build:definitions
npm --prefix functions run copy:definitions
- name: Install Firebase Tools
if: steps.changes.outputs.CHANGES || github.event_name == 'workflow_dispatch'
run: npm install firebase-tools
- name: Install Dependencies
if: (steps.changes.outputs.CHANGES || github.event_name == 'workflow_dispatch') && steps.cache.outputs.cache-hit != 'true'
run: npm --prefix functions ci
- name: Build
if: steps.changes.outputs.CHANGES || github.event_name == 'workflow_dispatch'
run: |
npm --prefix functions run build
- name: Set project
if: steps.changes.outputs.CHANGES || github.event_name == 'workflow_dispatch'
run: npm run firebase -- use ${{ env.project }} --token $FIREBASE_TOKEN
env:
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
- name: Deploy Changed Functions
if: steps.changes.outputs.CHANGES
run: npm run firebase -- deploy --only $FILES --token $FIREBASE_TOKEN --force
env:
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
FILES: ${{ steps.changes.outputs.CHANGES }}
- name: Deploy All Functions
if: github.event.inputs.functions == 'all'
run: npm run firebase -- deploy --only functions --token $FIREBASE_TOKEN --force
env:
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
- name: Deploy Some Functions
if: github.event_name == 'workflow_dispatch' && github.event.inputs.functions != 'all'
run: npm run firebase -- deploy --only $FUNCTIONS --token $FIREBASE_TOKEN --force
env:
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
FUNCTIONS: ${{ inputs.functions }}