Skip to content

Merge branch 'main' of https://github.com/CrychicTeam/CrychicDoc #258

Merge branch 'main' of https://github.com/CrychicTeam/CrychicDoc

Merge branch 'main' of https://github.com/CrychicTeam/CrychicDoc #258

Workflow file for this run

name: Build VitePress, Pull Types, and Push to Private Repo
on:
push:
branches: [ main ]
jobs:
pull-types:
runs-on: self-hosted
steps:
- name: Checkout the code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Pull types from type repo
env:
TYPE_REPO_TOKEN: ${{ secrets.TYPE_REPO_TOKEN }}
run: |
git clone --depth 1 https://${TYPE_REPO_TOKEN}@github.com/M1hono/CrychicDocTypes.git type_repo
cp -r type_repo/typefiles .
rm -rf type_repo
setup-and-build:
runs-on: self-hosted
needs: pull-types
steps:
- name: Checkout the code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Configure Yarn to use a faster registry
run: yarn config set registry https://registry.npmmirror.com
- name: Install dependencies
run: |
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
nvm use 20.17.0
yarn install --frozen-lockfile
- name: Fix permissions for .vitepress folder
run: |
sudo chmod -R 777 .vitepress
sudo chmod -R 777 node_modules
- name: Build VitePress site
run: |
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
nvm use 20.17.0
yarn docs:build
- name: Fix permissions after build
run: sudo chmod -R 777 .vitepress
- name: Push to private repo
env:
PRIVATE_REPO_TOKEN: ${{ secrets.PRIVATE_REPO_TOKEN }}
run: |
cd .vitepress/dist
git init
git config user.name "GitHub Actions Bot"
git config user.email "<>"
git clone --depth 1 https://${PRIVATE_REPO_TOKEN}@github.com/M1hono/CrychicDocSynchronization.git temp_repo
if [ -d temp_repo/.github ]; then
cp -r temp_repo/.github .
fi
rm -rf temp_repo
git add -A
git commit -m "Update documentation"
git push --force https://${PRIVATE_REPO_TOKEN}@github.com/M1hono/CrychicDocSynchronization.git HEAD:main
cd ../..
rm -rf typefiles
rm -rf .vitepress/dist