From 6f25189ad6ec6ab567835689f205952756c13bf6 Mon Sep 17 00:00:00 2001 From: Vincent Vatelot Date: Fri, 24 Nov 2023 10:46:49 +0100 Subject: [PATCH] ci(deploy): Split production and preprod environment (#216) --- .github/workflows/deploy.yml | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index ee8a37ce..81049b89 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,4 +1,4 @@ -name: Deploy rsync +name: RSYNC Deploy on: push: @@ -6,9 +6,28 @@ on: - "v*.*.*" jobs: + env: + name: Get deploy environment based on tag suffix + runs-on: ubuntu-latest + outputs: + target-env: ${{ steps.get_environment.outputs.target-env }} + steps: + - name: 🛒 Checkout + uses: actions/checkout@v3 + - name: 🚀 Get Environment + id: get_environment + run: | + if [[ ${{ github.ref }} =~ ^v[0-9]+\.[0-9]+\.[0-9]+-rc[0-9]+$ ]]; then + echo "target-env: preproduction" > $GITHUB_OUTPUT + elif [[ ${{ github.ref }} =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + echo "target-env: production" > $GITHUB_OUTPUT + fi + deploy: + needs: env + environment: + name: ${{ needs.env.outputs.target-env }} runs-on: ubuntu-latest - environment: production steps: - name: 🛒 Checkout uses: actions/checkout@v3