30 lines
681 B
Bash
30 lines
681 B
Bash
#!/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"}
|
|
|
|
echo "Deploying to EdgeOne Pages..."
|
|
echo "Project: $PROJECT_NAME"
|
|
echo "Directory: $BUILD_DIR"
|
|
|
|
# 3. Execute deployment command
|
|
# We use npx to run the edgeone CLI without global installation
|
|
npx edgeone pages deploy "$BUILD_DIR" -n "$PROJECT_NAME" -t "$EDGEONE_API_TOKEN"
|
|
|
|
# 4. Check exit code
|
|
if [ $? -eq 0 ]; then
|
|
echo "Deployment successful!"
|
|
else
|
|
echo "Deployment failed!"
|
|
exit 1
|
|
fi
|