From 5cc6b04a4c179f0fd201c1e10b0e29d4ea6d07c8 Mon Sep 17 00:00:00 2001 From: Jules Belveze <32683010+JulesBelveze@users.noreply.github.com> Date: Wed, 11 Dec 2024 15:55:54 +0100 Subject: [PATCH] [.github] - feature: support deployment to all regions with single input (#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 --- .github/workflows/deploy-front-edge.yml | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/.github/workflows/deploy-front-edge.yml b/.github/workflows/deploy-front-edge.yml index 2bb2d5b62053..ca1f08fea9c3 100644 --- a/.github/workflows/deploy-front-edge.yml +++ b/.github/workflows/deploy-front-edge.yml @@ -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 @@ -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: