Skip to content

Commit

Permalink
Merge pull request #53 from 0xPolygon/sreevalsan/purge
Browse files Browse the repository at this point in the history
Update build_and_deploy.yml
  • Loading branch information
sreevalsanmr authored Jan 7, 2025
2 parents 62709ec + 6ae6a8a commit 069b027
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/build_and_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,19 @@ jobs:
outputs:
ACCOUNT_NUMBER: ${{ steps.set-env-var.outputs.ACCOUNT_NUMBER }}
APP_NAME: ${{ steps.set-env-var.outputs.APP_NAME }}
PURGE_HOST: ${{ steps.set-env-var.outputs.PURGE_HOST }}
steps:
- name: Set Environment Variable
id: set-env-var
run: |
if [ "${{ inputs.environment }}" == "staging" ]; then
echo "ACCOUNT_NUMBER=070528468658" >> $GITHUB_OUTPUT
echo "APP_NAME=${{ inputs.core_app }}-staging" >> $GITHUB_OUTPUT
echo "PURGE_HOST=assets-staging.polygon.technology" >> $GITHUB_OUTPUT
elif [ "${{ inputs.environment }}" == "prod" ]; then
echo "ACCOUNT_NUMBER=042947190491" >> $GITHUB_OUTPUT
echo "APP_NAME=${{ inputs.core_app }}" >> $GITHUB_OUTPUT
echo "PURGE_HOST=assets.polygon.technology" >> $GITHUB_OUTPUT
fi
deploy:
Expand All @@ -40,3 +43,16 @@ jobs:
cluster_name: frontend-${{ inputs.environment }}-ecs-cluster
account_number: "${{ needs.set-env-variable.outputs.ACCOUNT_NUMBER }}"
secrets: inherit

cloudflare-purge:
runs-on: ubuntu-latest
needs:
- set-env-variable # Ensures it waits for set-env-variable to complete
- deploy # Ensures it waits for deploy to complete
steps:
- name: Cloudflare Cache Purge
uses: nathanvaughn/actions-cloudflare-purge@master
with:
cf_zone: ${{ secrets.CLOUDFLARE_ZONE }}
cf_auth: ${{ secrets.CLOUDFLARE_AUTH_KEY }}
hosts: ${{ needs.set-env-variable.outputs.PURGE_HOST }}

0 comments on commit 069b027

Please sign in to comment.