From 862237ee022669fa34c20c98791fb4c504f493a6 Mon Sep 17 00:00:00 2001 From: rodentskie Date: Mon, 30 Sep 2024 20:12:07 +0800 Subject: [PATCH] chore: redeploy --- .github/workflows/p2-stage.yml | 152 ++++++++++++++++----------------- 1 file changed, 76 insertions(+), 76 deletions(-) diff --git a/.github/workflows/p2-stage.yml b/.github/workflows/p2-stage.yml index 21fccded..a34f154e 100644 --- a/.github/workflows/p2-stage.yml +++ b/.github/workflows/p2-stage.yml @@ -230,79 +230,79 @@ jobs: printf '' > src/environments/environment.ts node_modules/.bin/ng build --configuration=${{ env.BUILD_CONFIG }} - - run: ls -la -# ########################################################## -# # AWS S3 SYNC OPERATIONS -# ########################################################## -# - name: AWS S3 Sync Operations -# run: | -# CUTIEAPPS3=$(aws cloudformation list-exports --query "Exports[?Name==\`$STACK_NAME-CUTIES3BUCKET-$ENV\`].Value" --no-paginate --output text) -# aws s3 sync www/ s3://$CUTIEAPPS3 --delete - - - -# ########################################################## -# # AWS CDN CACHE INVALIDATION -# ########################################################## -# - name: AWS Cloudfront Cache invalidation -# run: | -# CUTIEAPPCDN=$(aws cloudformation list-exports --query "Exports[?Name==\`$STACK_NAME-CutieCloudFrontDistributionID-$ENV\`].Value" --no-paginate --output text) -# for i in $CUTIEAPPCDN;do aws cloudfront create-invalidation --distribution-id $i --paths "/*";done - - - -# ########################################################## -# # SLACK NOTIFICATION -# ########################################################## -# - name: Slack Notification -# if: always() # Pick up events even if the job fails or is canceled. -# uses: 8398a7/action-slack@v3 -# env: -# SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} -# MATRIX_CONTEXT: ${{ toJson(matrix) }} # required -# with: -# status: ${{ job.status }} -# author_name: ${{ env.BRANCH_TAG_NAME }} - ${{ env.ROOTSTACK }} deployed to ${{ env.ENV }} environemnt in ${{ env.STACK_NAME }} AWS account -# mention: 'here' -# if_mention: failure,cancelled -# job_name: deploy-p2-stage # Match the name above. -# fields: repo,commit,eventName,ref,workflow,message,author,job,took -# custom_payload: | -# { -# username: 'GitHub Action CI WorkFlow', -# icon_emoji: ':github:', -# attachments: [{ -# color: '${{ job.status }}' === 'success' ? 'good' : ${{ job.status }}' === 'failure' ? 'danger' : 'warning', -# text: -# `${process.env.AS_REPO}\n -# ${process.env.AS_COMMIT}\n -# ${process.env.AS_EVENT_NAME}\n -# @${process.env.AS_REF}\n -# @${process.env.AS_WORKFLOW}\n -# ${process.env.AS_MESSAGE}\n -# ${process.env.AS_AUTHOR}\n -# ${process.env.AS_JOB}\n -# ${process.env.AS_TOOK}`, -# }] -# } - - -# # ################################################ -# # # STATUS VARIABLE UPDATE -# # ################################################ -# - name: Deployment status variable update -# if: ${{ failure() }} -# run: | -# echo "STATUS=FAILURE" >> $GITHUB_ENV - -# # ################################################ -# # # DEVOPS-DEPLOYMENT REPORT -# # ################################################ -# - name: DevOps Deployment Reporting -# if: always() -# run: | -# pip install --upgrade pip -# pip install --upgrade csvtotable -# aws s3 cp s3://$STATUSREPORTS3Bucket/deploy-reporting.sh deploy-reporting.sh -# chmod +x deploy-reporting.sh && ./deploy-reporting.sh -# echo "LINK="${GITHUB_REPOSITORY##*/}.html >> $GITHUB_ENV \ No newline at end of file + +########################################################## +# AWS S3 SYNC OPERATIONS +########################################################## + - name: AWS S3 Sync Operations + run: | + CUTIEAPPS3=$(aws cloudformation list-exports --query "Exports[?Name==\`$STACK_NAME-CUTIES3BUCKET-$ENV\`].Value" --no-paginate --output text) + aws s3 sync www/ s3://$CUTIEAPPS3 --delete + + + +########################################################## +# AWS CDN CACHE INVALIDATION +########################################################## + - name: AWS Cloudfront Cache invalidation + run: | + CUTIEAPPCDN=$(aws cloudformation list-exports --query "Exports[?Name==\`$STACK_NAME-CutieCloudFrontDistributionID-$ENV\`].Value" --no-paginate --output text) + for i in $CUTIEAPPCDN;do aws cloudfront create-invalidation --distribution-id $i --paths "/*";done + + + +########################################################## +# SLACK NOTIFICATION +########################################################## + - name: Slack Notification + if: always() # Pick up events even if the job fails or is canceled. + uses: 8398a7/action-slack@v3 + env: + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + MATRIX_CONTEXT: ${{ toJson(matrix) }} # required + with: + status: ${{ job.status }} + author_name: ${{ env.BRANCH_TAG_NAME }} - ${{ env.ROOTSTACK }} deployed to ${{ env.ENV }} environemnt in ${{ env.STACK_NAME }} AWS account + mention: 'here' + if_mention: failure,cancelled + job_name: deploy-p2-stage # Match the name above. + fields: repo,commit,eventName,ref,workflow,message,author,job,took + custom_payload: | + { + username: 'GitHub Action CI WorkFlow', + icon_emoji: ':github:', + attachments: [{ + color: '${{ job.status }}' === 'success' ? 'good' : ${{ job.status }}' === 'failure' ? 'danger' : 'warning', + text: + `${process.env.AS_REPO}\n + ${process.env.AS_COMMIT}\n + ${process.env.AS_EVENT_NAME}\n + @${process.env.AS_REF}\n + @${process.env.AS_WORKFLOW}\n + ${process.env.AS_MESSAGE}\n + ${process.env.AS_AUTHOR}\n + ${process.env.AS_JOB}\n + ${process.env.AS_TOOK}`, + }] + } + + +# ################################################ +# # STATUS VARIABLE UPDATE +# ################################################ + - name: Deployment status variable update + if: ${{ failure() }} + run: | + echo "STATUS=FAILURE" >> $GITHUB_ENV + +# ################################################ +# # DEVOPS-DEPLOYMENT REPORT +# ################################################ + - name: DevOps Deployment Reporting + if: always() + run: | + pip install --upgrade pip + pip install --upgrade csvtotable + aws s3 cp s3://$STATUSREPORTS3Bucket/deploy-reporting.sh deploy-reporting.sh + chmod +x deploy-reporting.sh && ./deploy-reporting.sh + echo "LINK="${GITHUB_REPOSITORY##*/}.html >> $GITHUB_ENV \ No newline at end of file