cmp content #61
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy Firebase Function | |
on: push | |
# push: | |
# branches: | |
# - main | |
# workflow_dispatch: | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
name: Checkout | |
- uses: actions/setup-node@v4 | |
name: Setup Node.js | |
with: | |
node-version: 20 | |
- uses: actions/cache@v4 | |
name: Cache Dependencies | |
id: cache-dependencies | |
with: | |
path: | | |
~/.npm | |
~/.cache/firebase | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- name: Install Dependencies | |
working-directory: khelo/functions | |
run: | | |
npm ci | |
- name: Install Firebase CLI | |
run: npm install -g firebase-tools | |
- name: Prepare Google Application Credentials | |
env: | |
GOOGLE_APPLICATION_CREDENTIALS: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }} | |
FIREBASE_JSON_BASE64: ${{ secrets.FIREBASE_JSON_BASE64 }} | |
run: | | |
cd khelo | |
echo $GOOGLE_APPLICATION_CREDENTIALS | base64 --decode > functions/google-application-credentials.json | |
echo $FIREBASE_JSON_BASE64 | base64 --decode > firebase.json | |
- name: Print Contents | |
run: | | |
cd khelo | |
cat functions/google-application-credentials.json | |
- name: Deploy Firebase functions | |
run: | | |
cd khelo/functions | |
echo google-application-credentials.json | |
firebase deploy --only functions --debug | |
- name: Remove credentials file | |
if: success() || failure() | |
run: | | |
cd khelo | |
rm functions/google-application-credentials.json |