Deploy Docs #288
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: Deploy Docs | |
on: | |
schedule: | |
# GMT+8 00:00 | |
- cron: '0 16 * * *' | |
workflow_dispatch: | |
# https://docs.github.com/zh/enterprise-cloud@latest/actions/using-jobs/using-concurrency | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.number || github.sha }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
if: ${{ github.repository_owner == 'wangxiang4' }} | |
steps: | |
# https://github.com/actions/checkout | |
- name: Checkout | |
uses: actions/checkout@v3 | |
# https://github.com/pnpm/action-setup | |
- name: Setup pnpm | |
uses: pnpm/action-setup@v2 | |
# https://github.com/actions/setup-node | |
- name: Setup node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
- name: Get pnpm store directory | |
id: pnpm-cache | |
run: | | |
echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT | |
# https://github.com/actions/cache | |
- uses: actions/cache@v3 | |
name: Setup pnpm cache | |
with: | |
# https://docs.github.com/zh/[email protected]/actions/using-workflows/caching-dependencies-to-speed-up-workflows | |
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }} | |
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm-store- | |
- name: Install dependencies | |
run: pnpm i --frozen-lockfile | |
- name: Build website | |
run: pnpm docs:build | |
env: | |
DOC_ENV: production | |
NODE_OPTIONS: --max-old-space-size=4096 | |
# https://github.com/JamesIves/github-pages-deploy-action | |
- name: Deploy to Github Pages | |
uses: JamesIves/[email protected] | |
with: | |
token: ${{ secrets.ACTION_GITHUB_TOKEN }} | |
branch: docs | |
folder: docs/.vitepress/dist | |
git-config-name: wangxiang4 | |
git-config-email: [email protected] | |
commit-message: website deploy github pages | |
# https://github.com/JamesIves/github-pages-deploy-action | |
- name: Deploy to Vercel | |
uses: JamesIves/[email protected] | |
with: | |
token: ${{ secrets.ACTION_GITHUB_TOKEN }} | |
branch: main | |
folder: docs/.vitepress/dist | |
repository-name: wangxiang4/vercel-publish | |
git-config-name: wangxiang4 | |
git-config-email: [email protected] | |
# Sync Third Party Triggering Deploy Hook | |
# https://vercel.com/docs/concepts/git/deploy-hooks | |
- name: Sync | |
env: | |
TRIGGERSYNCURL: ${{ secrets.TRIGGERSYNCURL }} | |
run: curl -k "$TRIGGERSYNCURL" |