Files

33 lines
849 B
Bash
Raw Permalink Normal View History

2026-02-01 13:42:02 +08:00
#!/bin/bash
# EdgeOne Pages Deployment Script
# 1. Verify required environment variables
if [ -z "$EDGEONE_API_TOKEN" ]; then
echo "Error: EDGEONE_API_TOKEN is not set."
exit 1
fi
# 2. Set default values if not provided
PROJECT_NAME=${1:-"hugo-blog"}
BUILD_DIR=${2:-"./public"}
2026-02-08 18:48:45 +08:00
AREA=${3:-"overseas"} # 默认为 overseas,因为用户切换到了国际站
2026-02-01 13:42:02 +08:00
echo "Deploying to EdgeOne Pages..."
echo "Project: $PROJECT_NAME"
echo "Directory: $BUILD_DIR"
2026-02-08 18:48:45 +08:00
echo "Area: $AREA"
2026-02-01 13:42:02 +08:00
# 3. Execute deployment command
# We use npx to run the edgeone CLI without global installation
2026-02-08 18:48:45 +08:00
# 注意:国际站必须加 --area overseas 参数
npx edgeone pages deploy "$BUILD_DIR" -n "$PROJECT_NAME" -t "$EDGEONE_API_TOKEN" --area "$AREA"
2026-02-01 13:42:02 +08:00
# 4. Check exit code
if [ $? -eq 0 ]; then
echo "Deployment successful!"
else
echo "Deployment failed!"
exit 1
fi