-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: upload config to cloudflare (#45)
- Loading branch information
1 parent
8ab28fc
commit 82739cc
Showing
4 changed files
with
40 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/bin/bash | ||
|
||
CDN_URL="flybywirecdn.com" | ||
CDN_PURGE_LINK="https://flybywirecdn.com/purgeCache?url=http://flybywirecdn.com" | ||
FILES=${1} | ||
CDN_DIR=${2:-"installer/config/test"} | ||
|
||
echo "Syncing files from: ${FILES}/*" | ||
echo "Syncing to: ${CDN_DIR}" | ||
|
||
for FILE in "${FILES}"/*; do | ||
DEST="$CDN_URL/$CDN_DIR/$(basename -- "$FILE")" | ||
echo "Syncing file: $FILE" | ||
echo "Destination: $DEST" | ||
curl -X PUT -H "X-FBW-Access-Key: $CLOUDFLARE_BUCKET_PASSWORD" -T "$FILE" "$DEST" | ||
done | ||
|
||
# Purge after all uploads that the files are somewhat in sync | ||
echo "Purging cache" | ||
for FILE in "${FILES}"/*; do | ||
DEST="$CDN_PURGE_LINK/$CDN_DIR/$(basename -- "$FILE")" | ||
echo "Purging cache for file: $FILE" | ||
echo "Purge URL: $DEST" | ||
curl -X POST -H "X-FBW-Access-Key: $CLOUDFLARE_BUCKET_PASSWORD" -H "Content-Length: 0" "$DEST" | ||
done |