1
0

项目:更新 Actions

This commit is contained in:
周中平 2024-01-10 17:33:34 +08:00
parent 54d6b12242
commit 8d46baf14b
Signed by: zhouzhongping
GPG Key ID: 6666822800008000

View File

@ -2,30 +2,25 @@ name: Build and Deploy Quartz Site
on: on:
push: push:
branches: [ dev ] branches: [ main ]
jobs: jobs:
build-and-deploy: build-and-deploy:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Clone repository (quartz)
# 使用 Git 克隆 Quartz 仓库到指定目录
- name: Clone Quartz repository (quartz)
run: git clone https://${{ secrets.GIT_PUSH_PULL_TOKEN }}@git.7wate.com/zhouzhongping/quartz-wiki.git /wiki/quartz run: git clone https://${{ secrets.GIT_PUSH_PULL_TOKEN }}@git.7wate.com/zhouzhongping/quartz-wiki.git /wiki/quartz
# 克隆 Wiki 仓库到 Quartz 项目的 content 目录 - name: Clone repository (wiki)
- name: Check out repository (Wiki)
run: git clone https://${{ secrets.GIT_PUSH_PULL_TOKEN }}@git.7wate.com/zhouzhongping/wiki.git /wiki/quartz/content 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 20
- name: Set up Node.js
uses: actions/setup-node@v2 uses: actions/setup-node@v2
with: with:
node-version: '20' node-version: '20'
- name: Install Quartz dependencies and Build site - name: Install Quartz dependencies and Build site
run: | run: |
# 进入 Quartz 项目目录,安装依赖并构建网站 # 进入 Quartz 项目目录,安装依赖并构建网站
cd /wiki/quartz cd /wiki/quartz
npm ci npm ci
@ -36,22 +31,20 @@ jobs:
- name: Deploy to HTML branch of current repository (A仓库) - name: Deploy to HTML branch of current repository (A仓库)
run: | run: |
# 设置 Git 用户名和邮箱 # 设置 Git 用户名和邮箱
git config --global user.name "Actions" git config --global user.name "Actions"
git config --global user.email "Actions@7wate.com" git config --global user.email "Actions@7wate.com"
# 在 public 目录下初始化 git 仓库 # 在 public 目录下初始化 git 仓库
cd /wiki/public/ cd /wiki/public/ && git init && git add .
git init
# 添加远程仓库地址
git remote add origin https://${{ secrets.GIT_PUSH_PULL_TOKEN }}@git.7wate.com/zhouzhongping/wiki.git
# 添加所有文件并提交
git add .
# 获取当天日期作为提交信息 # 获取当天日期作为提交信息
DATE=`date '+%Y-%m-%d'` DATE=`date '+%Y-%m-%d'`
git commit -m "Deploy HTML files - $DATE" git commit -m "Deploy HTML files - $DATE"
# 添加远程仓库地址
git remote add origin https://${{ secrets.GIT_PUSH_PULL_TOKEN }}@git.7wate.com/zhouzhongping/wiki.git
# 强制推送到远程的 html 分支 # 强制推送到远程的 html 分支
git checkout -b quartz
git push origin quartz --force git push origin quartz --force