Skip to content

Commit

Permalink
Add the ability to inject env variables through .env file creation (#85)
Browse files Browse the repository at this point in the history
# Add the ability to inject env variables through .env file creation

## ♻️ Current situation & Problem
#82 aims to achieve the same
effect. We need to do it through `.env` file creation, because otherwise
values aren't properly propagated to build process.


## ⚙️ Release Notes 
* Add the ability to inject env variables through .env file creation


## ✅ Testing
I updated created test deployment of Web-Frontend successfully with this
branch.


### Code of Conduct & Contributing Guidelines 

By submitting creating this pull request, you agree to follow our [Code
of
Conduct](https://github.com/StanfordBDHG/.github/blob/main/CODE_OF_CONDUCT.md)
and [Contributing
Guidelines](https://github.com/StanfordBDHG/.github/blob/main/CONTRIBUTING.md):
- [x] I agree to follow the [Code of
Conduct](https://github.com/StanfordBDHG/.github/blob/main/CODE_OF_CONDUCT.md)
and [Contributing
Guidelines](https://github.com/StanfordBDHG/.github/blob/main/CONTRIBUTING.md).
  • Loading branch information
arkadiuszbachorski authored Sep 15, 2024
1 parent 82eb188 commit 5ca36c4
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/firebase-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,22 @@ on:
required: false
type: string
default: ''
workingDirectory:
description: 'The workingDirectory of the GitHub Action. Defaults to $GITHUB_WORKSPACE'
required: false
type: string
default: '.'
secrets:
GOOGLE_APPLICATION_CREDENTIALS_BASE64:
description: |
The Base64 version of the private key JSON file for the service account.
You can lean more about how to generate the JSON at https://cloud.google.com/iam/docs/service-accounts-create.
The service account must have the minimally required permissions documented at https://firebase.google.com/docs/projects/iam/permissions.
required: true
ENV_FILE:
description: |
.env file that is injected in the build context before doing the firebase deployment.
required: false

jobs:
deployfirebase:
Expand All @@ -75,6 +84,12 @@ jobs:
java-version: '17'
- name: Install Firebase CLI Tools
run: npm install -g firebase-tools
- name: Create .env file
env:
env-file: ${{ secrets.ENV_FILE }}
if: ${{ env.env-file != '' }}
run: |
echo "${{ env.env-file }}" > ${{ inputs.workingDirectory }}/.env
- name: Run custom command
if: ${{ inputs.customcommand != '' }}
run: ${{ inputs.customcommand }}
Expand Down

0 comments on commit 5ca36c4

Please sign in to comment.