From 8d46baf14b9a18f77342418a7feecfcc37bd9338 Mon Sep 17 00:00:00 2001 From: zhouzhongping Date: Wed, 10 Jan 2024 17:33:34 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=EF=BC=9A=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=20Actions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/cicd.yaml | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-) diff --git a/.gitea/workflows/cicd.yaml b/.gitea/workflows/cicd.yaml index 45c8a804..99a63dc1 100644 --- a/.gitea/workflows/cicd.yaml +++ b/.gitea/workflows/cicd.yaml @@ -2,30 +2,25 @@ name: Build and Deploy Quartz Site on: push: - branches: [ dev ] + branches: [ main ] jobs: build-and-deploy: runs-on: ubuntu-latest steps: - - # 使用 Git 克隆 Quartz 仓库到指定目录 - - name: Clone Quartz repository (quartz) + - name: Clone repository (quartz) run: git clone https://${{ secrets.GIT_PUSH_PULL_TOKEN }}@git.7wate.com/zhouzhongping/quartz-wiki.git /wiki/quartz - - # 克隆 Wiki 仓库到 Quartz 项目的 content 目录 - - name: Check out repository (Wiki) + + - name: Clone repository (wiki) run: git clone https://${{ secrets.GIT_PUSH_PULL_TOKEN }}@git.7wate.com/zhouzhongping/wiki.git /wiki/quartz/content - # 设置 Node.js 环境 - - name: Set up Node.js + - name: Set up Node.js 20 uses: actions/setup-node@v2 with: node-version: '20' - name: Install Quartz dependencies and Build site run: | - # 进入 Quartz 项目目录,安装依赖并构建网站 cd /wiki/quartz npm ci @@ -36,22 +31,20 @@ jobs: - name: Deploy to HTML branch of current repository (A仓库) run: | - # 设置 Git 用户名和邮箱 git config --global user.name "Actions" git config --global user.email "Actions@7wate.com" # 在 public 目录下初始化 git 仓库 - cd /wiki/public/ - git init - # 添加远程仓库地址 - git remote add origin https://${{ secrets.GIT_PUSH_PULL_TOKEN }}@git.7wate.com/zhouzhongping/wiki.git + cd /wiki/public/ && git init && git add . - # 添加所有文件并提交 - git add . # 获取当天日期作为提交信息 DATE=`date '+%Y-%m-%d'` git commit -m "Deploy HTML files - $DATE" + # 添加远程仓库地址 + git remote add origin https://${{ secrets.GIT_PUSH_PULL_TOKEN }}@git.7wate.com/zhouzhongping/wiki.git + # 强制推送到远程的 html 分支 - git push origin quartz --force + git checkout -b quartz + git push origin quartz --force \ No newline at end of file