-
Notifications
You must be signed in to change notification settings - Fork 0
60 lines (56 loc) · 2.16 KB
/
deploy.yml
File metadata and controls
60 lines (56 loc) · 2.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
---
# https://github.com/marketplace/actions/s3-sync
#
name: deploy
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: pre-commit tests
uses: pre-commit/action@v3.0.1
- uses: jakejarvis/s3-sync-action@master
with:
args: >
--acl public-read --follow-symlinks --delete
--exclude '.git/*' --exclude '.github/*'
--exclude '.pre-commit-config.yaml'
--exclude 'README.md'
env:
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: ${{ secrets.AWS_REGION }}
SOURCE_DIR: 'makeitwork.cloud/'
- uses: jakejarvis/s3-sync-action@master
with:
args: >
--acl public-read --follow-symlinks --delete
--exclude '.git/*' --exclude '.github/*'
--exclude '.pre-commit-config.yaml'
--exclude 'README.md'
env:
AWS_S3_BUCKET: ${{ secrets.ONION_AWS_S3_BUCKET }}
AWS_ACCESS_KEY_ID: ${{ secrets.ONION_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.ONION_AWS_SECRET_ACCESS_KEY }}
AWS_REGION: ${{ secrets.ONION_AWS_REGION }}
SOURCE_DIR: 'onion.makeitwork.cloud/'
- name: Purge Cloudflare Cache
run: |
echo "Purging Cloudflare cache for zone ${{ secrets.CLOUDFLARE_ZONE_ID }}..."
response=$(curl -s -w "\n%{http_code}" -X POST "https://api.cloudflare.com/client/v4/zones/${{ secrets.CLOUDFLARE_ZONE_ID }}/purge_cache" \
-H "Authorization: Bearer ${{ secrets.CLOUDFLARE_API_TOKEN }}" \
-H "Content-Type: application/json" \
--data '{"purge_everything":true}')
http_code=$(echo "$response" | tail -n1)
body=$(echo "$response" | sed '$d')
echo "Response: $body"
if [ "$http_code" -ne 200 ]; then
echo "Error: Cloudflare purge failed with HTTP $http_code"
exit 1
fi
echo "Cloudflare cache purged successfully"