Skip to content

Commit

Permalink
[.github] - feature: support deployment to all regions with single in…
Browse files Browse the repository at this point in the history
…put (#9285)

- Add a new workflow job 'create-matrix' to create a matrix for build job based on input regions
 - Enable users to deploy to all regions with the 'all' keyword to simplify the CI/CD process
 - Modify 'build' job to utilize the matrix generated by 'create-matrix' job
  • Loading branch information
JulesBelveze authored Dec 11, 2024
1 parent 4cfca02 commit 5cc6b04
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions .github/workflows/deploy-front-edge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
options:
- "us-central1"
- "europe-west1"
- "us-central1,europe-west1"
- "all"
check_deployment_blocked:
description: "Check #deployment locks or force deploy"
required: true
Expand Down Expand Up @@ -59,12 +59,25 @@ jobs:
channel: ${{ secrets.SLACK_CHANNEL_ID }}
slack_token: ${{ secrets.SLACK_BOT_TOKEN }}

create-matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- id: set-matrix
run: |
if [ "${{ github.event.inputs.regions }}" = "all" ]; then
echo "matrix=[\"us-central1\",\"europe-west1\"]" >> $GITHUB_OUTPUT
else
echo "matrix=[\"${{ github.event.inputs.regions }}\"]" >> $GITHUB_OUTPUT
fi
build:
needs: notify-start
needs: [notify-start, create-matrix]
runs-on: ubuntu-latest
strategy:
matrix:
region: ${{ fromJson(format('[{0}]', join(split(github.event.inputs.regions, ','), ','))) }}
region: ${{ fromJson(needs.create-matrix.outputs.matrix) }}
fail-fast: true

steps:
Expand Down

0 comments on commit 5cc6b04

Please sign in to comment.