File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Grant Firstrade Telegram Secret Access
2+
3+ on :
4+ workflow_dispatch :
5+
6+ permissions :
7+ contents : read
8+ id-token : write
9+
10+ jobs :
11+ grant :
12+ name : Grant Firstrade workflow Telegram secret access
13+ runs-on : ubuntu-latest
14+ timeout-minutes : 10
15+ env :
16+ GCP_PROJECT_ID : firstradequant
17+ GCP_WORKLOAD_IDENTITY_PROVIDER : projects/1088907247379/locations/global/workloadIdentityPools/github-actions/providers/github-main
18+ GCP_WORKLOAD_IDENTITY_SERVICE_ACCOUNT : firstrade-platform-deploy@firstradequant.iam.gserviceaccount.com
19+ TELEGRAM_TOKEN_SECRET_NAME : firstrade-telegram-token
20+ steps :
21+ - name : Authenticate to Google Cloud
22+ uses : google-github-actions/auth@v3
23+ with :
24+ workload_identity_provider : ${{ env.GCP_WORKLOAD_IDENTITY_PROVIDER }}
25+ service_account : ${{ env.GCP_WORKLOAD_IDENTITY_SERVICE_ACCOUNT }}
26+
27+ - name : Set up gcloud
28+ uses : google-github-actions/setup-gcloud@v3
29+
30+ - name : Grant and verify secret accessor
31+ run : |
32+ set -euo pipefail
33+ gcloud secrets add-iam-policy-binding "${TELEGRAM_TOKEN_SECRET_NAME}" \
34+ --project="${GCP_PROJECT_ID}" \
35+ --member="serviceAccount:${GCP_WORKLOAD_IDENTITY_SERVICE_ACCOUNT}" \
36+ --role="roles/secretmanager.secretAccessor" \
37+ --condition=None \
38+ --quiet
39+ gcloud secrets versions access latest \
40+ --secret="${TELEGRAM_TOKEN_SECRET_NAME}" \
41+ --project="${GCP_PROJECT_ID}" >/dev/null
You can’t perform that action at this time.
0 commit comments