Skip to content

Commit 87d6702

Browse files
authored
fix(readme): no changes, updating docs for GOOGLE_APPLICATION_CREDENTIALS authentication
1 parent 03d065f commit 87d6702

File tree

5 files changed

+27
-29
lines changed

5 files changed

+27
-29
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,21 +29,20 @@ jobs:
2929
with:
3030
project: github-workflow-sws
3131
env:
32-
GOOGLE_APPLICATION_CREDENTIALS: ${{ secrets.FIREBASE_DEPLOYMENT_GAC }}
33-
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
32+
GOOGLE_APPLICATION_CREDENTIALS: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }}
3433

3534
- name: Test actions for monorepo
3635
uses: ./
3736
with:
3837
project: github-workflow-sws
3938
config: frontend/firebase.json
4039
env:
41-
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
40+
GOOGLE_APPLICATION_CREDENTIALS: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }}
4241

4342
- name: Test actions for with arguments
4443
uses: ./
4544
with:
4645
project: github-workflow-sws
4746
hosting: true
4847
env:
49-
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
48+
GOOGLE_APPLICATION_CREDENTIALS: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }}

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,14 @@
1010

1111
# misc
1212
.DS_Store
13+
.env
1314
.env.local
1415
.env.development.local
1516
.env.test.local
1617
.env.production.local
18+
stringify.js
1719

1820
npm-debug.log*
1921
yarn-debug.log*
2022
yarn-error.log*
21-
firebase-debug.log*
23+
firebase-debug.log*

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ A GitHub Action to deploy firebase hosting and functions together.
77

88
- 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.
99
- Set the project name in the `project` input.
10-
- 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
10+
- 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.
11+
- **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.
1112

1213
## Example Usage
1314

@@ -30,5 +31,6 @@ jobs:
3031
hosting: true #optional & boolean
3132
project: 'my-firebase-project' #required
3233
env:
33-
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
34+
GOOGLE_APPLICATION_CREDENTIALS: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }}
35+
#FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }} (this will be removed)
3436
```

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/index.js

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,24 @@ import core from '@actions/core';
33
import exec from '@actions/exec';
44

55
const run = async () => {
6-
try {
7-
// preflight check before starting the actions
8-
const project = core.getInput('project');
9-
if (!project) {
10-
core.setFailed('The Firebase project is missing from the worflow file');
11-
return;
12-
}
13-
14-
if (!process.env.FIREBASE_TOKEN) {
15-
core.setFailed('The FIREBASE_TOKEN is missing');
16-
return;
17-
}
6+
// preflight check before starting the actions
7+
const project = core.getInput('project');
8+
if (!project) {
9+
core.setFailed('The Firebase project is missing from the worflow file');
10+
return;
11+
}
1812

19-
// check if we receive a custom path for firebase.json
20-
const config = core.getInput('config');
13+
// check if we receive a custom path for firebase.json
14+
const config = core.getInput('config');
2115

22-
// check only deployment settings
23-
let deployOnly = core.getInput('function') === 'true' ? 'function' : '';
24-
deployOnly +=
25-
core.getInput('hosting') === 'true'
26-
? `${deployOnly !== '' ? ' ' : ''}hosting`
27-
: '';
16+
// check only deployment settings
17+
let deployOnly = core.getInput('function') === 'true' ? 'function' : '';
18+
deployOnly +=
19+
core.getInput('hosting') === 'true'
20+
? `${deployOnly !== '' ? ' ' : ''}hosting`
21+
: '';
2822

23+
try {
2924
// installing firebase tools
3025
await exec.exec('npm i -g firebase-tools');
3126

0 commit comments

Comments
 (0)