This commit is contained in:
21
packages/release/bin/deployBackend.sh
Executable file
21
packages/release/bin/deployBackend.sh
Executable file
@@ -0,0 +1,21 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Determine the directory of the script
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
|
||||
# Source the .env file from the parent directory of the script's directory
|
||||
source "$SCRIPT_DIR/../.env"
|
||||
|
||||
echo "Running $BE_SCRIPT_PATH on $BE_HOST with user $BE_USER"
|
||||
|
||||
# Connect to SSH and execute remote script
|
||||
ssh_output=$(ssh "$BE_USER@$BE_HOST" "$BE_SCRIPT_PATH")
|
||||
|
||||
# Capture the exit code of the SSH command
|
||||
exit_code=$?
|
||||
|
||||
# Print the output
|
||||
echo "$ssh_output"
|
||||
|
||||
# Forward the exit code of the remote script
|
||||
exit $exit_code
|
||||
23
packages/release/bin/purgeCfCache.sh
Executable file
23
packages/release/bin/purgeCfCache.sh
Executable file
@@ -0,0 +1,23 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Determine the directory of the script
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
|
||||
# Source the .env file from the parent directory of the script's directory
|
||||
source "$SCRIPT_DIR/../.env"
|
||||
|
||||
echo "Purging Cloudflare cache for zone $CF_ZONE_ID"
|
||||
response=$(curl -s -X POST "https://api.cloudflare.com/client/v4/zones/$CF_ZONE_ID/purge_cache" \
|
||||
-H "Authorization: Bearer $CF_API_KEY" \
|
||||
-H "Content-Type: application/json" \
|
||||
--data '{"purge_everything":true}')
|
||||
|
||||
success=$(echo "$response" | grep -o '"success"\s*:\s*true')
|
||||
|
||||
if [ "$success" ]; then
|
||||
echo "Cache purged successfully."
|
||||
else
|
||||
echo "Cache purge failed."
|
||||
echo "Response:"
|
||||
echo "$response"
|
||||
fi
|
||||
Reference in New Issue
Block a user