feat: 修正发布脚本报错 #2
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: Deploy to GitHub Pages | |
| on: | |
| push: | |
| branches: [main] | |
| # Allows you to run this workflow manually from the Actions tab | |
| workflow_dispatch: | |
| # Sets permissions of the GITHUB_TOKEN to allow pushing to gh-pages branch | |
| permissions: | |
| contents: write | |
| env: | |
| MDBOOK_VERSION: 0.5.1 | |
| jobs: | |
| deploy: | |
| name: Build and Deploy | |
| runs-on: ubuntu-latest | |
| steps: | |
| # 1. 安装依赖 | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust | |
| run: | | |
| rustup set profile minimal | |
| rustup toolchain install 1.90 -c rust-docs | |
| rustup default 1.90 | |
| - name: Install mdbook | |
| run: | | |
| mkdir bin | |
| curl -sSL https://github.com/rust-lang/mdBook/releases/download/v${MDBOOK_VERSION}/mdbook-v${MDBOOK_VERSION}-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=bin | |
| echo "$(pwd)/bin" >> "${GITHUB_PATH}" | |
| # 2. 编译 | |
| - name: Build book | |
| run: mdbook build | |
| # 3. 上传产物到 gh-pages | |
| - name: Deploy to GitHub Pages | |
| uses: peaceiris/actions-gh-pages@v3 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_dir: ./book | |
| publish_branch: gh-pages | |
| force_orphan: true |