-
Notifications
You must be signed in to change notification settings - Fork 5
59 lines (48 loc) · 1.85 KB
/
load-library-metadata.yml
File metadata and controls
59 lines (48 loc) · 1.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
name: Load Library API Metadata
on:
workflow_dispatch:
workflow_call:
env:
PROJECT_ID: benefit-decision-toolkit-play
REGION: us-central1
WORKLOAD_IDENTITY_PROVIDER: projects/1034049717668/locations/global/workloadIdentityPools/github-actions-google-cloud/providers/github
jobs:
run-script:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
# use a specific service account for sync script
- name: Create GCP credentials file (for sync script)
run: |
echo '${{ secrets.GCP_SERVICE_ACCOUNT_KEY }}' > bin/library/gcp-key.json
- name: Run sync
working-directory: bin/library
env:
GOOGLE_APPLICATION_CREDENTIALS: gcp-key.json
LIBRARY_API_BASE_URL: https://library-api-1034049717668.us-central1.run.app
run: |
./sync-metadata
- name: Cleanup credentials
run: rm bin/library/gcp-key.json
# Use a different service account with permissions to restart builder-api
- name: Authenticate to Google Cloud (for restarting builder-api)
uses: google-github-actions/auth@v2
with:
workload_identity_provider: ${{ env.WORKLOAD_IDENTITY_PROVIDER }}
service_account: cicd-build-deploy-api@${{ env.PROJECT_ID }}.iam.gserviceaccount.com
project_id: ${{ env.PROJECT_ID }}
- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v2
- name: Restart builder-api with updated library metadata
run: |
gcloud run services update builder-api \
--region ${{ env.REGION }} \
--update-env-vars LIBRARY_SYNC_TIMESTAMP=$(date -u +%Y%m%dT%H%M%SZ)