ci(cd): Firebase デプロイを OIDC + Workload Identity Federation に移行#72
Conversation
Replace the long-lived FIREBASE_TOKEN auth with keyless Workload Identity Federation. Both CD workflows now authenticate to Google Cloud via google-github-actions/auth (impersonating a per-project deploy service account) and let the Firebase CLI use ADC, so no long-lived secret is needed. - Add `id-token: write` permission for OIDC token retrieval - Add the auth step (pinned to a full commit SHA) before deploy - Drop `firebase use --token` / `firebase deploy --token`; deploy with `--project <alias> --non-interactive` and ADC - Read WIF_PROVIDER / DEPLOY_SERVICE_ACCOUNT / GCP_PROJECT_ID from per-environment GitHub Variables - Document the CD/WIF setup in CLAUDE.md Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Caution Review failedPull request was closed or merged during review No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThis PR migrates the testnet and mainnet Firebase deployment workflows from secret token authentication to keyless OIDC-based Google Cloud authentication via workload identity federation. Both workflows are updated with new permissions and authentication steps, with supporting documentation added to CLAUDE.md. ChangesKeyless OIDC/WIF Deployment Migration
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
GitHub Actions の Firebase デプロイ認証を、長期シークレット FIREBASE_TOKEN による --token 認証から、OIDC + Workload Identity Federation(WIF)を使った短命・キーレス認証(google-github-actions/auth + ADC)へ移行する PR です。
Changes:
- CD ワークフロー(testnet/mainnet)に
permissions: id-token: writeを追加し、WIF による OIDC 認証を有効化 google-github-actions/authを追加し、FIREBASE_TOKEN/--token依存を廃止してfirebase deploy --project <alias> --non-interactive --forceに移行CLAUDE.mdに CD/WIF 運用の説明を追記
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| CLAUDE.md | CD の認証方式(OIDC + WIF)と必要な GitHub Environment Variables/permissions を追記 |
| .github/workflows/cd-firebase-testnet.yml | testnet デプロイを WIF 認証(auth action + ADC)へ移行し、--token を廃止 |
| .github/workflows/cd-firebase-mainnet.yml | mainnet デプロイを WIF 認証(auth action + ADC)へ移行し、--token を廃止 |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
概要
GitHub Actions の Firebase デプロイを、長期有効な
FIREBASE_TOKENから OIDC + Workload Identity Federation(キーレス・短命認証) に移行します。--token認証は firebase-tools で deprecated 済みであり、FIREBASE_TOKENは失効しない長期シークレットで漏洩時のリスク(本番含む)が大きいため、google-github-actions/authでデプロイ用サービスアカウントを impersonation し、Firebase CLI を ADC(GOOGLE_APPLICATION_CREDENTIALS)で動かす方式に変更します。このPRの変更(コード側)
cd-firebase-testnet.yml/cd-firebase-mainnet.ymlpermissionsにid-token: writeを追加(OIDC トークン取得に必須)google-github-actions/auth(full commit SHA でピン留め:v3.0.0)を追加firebase use --token/firebase deploy --tokenを廃止し、firebase deploy --project <alias> --non-interactive --forceに変更WIF_PROVIDER/DEPLOY_SERVICE_ACCOUNT/GCP_PROJECT_ID)から参照CLAUDE.mdに CD/WIF の説明を追記マージ前に必要な GCP / GitHub 側の設定(このPRには含まれない手動作業)
GCP(testnet=
nemtus-hackathon-test/ mainnet=nemtus-hackathonの各プロジェクト)iamcredentials/sts/iam/cloudresourcemanagergithub-actionsを作成github(issuerhttps://token.actions.githubusercontent.com、attribute-conditionassertion.repository == 'nemtus/hackathon')を作成github-deployer@<project>.iam.gserviceaccount.comを作成firebase.admin/iam.serviceAccountUser/cloudfunctions.admin/artifactregistry.admin/cloudbuild.builds.editor/serviceusage.serviceUsageConsumerattribute.repository/nemtus/hackathon)にroles/iam.workloadIdentityUserを付与GitHub(Environment
testnet/mainnetの Variables)WIF_PROVIDER=projects/<PROJECT_NUMBER>/locations/global/workloadIdentityPools/github-actions/providers/githubDEPLOY_SERVICE_ACCOUNT=github-deployer@<project>.iam.gserviceaccount.comGCP_PROJECT_ID= 各プロジェクトID検証
cd-firebase-testnetを手動実行しauth→firebase deploy(hosting/functions/firestore/storage)成功を確認cd-firebase-mainnetを手動実行で確認FIREBASE_TOKENsecret を削除🤖 Generated with Claude Code
Summary by CodeRabbit
Release Notes
Chores
Documentation