mirror of
https://gitlab.com/futo-org/fcast.git
synced 2025-07-16 02:48:47 +00:00
Fixed CI/CD to work with Cloudflare.
This commit is contained in:
parent
e7476d916d
commit
56662e7e9f
2 changed files with 30 additions and 11 deletions
|
@ -1,11 +1,7 @@
|
||||||
buildAndDeployElectron:
|
buildAndDeployElectron:
|
||||||
stage: buildAndDeployElectron
|
stage: buildAndDeployElectron
|
||||||
before_script:
|
before_script:
|
||||||
- cd receivers/electron/packaging
|
- cd receivers/electron
|
||||||
script:
|
script:
|
||||||
- npm install
|
- sh deploy.sh
|
||||||
- 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/
|
|
||||||
when: manual
|
when: manual
|
|
@ -1,7 +1,30 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
DOCUMENT_ROOT=/var/www/html
|
||||||
|
|
||||||
|
# Build content
|
||||||
|
echo "Building content..."
|
||||||
npm install
|
npm install
|
||||||
npm run build
|
cd packaging
|
||||||
cp package.json /var/www/html/fcastreceiver/
|
sh package-all.sh
|
||||||
cp -r dist /var/www/html/fcastreceiver/
|
|
||||||
ls /var/www/html/fcastreceiver
|
# Take site offline
|
||||||
ls /var/www/html/fcastreceiver/dist
|
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
|
Loading…
Add table
Add a link
Reference in a new issue