pokeapi-api-data/.github/workflows/update-gql-data.yml
2024-01-10 18:50:19 +01:00

45 lines
1.4 KiB
YAML

name: update-gql-data
on:
push:
branches:
- master
jobs:
update-gql-data:
runs-on: ubuntu-22.04
concurrency:
group: serial
cancel-in-progress: false
permissions:
contents: 'read'
id-token: 'write'
steps:
- uses: 'actions/checkout@v4'
- uses: 'google-github-actions/auth@v2'
with:
project_id: 'pokeapi-215911'
workload_identity_provider: 'projects/569595515170/locations/global/workloadIdentityPools/github/providers/deploy'
- name: 'Set up Cloud SDK'
uses: 'google-github-actions/setup-gcloud@v2'
with:
version: '>= 390.0.0'
- name: 'Make snapshot'
run: |
gcloud compute snapshots create gql-${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT} \
--labels=trigger=gql-data-update,next-head-ref=${GITHUB_SHA} \
--snapshot-type=ARCHIVE \
--source-disk=graphql5 \
--source-disk-zone=us-east1-b \
--storage-location=us-east1
- name: 'Update update-graphql-data-prod'
uses: 'google-github-actions/ssh-compute@v1'
with:
instance_name: 'graphql5'
zone: 'us-east1-b'
ssh_private_key: '${{ secrets.GCP_SSH_PRIVATE_KEY }}'
user: ga
command: sudo -i sh -c 'cd pokeapi && make update-graphql-data-prod'
- name: 'Display update output'
run: |-
echo '${{ steps.compute-ssh.outputs.stdout }}'
echo '${{ steps.compute-ssh.outputs.stderr }}'