Skip to content

Commit a0b7a49

Browse files
committed
chore: add keyless auth variant to deploy doc
1 parent 120e124 commit a0b7a49

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

README.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,51 @@ jobs:
8484
channelId: live
8585
```
8686

87+
### Deploy using keyless authentication
88+
89+
Previous options require a service account JSON key to be stored as a string in the repo's "Secrets" area.
90+
You can authenticate vs. Google Cloud without the need for the JSON key using `auth` action:
91+
92+
```yaml
93+
name: Deploy to Live Channel
94+
95+
on:
96+
push:
97+
branches:
98+
- main
99+
# Optionally configure to run only for specific files. For example:
100+
# paths:
101+
# - "website/**"
102+
103+
jobs:
104+
deploy_live_website:
105+
runs-on: ubuntu-latest
106+
steps:
107+
- uses: actions/checkout@v2
108+
- uses: google-github-actions/auth@v2
109+
with:
110+
token_format: 'access_token'
111+
workload_identity_provider: ${{ secrets.FIREBASE_IDENTITY_PROVIDER }}
112+
service_account: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_ID }}
113+
create_credentials_file: true
114+
- name: Read service account JSON into string
115+
run: |
116+
echo "SA_KEY_JSON=$(cat ${{ steps.auth.outputs.credentials_file_path }})" >> $GITHUB_ENV
117+
- uses: FirebaseExtended/action-hosting-deploy@v0
118+
with:
119+
repoToken: "${{ secrets.GITHUB_TOKEN }}"
120+
firebaseServiceAccount: "${{ env.SA_KEY_JSON }}"
121+
projectId: your-Firebase-project-ID
122+
channelId: live
123+
```
124+
125+
The step by step instructions can be found in the [Google Cloud Blog post][blog].
126+
127+
The `FIREBASE_SERVICE_ACCOUNT_ID` should be the email of the `FIREBASE_SERVICE_ACCOUNT` service account.
128+
The `FIREBASE_IDENTITY_PROVIDER` should be the fully qualified resource name of the OIDC identity provider.
129+
130+
[blog]: https://cloud.google.com/blog/products/identity-security/enabling-keyless-authentication-from-github-actions
131+
87132
## Options
88133

89134
### `firebaseServiceAccount` _{string}_ (required)

0 commit comments

Comments
 (0)