1
0
Fork 0
mirror of https://gitlab.com/futo-org/fcast.git synced 2025-06-24 21:25:23 +00:00

Fixed CI/CD to work with Cloudflare.

This commit is contained in:
Koen 2023-06-28 12:23:38 +02:00
parent e7476d916d
commit 56662e7e9f
2 changed files with 30 additions and 11 deletions

View file

@ -1,11 +1,7 @@
buildAndDeployElectron:
stage: buildAndDeployElectron
before_script:
- cd receivers/electron/packaging
- cd receivers/electron
script:
- npm install
- sh package-all.sh
- cp fcast-receiver-*.zip /var/www/html/fcastreceiver/
- cp ../package.json /var/www/html/fcastreceiver/
- cp -r ../dist /var/www/html/fcastreceiver/
- sh deploy.sh
when: manual

View file

@ -1,7 +1,30 @@
#!/bin/sh
DOCUMENT_ROOT=/var/www/html
# Build content
echo "Building content..."
npm install
npm run build
cp package.json /var/www/html/fcastreceiver/
cp -r dist /var/www/html/fcastreceiver/
ls /var/www/html/fcastreceiver
ls /var/www/html/fcastreceiver/dist
cd packaging
sh package-all.sh
# Take site offline
echo "Taking site offline..."
touch $DOCUMENT_ROOT/maintenance.file
# Swap over the content
echo "Deploying content..."
cp fcast-receiver-*.zip $DOCUMENT_ROOT/fcastreceiver/
cd ..
cp package.json $DOCUMENT_ROOT/fcastreceiver/
cp -r dist $DOCUMENT_ROOT/fcastreceiver/
# Notify Cloudflare to wipe the CDN cache
echo "Purging Cloudflare cache..."
curl -X POST "https://api.cloudflare.com/client/v4/zones/$CLOUDFLARE_ZONE_ID/purge_cache" \
-H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
-H "Content-Type: application/json" \
--data '{"purge_everything":true}'
# Take site back online
echo "Bringing site back online..."
rm $DOCUMENT_ROOT/maintenance.file