diff --git a/.gitignore b/.gitignore index 0fa4003..e800261 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ # Ignore IDE files -.idea/ +.idea/** !.idea/icon.png .vscode/ *.suo diff --git a/.idea/icon.png b/.idea/icon.png new file mode 100644 index 0000000..3581e14 Binary files /dev/null and b/.idea/icon.png differ diff --git a/www/note/deploy.sh b/www/note/deploy.sh index d48f243..7ab0c60 100644 --- a/www/note/deploy.sh +++ b/www/note/deploy.sh @@ -18,6 +18,27 @@ trap cleanup EXIT echo "开始下载最新构建产物..." curl -L -o "$TEMP_DIR/artifact.zip" "$REPO_URL/-/jobs/artifacts/main/download?job=build" +# shellcheck disable=SC2181 +if [ $? -ne 0 ]; then + echo "下载失败,请检查网络连接或重新尝试。" + exit 1 +fi + +# 检查 unzip 是否可用,不可用时自动安装 + +if ! command -v unzip &> /dev/null; then + echo "unzip 未安装,开始安装 ···" + if command -v apt-get &> /dev/null; then + sudo apt-get update + sudo apt-get install -y unzip + elif command -v yum &> /dev/null; then + sudo yum install -y unzip + else + echo "无法安装 unzip,请手动安装。" + exit 1 + fi +fi + echo "解压文件..." unzip -q "$TEMP_DIR/artifact.zip" -d "$TEMP_DIR"