Skip to content

Manual Deploy - Subgraphs #6

Manual Deploy - Subgraphs

Manual Deploy - Subgraphs #6

name: Manual Deploy - Subgraphs
# Started from GH Docs
# https://docs.github.com/en/actions/deployment/deploying-to-your-cloud-provider/deploying-to-google-kubernetes-engine
# REQUIRED REPO SECRETS
# - GCP_CREDENTIALS or AWS_ACCESS_KEY/SECRET
# - CLUSTER_PREFIX
# - APOLLO_KEY
# - APOLLO_GRAPH_ID
on:
workflow_dispatch:
inputs:
version:
description: "Git ref to deploy"
type: string
required: true
default: main
environment:
description: "Target environment"
type: choice
required: true
default: dev
options:
- dev
- prod
dry-run:
type: boolean
description: "Run a dry run with helm"
required: false
default: false
debug:
type: boolean
description: "Run helm in debug mode"
required: false
default: false
jobs:
determine_cloud_provider:
uses: ./.github/workflows/_determine-provider.yaml
secrets: inherit
deploy_gcp:
if: needs.determine_cloud_provider.outputs.gcp == 'true'
needs: [determine_cloud_provider]
uses: ./.github/workflows/_deploy-subgraphs-gke.yaml
secrets: inherit
strategy:
matrix:
subgraph: [checkout, discovery, inventory, orders, products, reviews, shipping, users]
with:
version: ${{ inputs.version }}
app_name: ${{ matrix.subgraph }}
cluster_suffix: ${{ inputs.environment }}
dry-run: ${{ inputs.dry-run }}
debug: ${{ inputs.debug }}
deploy_aws:
if: needs.determine_cloud_provider.outputs.aws == 'true'
needs: [determine_cloud_provider]
uses: ./.github/workflows/_deploy-subgraphs-aws.yaml
secrets: inherit
strategy:
matrix:
subgraph: [checkout, discovery, inventory, orders, products, reviews, shipping, users]
with:
version: ${{ inputs.version }}
app_name: ${{ matrix.subgraph }}
cluster_suffix: ${{ inputs.environment }}
dry-run: ${{ inputs.dry-run }}
debug: ${{ inputs.debug }}
publish:
needs: [deploy_aws, deploy_gcp, determine_cloud_provider]
strategy:
matrix:
subgraph: [checkout, discovery, inventory, orders, products, reviews, shipping, users]
if: always() &&
(needs.deploy_aws.result == 'success' || needs.deploy_aws.result == 'skipped') &&
(needs.deploy_gcp.result == 'success' || needs.deploy_gcp.result == 'skipped') &&
(needs.determine_cloud_provider.outputs.apollo == 'true')
uses: ./.github/workflows/_rover-subgraph-publish.yml
secrets: inherit
with:
subgraph_name: ${{ matrix.subgraph }} # change to subgraph-b in that repo
variant: ${{ inputs.environment }}
publish_pqs:
needs: [deploy_aws, deploy_gcp, determine_cloud_provider]
if: always() &&
(needs.deploy_aws.result == 'success' || needs.deploy_aws.result == 'skipped') &&
(needs.deploy_gcp.result == 'success' || needs.deploy_gcp.result == 'skipped') &&
(needs.determine_cloud_provider.outputs.apollo == 'true')
uses: ./.github/workflows/_rover-client-pq-publish.yml
secrets: inherit
with:
environment: ${{ inputs.environment }}