Skip to content

Instantly share code, notes, and snippets.

@calebdeji
Last active July 4, 2021 08:05
Firebase functions deployment without custom env variables
name: Deploy
# Controls when the workflow will run
'on':
#triggers the workflow whenever a push is made to the main branch
push:
branches:
- main
jobs:
#this workfloe has only one job
deploy_to_production:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
# this install the dependencies specified in your package.json file into the current workflow
- name: install dependencies
# navigates to your functions folder and install the dependencies
run: cd functions/ && npm install
# If your firebase cloud functions project uses firebase-admin
# you need to create a config file used to initialize your project
# the below task creates a config.json file in your functions directory
- name: create config json
uses: jsdaniell/create-json@1.1.2
id: create-config-json
with:
name: 'config.json'
json: '{"type": "${{ secrets.TYPE }}","auth_uri": "${{ secrets.AUTH_URI }}","auth_provider_x509_cert_url": "${{ secrets.AUTH_PROVIDER_X509_CERT_URL }}","private_key_id": "${{ secrets.PRIVATE_KEY_ID }}","project_id": "${{ secrets.PROJECT_ID }}","private_key": "${{ secrets.PRIVATE_KEY }}","token_uri": "${{ secrets.TOKEN_URI }}", "client_email": "${{ secrets.CLIENT_EMAIL }}","client_x509_cert_url": "${{ secrets.CLIENT_X509_CERT_URL }}","client_id": "${{ secrets.CLIENT_ID }}"}'
dir: 'functions/'
# The below task uses the w9jds/firebase-action@master action with the appropriate argument
# to deploy your firebase cloud functions.
- name: deploy to production
uses: w9jds/firebase-action@master
with:
args: deploy --only functions
env:
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment