Skip to content

Commit 736d8b7

Browse files
committed
Incrementally testing GH action.
1 parent cdaec70 commit 736d8b7

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Copy PROD DB to QA
2+
on:
3+
workflow_dispatch: # Supports manual deployment
4+
push:
5+
branches:
6+
- 1117-allow-qa-environment-to-use-prod-database-contents
7+
8+
jobs:
9+
run-script:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v4
15+
16+
- name: Authenticate to Google Cloud
17+
id: gcloud_auth
18+
uses: google-github-actions/auth@v2
19+
with:
20+
credentials_json: ${{ secrets.GCP_MOBILITY_FEEDS_SA_KEY }}
21+
22+
- name: GCloud Setup
23+
uses: google-github-actions/setup-gcloud@v2
24+
25+
- name: Create DB dump bucket
26+
run: |
27+
DUMP_BUCKET_NAME="mobilitydata-database-dump-qa"
28+
BUCKET_PROJECT_ID=${{ QA_MOBILITY_FEEDS_PROJECT_ID }}
29+
GCP_REGION=${{ vars.MOBILITY_FEEDS_REGION }}
30+
BUCKET_PROJECT_ID="${{ vars.DEV_MOBILITY_FEEDS_PROJECT_ID }}"
31+
32+
# Check if the bucket already exists
33+
if ! gsutil ls -b "gs://${BUCKET_NAME}" &> /dev/null; then
34+
echo "Bucket doesn't exist. Creating..."
35+
gsutil mb -l $GCP_REGION -p $BUCKET_PROJECT_ID "gs://${DUMP_BUCKET_NAME}"
36+
else
37+
echo "Bucket already exists."
38+
fi

0 commit comments

Comments
 (0)