refactor #10
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: subosito/[email protected] | |
name: Set up Flutter SDK | |
with: | |
channel: 'stable' | |
cache: true | |
- uses: actions/setup-node@v2 | |
name: Setup Node.js | |
with: | |
node-version: 18 | |
- name: Cache Dependencies | |
uses: actions/cache@v3 | |
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: Print Working Directory | |
run: | | |
echo "Working directory: $(pwd)" | |
- name: Install Firebase CLI | |
run: npm install -g firebase-tools | |
- name: Print Working Directory | |
run: | | |
echo "Working directory: $(pwd)" | |
- name: Prepare Google Application Credentials | |
env: | |
GOOGLE_APPLICATION_CREDENTIALS: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }} | |
run: | | |
echo $GOOGLE_APPLICATION_CREDENTIALS | base64 -di > google-application-credentials.json | |
echo "Credentials file saved at:" | |
pwd | |
ls -la google-application-credentials.json | |
- name: Use Firebase Dev | |
run: | | |
firebase use dev --debug | |
- name: Deploy Firebase functions | |
run: firebase deploy --only functions --non-interactive --debug | |
- name: Remove credentials file | |
if: success() || failure() | |
run: | | |
rm google-application-credentials.json |