graphql-engine/docs/preview_cloud_build.yaml
Kailash Sudhakar 458ce8b384 Build configs for preview builds through GKE
Build configs for preview builds through GKE

## Description ✍️

Moving the docs preview builds from Cloudflare to "websitecloud" Google Cloud Project which is currently handling the staging and production deployments:

The preview triggers are expected to be called only on changes to the docs folder

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6999
GitOrigin-RevId: 1699fe7677ebc03b8ce6338394e91d8e848640c3
2022-11-23 14:18:37 +00:00

68 lines
1.7 KiB
YAML

steps:
#kaniko
- name: 'gcr.io/kaniko-project/executor:latest'
id: kaniko
args:
[
"--dockerfile=./Dockerfile",
"--context=dir:///workspace/docs",
"--cache=false",
"--cache-ttl=1h",
"--destination=us-west1-docker.pkg.dev/${PROJECT_ID}/docusaurus/docusaurus:${_PR_NUMBER}-${SHORT_SHA}",
]
- id: "deploy revision with tag"
name: "gcr.io/google.com/cloudsdktool/cloud-sdk"
entrypoint: "gcloud"
args:
[
"run",
"deploy",
"${_SERVICE_NAME}",
"--platform",
"managed",
"--region",
"${_REGION}",
"--image",
"us-west1-docker.pkg.dev/${PROJECT_ID}/docusaurus/docusaurus:${_PR_NUMBER}-${SHORT_SHA}",
"--tag",
"pr-${_PR_NUMBER}",
"--no-traffic",
]
- id: "link revision on pull request"
name: "gcr.io/${PROJECT_ID}/deployment-previews" # our custom builder
secretEnv: ["GITHUB_TOKEN"]
args:
[
"set",
"--project-id",
"${PROJECT_ID}",
"--region",
"${_REGION}",
"--service",
"${_SERVICE_NAME}",
"--pull-request",
"${_PR_NUMBER}",
"--repo-name",
"${_GITHUB_REPO}",
"--commit-sha",
"${SHORT_SHA}",
]
timeout: 3600s
substitutions:
_SERVICE_NAME: docusaurus
_REGION: us-west2
_GITHUB_REPO: $(pull_request.pull_request.head.repo.full_name)
options:
dynamicSubstitutions: true
workerPool: 'projects/websitecloud-352908/locations/us-west2/workerPools/gke-vpn-pool'
availableSecrets:
secretManager:
- versionName: projects/$PROJECT_ID/secrets/github_token/versions/latest
env: "GITHUB_TOKEN"