Skip to content

improvements after runthrough #22

improvements after runthrough

improvements after runthrough #22

name: Merge to Main
on:
push:
branches: ["main"]
workflow_dispatch:
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
determine_cloud_provider:
uses: ./.github/workflows/_determine-provider.yaml
secrets: inherit
build-and-push-client-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Log in to the Container registry
uses: docker/login-action@v2.0.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4.0.1
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/client
tags: |
type=raw,value=latest,enable={{is_default_branch}}
type=ref,enable=true,priority=600,prefix=,suffix=,event=branch
type=sha,format=long
- name: Build and push Docker image
uses: docker/build-push-action@v3
with:
context: ./client
file: ./client/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
BACKEND_URL=${{ vars.BACKEND_URL }}
build-and-push-coprocessor-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Log in to the Container registry
uses: docker/login-action@v2.0.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4.0.1
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/coprocessor
tags: |
type=raw,value=latest,enable={{is_default_branch}}
type=ref,enable=true,priority=600,prefix=,suffix=,event=branch
type=sha,format=long
- name: Build and push Docker image
uses: docker/build-push-action@v3
with:
context: ./coprocessor
file: ./coprocessor/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
BACKEND_URL=${{ vars.BACKEND_URL }}
build-and-push-subgraph-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
strategy:
matrix:
subgraph: [checkout, discovery, inventory, orders, products, reviews, shipping, users]
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Log in to the Container registry
uses: docker/login-action@v2.0.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4.0.1
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/${{ matrix.subgraph }}
tags: |
type=raw,value=latest,enable={{is_default_branch}}
type=ref,enable=true,priority=600,prefix=,suffix=,event=branch
type=sha,format=long
- name: Build and push Docker image
uses: docker/build-push-action@v3
with:
context: ./subgraphs/${{ matrix.subgraph }}
file: ./subgraphs/${{ matrix.subgraph }}/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
deploy_gcp:
if: needs.determine_cloud_provider.outputs.gcp == 'true'
needs: [determine_cloud_provider, build-and-push-subgraph-image, build-and-push-client-image]
uses: ./.github/workflows/_deploy-subgraphs-gke.yaml
secrets: inherit
strategy:
matrix:
subgraph: [checkout, discovery, inventory, orders, products, reviews, shipping, users]
with:
version: main
app_name: ${{ matrix.subgraph }}
cluster_suffix: dev
deploy_aws:
if: needs.determine_cloud_provider.outputs.aws == 'true'
needs: [determine_cloud_provider, build-and-push-subgraph-image, build-and-push-client-image]
uses: ./.github/workflows/_deploy-subgraphs-aws.yaml
secrets: inherit
strategy:
matrix:
subgraph: [checkout, discovery, inventory, orders, products, reviews, shipping, users]
with:
version: main
app_name: ${{ matrix.subgraph }}
cluster_suffix: dev
region: us-east-1
publish:
needs: [determine_cloud_provider]
uses: ./.github/workflows/_rover-subgraph-publish.yml
secrets: inherit
strategy:
matrix:
subgraph: [checkout, discovery, inventory, orders, products, reviews, shipping, users]
if: always() &&
(needs.determine_cloud_provider.outputs.apollo == 'true')
with:
subgraph_name: ${{ matrix.subgraph }} # change to subgraph-b in that repo
variant: dev
publish_pqs:
uses: ./.github/workflows/_rover-client-pq-publish.yml
needs: [determine_cloud_provider]
if: always() &&
(needs.determine_cloud_provider.outputs.apollo == 'true')
secrets: inherit
with:
environment: dev