Skip to content

Commit

Permalink
fix(ci): upload addon packages for manual download to CDN (#7153)
Browse files Browse the repository at this point in the history
* fix(ci): upload addon packages for manual download to CDN

* fix: indentation

Co-authored-by: Andreas Guther <[email protected]>
  • Loading branch information
FoxtrotSierra6829 and aguther committed May 9, 2022
1 parent f82d43f commit cf8da73
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/experimental.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ jobs:
BUNNY_BUCKET_PASSWORD: ${{ secrets.BUNNY_BUCKET_PASSWORD }}
BUNNY_SECRET_TOKEN: ${{ secrets.BUNNY_SECRET_TOKEN }}
BUNNY_BUCKET_DESTINATION: addons/a32nx/experimental
run: ./scripts/cdn.sh $BUNNY_BUCKET_DESTINATION
run: |
./scripts/cdn.sh $BUNNY_BUCKET_DESTINATION ./build-modules
./scripts/cdn.sh $BUNNY_BUCKET_DESTINATION ./${{ env.BUILD_DIR_NAME }}
- name: Delete old GitHub Pre-Release assets
uses: mknejp/delete-release-assets@v1
with:
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@ jobs:
BUNNY_BUCKET_PASSWORD: ${{ secrets.BUNNY_BUCKET_PASSWORD }}
BUNNY_SECRET_TOKEN: ${{ secrets.BUNNY_SECRET_TOKEN }}
BUNNY_BUCKET_DESTINATION: addons/a32nx/master
run: ./scripts/cdn.sh $BUNNY_BUCKET_DESTINATION
run: |
./scripts/cdn.sh $BUNNY_BUCKET_DESTINATION ./build-modules
./scripts/cdn.sh $BUNNY_BUCKET_DESTINATION ./${{ env.BUILD_DIR_NAME }}
- name: Delete old GitHub Pre-Release assets
uses: mknejp/delete-release-assets@v1
with:
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ jobs:
BUNNY_BUCKET_PASSWORD: ${{ secrets.BUNNY_BUCKET_PASSWORD }}
BUNNY_SECRET_TOKEN: ${{ secrets.BUNNY_SECRET_TOKEN }}
BUNNY_BUCKET_DESTINATION: addons/a32nx/stable
run: ./scripts/cdn.sh $BUNNY_BUCKET_DESTINATION
run: |
./scripts/cdn.sh $BUNNY_BUCKET_DESTINATION ./build-modules
./scripts/cdn.sh $BUNNY_BUCKET_DESTINATION ./${{ env.BUILD_DIR_NAME }}
- name: Delete old GitHub Pre-Release assets
uses: mknejp/delete-release-assets@v1
with:
Expand Down
5 changes: 3 additions & 2 deletions scripts/cdn.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
CDN_URL="storage.bunnycdn.com/flybywiresim-cdn"
CDN_PURGE_LINK="https://bunnycdn.com/api/purge?url=http://flybywiresim.b-cdn.net"
CDN_DIR=${1:-"addons/a32nx/test"}
LOCAL_DIR=${2:-"./build-modules"}

MAX_RETRY=5

Expand All @@ -24,13 +25,13 @@ upload () {
}

# Upload all files
for FILE in ./build-modules/*; do
for FILE in "${LOCAL_DIR}"/*; do
upload "$FILE"
done

# Purge after all uploads that the files are somewhat in sync
echo "Purging cache"
for FILE in ./build-modules/*; do
for FILE in "${LOCAL_DIR}"/*; do
DEST="$CDN_PURGE_LINK/$CDN_DIR/$(basename -- "$FILE")"
echo "Purging cache for file: $FILE"
echo "Purge URL: $DEST"
Expand Down

0 comments on commit cf8da73

Please sign in to comment.