Skip to content

Commit 8d40652

Browse files
committed
feat(cicd): add GQL reload
1 parent 1462579 commit 8d40652

2 files changed

Lines changed: 37 additions & 0 deletions

File tree

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: update-gql-data
2+
on:
3+
push:
4+
branches:
5+
- master
6+
jobs:
7+
update-gql-data:
8+
runs-on: ubuntu-22.04
9+
permissions:
10+
contents: 'read'
11+
id-token: 'write'
12+
steps:
13+
- uses: 'actions/checkout@v4'
14+
- uses: 'google-github-actions/auth@v2'
15+
with:
16+
project_id: 'pokeapi-215911'
17+
workload_identity_provider: 'projects/569595515170/locations/global/workloadIdentityPools/github/providers/api-data'
18+
- name: 'Set up Cloud SDK'
19+
uses: 'google-github-actions/setup-gcloud@v2'
20+
with:
21+
version: '>= 390.0.0'
22+
- name: 'Make snapshot'
23+
run: |
24+
gcloud compute snapshots create gql-${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT} \
25+
--labels=trigger=gql-data-update,next-head-ref=${GITHUB_HEAD_REF} \
26+
--snapshot-type=ARCHIVE \
27+
--source-disk=graphql5 \
28+
--source-disk-zone=us-east1-b \
29+
--storage-location=us-east1
30+
- uses: 'google-github-actions/ssh-compute@v1'
31+
with:
32+
instance_name: 'graphql5'
33+
zone: 'us-east1-b'
34+
ssh_private_key: '${{ secrets.GCP_SSH_PRIVATE_KEY }}'
35+
user: ga
36+
command: sudo -i sh -c 'cd pokeapi && make update-graphql-data-prod'

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
.venv/
2+
gha-creds-*.json

0 commit comments

Comments
 (0)