Add PHP test project with GitOps deployment

This commit is contained in:
K3s Admin
2026-01-21 13:40:04 +00:00
parent b93f156e19
commit fe26bf840c

View File

@@ -26,7 +26,8 @@ echo ""
# 步骤 2: 提交到 Git # 步骤 2: 提交到 Git
echo -e "${BLUE}📝 步骤 2/4: 提交代码到 Git...${NC}" echo -e "${BLUE}📝 步骤 2/4: 提交代码到 Git...${NC}"
git add . # 只添加 php-test 目录的文件
git add php-test/
if git diff --staged --quiet; then if git diff --staged --quiet; then
echo -e "${YELLOW}⚠️ 没有需要提交的更改${NC}" echo -e "${YELLOW}⚠️ 没有需要提交的更改${NC}"
else else
@@ -38,11 +39,13 @@ echo ""
# 步骤 3: 推送到远程仓库 # 步骤 3: 推送到远程仓库
echo -e "${BLUE}📤 步骤 3/4: 推送到远程仓库...${NC}" echo -e "${BLUE}📤 步骤 3/4: 推送到远程仓库...${NC}"
if git push; then CURRENT_BRANCH=$(git branch --show-current)
if git push -u origin ${CURRENT_BRANCH}; then
echo -e "${GREEN}✅ 代码已推送到远程仓库${NC}" echo -e "${GREEN}✅ 代码已推送到远程仓库${NC}"
else else
echo -e "${RED}❌ 推送失败,请检查远程仓库配置${NC}" echo -e "${RED}❌ 推送失败,请检查远程仓库配置${NC}"
echo -e "${YELLOW}提示: 使用 'git remote -v' 查看远程仓库配置${NC}" echo -e "${YELLOW}提示: 使用 'git remote -v' 查看远程仓库配置${NC}"
echo -e "${YELLOW}可能需要在 Gitea 中先创建仓库: https://git.u9.net3w.com${NC}"
exit 1 exit 1
fi fi
echo "" echo ""