diff --git a/.github/workflows/api.yml b/.github/workflows/api.yml index 2927076d4..ca9f1c7c4 100644 --- a/.github/workflows/api.yml +++ b/.github/workflows/api.yml @@ -231,7 +231,7 @@ jobs: steps: - name: Send message env: - DISCORD_WEBHOOK: ${{ secrets.DISCORD_AWS_WEBHOOK }} + DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK_DEV }} uses: Ilshidur/action-discord@master with: - args: "${{ needs.autodeploy.result == 'success' && '✅' || '⛔' }} Released APIDev `${{ needs.bumpVersion.outputs.newTag }}`" + args: "${{ needs.autodeploy.result == 'success' && '✅' || '⛔' }} Released API `${{ needs.bumpVersion.outputs.newTag }}`" diff --git a/.github/workflows/app.yml b/.github/workflows/app.yml index ce2810463..88ddc77fb 100644 --- a/.github/workflows/app.yml +++ b/.github/workflows/app.yml @@ -100,9 +100,6 @@ jobs: aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} aws-region: eu-west-3 - - name: Set BUILD_MODE based on branch - run: echo "BUILD_MODE=$([[ '${{ github.ref_name }}' == 'main' ]] && echo 'prod' || ([[ '${{ github.ref_name }}' == 'develop' ]] && echo 'dev' || echo 'unknown'))" >> $GITHUB_ENV - - name: Restore Node.js dependencies uses: actions/cache@v3 with: @@ -111,11 +108,21 @@ jobs: restore-keys: | ${{ runner.os }}-node- + - name: Set environment based on branch + run: | + if [[ $GITHUB_REF == 'refs/heads/develop' ]]; then + echo "S3_URL=s3://dev-app.thx.network" >> $GITHUB_ENV + echo "BUILD_MODE=dev" >> $GITHUB_ENV + elif [[ $GITHUB_REF == 'refs/heads/main' ]]; then + echo "S3_URL=s3://app.thx.network" >> $GITHUB_ENV + echo "BUILD_MODE=prod" >> $GITHUB_ENV + fi + - name: Build App run: yarn nx run app:build --prod --mode $BUILD_MODE --skip-nx-cache - name: Deploy - run: aws s3 sync ./dist/apps/app s3://dev-app.thx.network --delete + run: aws s3 sync ./dist/apps/app ${{ S3_URL }} --delete discord: name: Update Discord @@ -137,7 +144,7 @@ jobs: - name: Send message env: - DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} + DISCORD_WEBHOOK: ${{ DISCORD_WEBHOOK }} uses: Ilshidur/action-discord@master with: args: "${{ needs.autodeploy.result == 'success' && '✅' || '⛔' }} Released App `${{ needs.bumpVersion.outputs.newTag }}`" diff --git a/.github/workflows/auth.yml b/.github/workflows/auth.yml index 086b5a313..c8f788690 100644 --- a/.github/workflows/auth.yml +++ b/.github/workflows/auth.yml @@ -182,7 +182,7 @@ jobs: steps: - name: Send message env: - DISCORD_WEBHOOK: ${{ secrets.DISCORD_AWS_WEBHOOK }} + DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK_DEV }} uses: Ilshidur/action-discord@master with: - args: "${{ needs.autodeploy.result == 'success' && '✅' || '⛔' }} Released AuthDev `${{ needs.bumpVersion.outputs.newTag }}`" + args: "${{ needs.autodeploy.result == 'success' && '✅' || '⛔' }} Released Auth `${{ needs.bumpVersion.outputs.newTag }}`"