Skip to content

Commit

Permalink
Improve workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
peterpolman committed May 22, 2024
1 parent acbef36 commit e8e2e83
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 9 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}`"
17 changes: 12 additions & 5 deletions .github/workflows/app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand All @@ -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 }}`"
4 changes: 2 additions & 2 deletions .github/workflows/auth.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}`"

0 comments on commit e8e2e83

Please sign in to comment.