delete zip files. #29
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build VitePress, Pull Types, and Push to Private Repo | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
build-and-push: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout the code | |
uses: actions/checkout@v2 | |
- name: Setup Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '18.17.1' | |
- name: Install dependencies | |
run: yarn install --frozen-lockfile | |
- 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 | |
- name: Build VitePress site | |
run: npm run docs:build | |
- name: Clean up typefiles | |
run: rm -rf typefiles | |
- 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 .vitepress/dist |