#!/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"} AREA=${3:-"overseas"} # 默认为 overseas,因为用户切换到了国际站 echo "Deploying to EdgeOne Pages..." echo "Project: $PROJECT_NAME" echo "Directory: $BUILD_DIR" echo "Area: $AREA" # 3. Execute deployment command # We use npx to run the edgeone CLI without global installation # 注意:国际站必须加 --area overseas 参数 npx edgeone pages deploy "$BUILD_DIR" -n "$PROJECT_NAME" -t "$EDGEONE_API_TOKEN" --area "$AREA" # 4. Check exit code if [ $? -eq 0 ]; then echo "Deployment successful!" else echo "Deployment failed!" exit 1 fi