Skip to content

Add clone logs.

Add clone logs. #395

Workflow file for this run

name: Build VitePress, Pull Types, and Push to Private Repo
on:
push:
branches: [main]
jobs:
setup-and-build:
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
push-to-private-repo:
needs: setup-and-build
runs-on: self-hosted
steps:
- name: Checkout the code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Git
run: |
git config user.name "GitHub Actions Bot"
git config user.email "<>"
- name: Clone private repo
run: |
if ! grep -q github.com ~/.ssh/known_hosts; then
ssh-keyscan github.com >> ~/.ssh/known_hosts
fi
# 使用 ssh 调试模式 -v 输出调试信息
GIT_SSH_COMMAND='ssh -v -i /home/mihono/.ssh/id_rsa' git clone --depth 1 [email protected]:M1hono/CrychicDocSynchronization.git temp_repo
- name: Copy necessary files
run: |
if [ -d temp_repo/.github ]; then
cp -r temp_repo/.github .vitepress/dist/
fi
if [ -f temp_repo/CNAME ]; then
cp temp_repo/CNAME .vitepress/dist/
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
cleanup:
needs: push-to-private-repo
runs-on: self-hosted
steps:
- name: Remove temporary files
run: |
rm -rf typefiles
rm -rf .vitepress/dist
rm -rf temp_repo