1
0
mirror of https://github.com/kamranahmedse/developer-roadmap.git synced 2025-01-16 21:58:30 +01:00

Auto-clear cache on deployment

This commit is contained in:
Kamran Ahmed 2024-05-12 02:14:20 +01:00
parent 2071b92d3e
commit 29c97964d1
2 changed files with 14 additions and 5 deletions

View File

@ -1,10 +1,6 @@
name: Clears Cloudfront Cache
on:
# Allow manual Run
workflow_dispatch:
# Run at midnight utc
schedule:
- cron: '0 0 * * *'
jobs:
aws_costs:
runs-on: ubuntu-latest

View File

@ -63,4 +63,17 @@ jobs:
key: ${{ secrets.EC2_PRIVATE_KEY }}
script: |
cd /var/www/roadmap.sh
sudo pm2 restart web-roadmap
sudo pm2 restart web-roadmap
# --------------------
# Clear cloudfront cache
# --------------------
- name: Clear Cloudfront Caching
run: |
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.GH_PAT }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/roadmapsh/infra-ansible/actions/workflows/playbook.yml/dispatches \
-d '{ "ref":"master", "inputs": { "playbook": "roadmap_web.yml", "tags": "cloudfront", "is_verbose": false } }'