-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: workflow authentication using service account key
- Loading branch information
Showing
1 changed file
with
22 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,17 +23,17 @@ jobs: | |
security-events: write | ||
statuses: write | ||
steps: | ||
- name: Checkout actions-oidc-debugger | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: github/actions-oidc-debugger | ||
ref: main | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
path: ./.github/actions/actions-oidc-debugger | ||
- name: Debug OIDC Claims | ||
uses: ./.github/actions/actions-oidc-debugger | ||
with: | ||
audience: 'projects/970886652672/locations/global/workloadIdentityPools/dev-ci-pool/providers/my-repo-oidc' | ||
# - name: Checkout actions-oidc-debugger | ||
# uses: actions/checkout@v4 | ||
# with: | ||
# repository: github/actions-oidc-debugger | ||
# ref: main | ||
# token: ${{ secrets.GITHUB_TOKEN }} | ||
# path: ./.github/actions/actions-oidc-debugger | ||
# - name: Debug OIDC Claims | ||
# uses: ./.github/actions/actions-oidc-debugger | ||
# with: | ||
# audience: 'projects/970886652672/locations/global/workloadIdentityPools/dev-ci-pool/providers/my-repo-oidc' | ||
- uses: actions/checkout@v4 | ||
- name: Use Node.js | ||
uses: actions/setup-node@v4 | ||
|
@@ -43,25 +43,25 @@ jobs: | |
run: echo "FIREBASE_PROJECT=$(if [ ${{ github.ref }} == 'refs/heads/main' ]; then echo 'prod'; else echo 'dev'; fi)" >> $GITHUB_ENV | ||
- name: Set correct GCP project | ||
run: echo "GCP_PROJECT_FOR_BRANCH=$(if [ ${{ github.ref }} == 'refs/heads/main' ]; then echo 'weatherkids-f85f4'; else echo 'weatherkids-dev-67016'; fi)" >> $GITHUB_ENV | ||
- id: 'auth' | ||
name: 'Authenticate to Google Cloud' | ||
uses: 'google-github-actions/auth@v2' | ||
with: | ||
project_id: ${{ env.GCP_PROJECT_FOR_BRANCH }} | ||
workload_identity_provider: 'projects/970886652672/locations/global/workloadIdentityPools/dev-ci-pool/providers/my-repo-oidc' | ||
service_account: '[email protected]' | ||
# - id: 'auth' | ||
# name: 'Authenticate to Google Cloud' | ||
# uses: 'google-github-actions/auth@v2' | ||
# with: | ||
# project_id: ${{ env.GCP_PROJECT_FOR_BRANCH }} | ||
# workload_identity_provider: 'projects/970886652672/locations/global/workloadIdentityPools/dev-ci-pool/providers/my-repo-oidc' | ||
# service_account: '[email protected]' | ||
- name: Install dependencies. | ||
run: npm ci | ||
- name: Build | ||
run: npm run build | ||
- name: Extract GCP Service Account Credentials | ||
run: | | ||
echo "SERVICE_ACCOUNT_KEY=$(cat "${{ steps.auth.outputs.credentials_file_path }}" | tr -d '\n')" >> $GITHUB_ENV | ||
# - name: Extract GCP Service Account Credentials | ||
# run: | | ||
# echo "SERVICE_ACCOUNT_KEY=$(cat "${{ steps.auth.outputs.credentials_file_path }}" | tr -d '\n')" >> $GITHUB_ENV | ||
- name: Deploy to firebase cloud functions. | ||
uses: w9jds/[email protected] | ||
with: | ||
args: deploy --only functions --project ${{ env.FIREBASE_PROJECT }} | ||
env: | ||
MOBILE_CLIENT_ID: ${{ secrets.MOBILE_CLIENT_ID }} | ||
WEATHERCOM_CLIENT_ID: ${{ secrets.WEATHERCOM_CLIENT_ID }} | ||
GCP_SA_KEY: ${{ env.SERVICE_ACCOUNT_KEY }} | ||
GCP_SA_KEY: ${{ secrets.GITHUBDEPLOY_GCP_SERVICE_ACCOUNT }} |