Skip to content

Commit

Permalink
feat: generalize github action
Browse files Browse the repository at this point in the history
  • Loading branch information
andrey-canon committed Jan 25, 2024
1 parent f7334b2 commit 3681db5
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions .github/workflows/deploy-mfe-s3.yml
Original file line number Diff line number Diff line change
@@ -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:

Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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: |
Expand Down

0 comments on commit 3681db5

Please sign in to comment.