ci on Github Pages #69
This file contains hidden or 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: ci on Github Pages | |
| on: | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Configure Git Credentials | |
| run: | | |
| git config user.name github-actions[bot] | |
| git config user.email 41898282+github-actions[bot]@users.noreply.github.com | |
| - uses: actions/setup-python@v4 | |
| with: | |
| python-version: 3.x | |
| - uses: actions/cache@v3 | |
| with: | |
| path: ~/.cache/pip | |
| key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pip- | |
| - name: Sync README.md | |
| run: | | |
| cp docs/index.md README.md | |
| git config --local user.email "action@github.com" | |
| git config --local user.name "GitHub Action" | |
| if ! git diff --quiet README.md; then | |
| git add README.md | |
| git commit -m "Sync README.md with docs/index.md" | |
| git push | |
| fi | |
| - run: pip install -r requirements.txt | |
| - name: Remove test directory # 删除test目录 | |
| run: rm -rf docs/test | |
| - run: mkdocs gh-deploy --force |