From 3681db5879660f506bef7f2048386017798b57a0 Mon Sep 17 00:00:00 2001 From: andrey-canon Date: Thu, 25 Jan 2024 11:06:39 -0500 Subject: [PATCH] feat: generalize github action --- .github/workflows/deploy-mfe-s3.yml | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/.github/workflows/deploy-mfe-s3.yml b/.github/workflows/deploy-mfe-s3.yml index 052388711e..430b49af86 100644 --- a/.github/workflows/deploy-mfe-s3.yml +++ b/.github/workflows/deploy-mfe-s3.yml @@ -1,18 +1,21 @@ name: MFE S3 Bucket Deployment 🚀 +env: + RELEASE_VERSION: unset ## Set this variable in your branch to activate the production deployments. + on: push: branches: - - ednx-release/mango.nelp - - ednx-rc/mango.nelp + - open-release/${{ env.RELEASE_VERSION }}.nelp + - open-rc/${{ env.RELEASE_VERSION }}.nelp pull_request: branches: - - "**ednx-rc**" + - "**open-rc**" jobs: build: environment: - name: ${{ github.ref_name == 'ednx-release/mango.nelp' && 'prod' || 'stage' }} + name: ${{ github.ref_name == 'open-release/${{ env.RELEASE_VERSION }}.nelp' && 'prod' || 'stage' }} runs-on: ubuntu-latest steps: @@ -54,8 +57,7 @@ jobs: - name: npm Build # check env variables of repo. run: npm run build env: - PUBLIC_PATH_CDN: ${{ vars.PUBLIC_PATH_CDN }} - PUBLIC_PATH: ${{ vars.PUBLIC_PATH }} + PUBLIC_PATH: ${{ vars.PUBLIC_PATH_CDN }} APP_ID: ${{ vars.APP_ID }} MFE_CONFIG_API_URL: ${{ vars.MFE_CONFIG_API_URL }} ENABLE_NEW_RELIC: false @@ -72,7 +74,7 @@ jobs: deployment: environment: - name: ${{ github.ref_name == 'ednx-release/mango.nelp' && 'prod' || 'stage' }} + name: ${{ github.ref_name == 'open-release/${{ env.RELEASE_VERSION }}.nelp' && 'prod' || 'stage' }} url: ${{ vars.PUBLIC_PATH_CDN }} runs-on: ubuntu-latest needs: build @@ -99,7 +101,7 @@ jobs: run: | aws s3 sync . $S3_BUCKET env: - S3_BUCKET: s3://${{ vars.BUCKET_NAME }}${{ vars.PUBLIC_PATH }} --delete + S3_BUCKET: s3://${{ vars.BUCKET_NAME }}/${{ vars.APP_ID }}/ --delete - name: Invalidate past cloudfront cache run: |