Skip to content

Commit

Permalink
fix(readme): no changes, updating docs for GOOGLE_APPLICATION_CREDENT…
Browse files Browse the repository at this point in the history
…IALS authentication
  • Loading branch information
rhahao authored Sep 21, 2022
1 parent 03d065f commit 87d6702
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 29 deletions.
7 changes: 3 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,20 @@ jobs:
with:
project: github-workflow-sws
env:
GOOGLE_APPLICATION_CREDENTIALS: ${{ secrets.FIREBASE_DEPLOYMENT_GAC }}
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
GOOGLE_APPLICATION_CREDENTIALS: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }}

- name: Test actions for monorepo
uses: ./
with:
project: github-workflow-sws
config: frontend/firebase.json
env:
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
GOOGLE_APPLICATION_CREDENTIALS: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }}

- name: Test actions for with arguments
uses: ./
with:
project: github-workflow-sws
hosting: true
env:
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
GOOGLE_APPLICATION_CREDENTIALS: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }}
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@

# misc
.DS_Store
.env
.env.local
.env.development.local
.env.test.local
.env.production.local
stringify.js

npm-debug.log*
yarn-debug.log*
yarn-error.log*
firebase-debug.log*
firebase-debug.log*
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ A GitHub Action to deploy firebase hosting and functions together.

- Make sure you have the `firebase.json` file in the root repository, or set a custom path to look for it using the `config` input.
- Set the project name in the `project` input.
- Get the Firebase token by running `firebase login:ci` and [store it](https://help.github.com/en/articles/virtual-environments-for-github-actions#creating-and-using-secrets-encrypted-variables) as the `FIREBASE_TOKEN` secret
- Get a Service Account in JSON format by following the [Google Cloud's Getting started](https://cloud.google.com/docs/authentication/getting-started) guide. Stringify the JSON content and [store it](https://help.github.com/en/articles/virtual-environments-for-github-actions#creating-and-using-secrets-encrypted-variables) as the `GOOGLE_APPLICATION_CREDENTIALS` secret in your repository.
- **DEPRECATED: We will remove this authentication method when the Firebase CLI no longer supports it.** Get the Firebase token by running `firebase login:ci` and [store it](https://help.github.com/en/articles/virtual-environments-for-github-actions#creating-and-using-secrets-encrypted-variables) as the `FIREBASE_TOKEN` secret.

## Example Usage

Expand All @@ -30,5 +31,6 @@ jobs:
hosting: true #optional & boolean
project: 'my-firebase-project' #required
env:
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
GOOGLE_APPLICATION_CREDENTIALS: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }}
#FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }} (this will be removed)
```
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 15 additions & 20 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,24 @@ import core from '@actions/core';
import exec from '@actions/exec';

const run = async () => {
try {
// preflight check before starting the actions
const project = core.getInput('project');
if (!project) {
core.setFailed('The Firebase project is missing from the worflow file');
return;
}

if (!process.env.FIREBASE_TOKEN) {
core.setFailed('The FIREBASE_TOKEN is missing');
return;
}
// preflight check before starting the actions
const project = core.getInput('project');
if (!project) {
core.setFailed('The Firebase project is missing from the worflow file');
return;
}

// check if we receive a custom path for firebase.json
const config = core.getInput('config');
// check if we receive a custom path for firebase.json
const config = core.getInput('config');

// check only deployment settings
let deployOnly = core.getInput('function') === 'true' ? 'function' : '';
deployOnly +=
core.getInput('hosting') === 'true'
? `${deployOnly !== '' ? ' ' : ''}hosting`
: '';
// check only deployment settings
let deployOnly = core.getInput('function') === 'true' ? 'function' : '';
deployOnly +=
core.getInput('hosting') === 'true'
? `${deployOnly !== '' ? ' ' : ''}hosting`
: '';

try {
// installing firebase tools
await exec.exec('npm i -g firebase-tools');

Expand Down

0 comments on commit 87d6702

Please sign in to comment.