pub.seven.blog/getCommitID.sh
2025-01-05 16:42:57 +08:00

19 lines
412 B
Bash

#!/bin/sh
BUILD_ID=$(git rev-parse --short HEAD)
BUILD_URL="https://git.sunyz.net/realSunyz/pub.seven.blog/commit/$BUILD_ID"
if [ "$CF_PAGES_BRANCH" = "main" ]; then
BUILD_CHANNEL="production"
elif [ "$CF_PAGES_BRANCH" = "dev" ]; then
BUILD_CHANNEL="development"
else
BUILD_CHANNEL="unknown"
fi
cat <<EOF > data/Build.json
{
"ID": "$BUILD_ID",
"URL": "$BUILD_URL",
"Channel": "$BUILD_CHANNEL"
}
EOF