Skip to content

Commit e3fb1c2

Browse files
committed
chore: add keyless auth variant to deploy doc
1 parent 7a831e3 commit e3fb1c2

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
@@ -83,6 +83,51 @@ jobs:
8383
channelId: live
8484
```
8585

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

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

0 commit comments

Comments
 (0)