Skip to content

卧槽怎么是这个原因啊。 #397

卧槽怎么是这个原因啊。

卧槽怎么是这个原因啊。 #397

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
echo "VitePress site build completed"
# 上传 .vitepress/dist 目录为工件
- name: Upload VitePress site as artifact
uses: actions/upload-artifact@v3
with:
name: vitepress-dist
path: .vitepress/dist
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
# 下载 .vitepress/dist 目录
- name: Download VitePress site artifact
uses: actions/download-artifact@v3
with:
name: vitepress-dist
- 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
GIT_SSH_COMMAND='ssh -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