Skip to content

Merge pull request #94 from QiHuang02/branch-EEJS #416

Merge pull request #94 from QiHuang02/branch-EEJS

Merge pull request #94 from QiHuang02/branch-EEJS #416

Workflow file for this run

name: Build VitePress, Pull Types, and Push to Private Repo
on:
push:
branches: [main]
jobs:
setup-build-and-push:
runs-on: self-hosted
steps:
- name: Checkout the code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Pull types from type repo
run: |
if ! grep -q github.com ~/.ssh/known_hosts; then
ssh-keyscan github.com >> ~/.ssh/known_hosts
fi
GIT_SSH_COMMAND='ssh -i /home/mihono/.ssh/id_rsa' git clone --depth 1 [email protected]:M1hono/CrychicDocTypes.git type_repo
cp -r type_repo/typefiles .
rm -rf type_repo
echo "Types pulled successfully"
- name: Configure Yarn to use a faster registry
run: yarn config set registry https://registry.npmmirror.com
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: "20.17.0"
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Build VitePress site
env:
NODE_OPTIONS: --max-old-space-size=8192
run: |
echo "Building VitePress site..."
yarn docs:build
echo "VitePress site build completed"
- name: Setup Git
run: |
git config user.name "GitHub Actions Bot"
git config user.email "<>"
# 修改这部分来从新仓库拉取 workflow
- name: Copy workflow file
run: |
# 创建目标目录
mkdir -p .vitepress/dist/.github/workflows/ || exit 1
# 从新仓库克隆 workflow 文件
GIT_SSH_COMMAND='ssh -i /home/mihono/.ssh/id_rsa' git clone --depth 1 [email protected]:M1hono/CrychicDocWorkflow.git workflow_repo
# 复制 workflow 文件
cp workflow_repo/.github/workflows/deploy.yml .vitepress/dist/.github/workflows/ || exit 1
# 清理临时仓库
rm -rf workflow_repo
if [ -f .vitepress/dist/.github/workflows/deploy.yml ]; then
echo "Workflow 文件复制成功"
else
echo "错误:Workflow 文件复制失败"
exit 1
fi
- name: Push to private repo
run: |
cd .vitepress/dist
git init
git add -A
git commit -m "Update documentation"
GIT_SSH_COMMAND='ssh -i /home/mihono/.ssh/id_rsa' git push --force [email protected]:M1hono/CrychicDocSynchronization.git HEAD:main
echo "Push completed"
- name: Cleanup
run: |
rm -rf typefiles
rm -rf .vitepress/dist
rm -rf temp_repo
echo "Cleanup completed"