Aherman3 api docs add zh #6083
Workflow file for this run
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
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions | |
name: Docusaurus | |
on: | |
- push | |
- pull_request | |
jobs: | |
test: | |
name: Test & Build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 # https://github.com/facebook/docusaurus/issues/2798#issuecomment-636602951 | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: 16 | |
cache: 'npm' | |
cache-dependency-path: package.json | |
- name: NPM Install | |
run: npm install | |
- name: Debug | |
run: | | |
git log --since="1 week ago" --name-only --pretty=format: | sort | uniq | |
git log --since="1 week ago" --name-only --pretty=format: | sort | uniq | wc -l | |
- name: NPM Test | |
run: npm test | |
- name: Build | |
run: npm run build | |
deploy: | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
name: Deploy GitHub Pages | |
needs: | |
- test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 # https://github.com/facebook/docusaurus/issues/2798#issuecomment-636602951 | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: 16 | |
cache: 'npm' | |
cache-dependency-path: package.json | |
- name: NPM Install | |
run: npm install | |
- name: Config Git | |
run: | | |
git config --global user.name 'Huan @ GitHub Action' | |
git config --global user.email '[email protected]' | |
- name: Create orphan branch for gh-pages | |
run: | | |
git checkout --orphan gh-pages | |
git reset --hard | |
git commit --allow-empty -m "Orphan init" | |
git checkout main | |
- name: Bind git worktree with new-gh-pages folder and gh-pages branch | |
run: | | |
rm -fr new-gh-pages | |
git worktree add new-gh-pages gh-pages | |
- name: Build and copy all homepage files to new-gh-pages/ together | |
run: | | |
bash -x ./scripts/build-all.sh new-gh-pages | |
- name: Deploy new-gh-pages | |
run: | | |
pushd new-gh-pages | |
git add --all | |
git commit -m "$(jq -r .version ../package.json)" | |
git push -f origin gh-pages | |
popd | |
- name: Unbind new-gh-pages folder from gh-pages branch | |
run: | | |
git worktree remove new-gh-pages | |
git branch -D gh-pages | |
rm -fr new-gh-pages |