670 class #185
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 and deploy mdBook site | |
on: | |
push: | |
branches: ["main"] | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
build: | |
name: Build with mdBook | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
lfs: true | |
- uses: cargo-bins/cargo-binstall@main | |
- name: Install mdBook, mdBook-KaTeX, mdBook-ToC, and mdBook-Header-Footer | |
run: cargo binstall -y mdbook mdbook-katex mdbook-toc mdbook_header_footer | |
- name: Install minify-html | |
run: | | |
curl -LO https://github.com/wilsonzlin/minify-html/releases/download/v0.15.0/minhtml-0.15.0-x86_64-unknown-linux-gnu | |
chmod +x minhtml-0.15.0-x86_64-unknown-linux-gnu | |
- name: Build | |
run: mdbook build | |
- name: Generate sitemap | |
uses: cicirello/generate-sitemap@v1 | |
with: | |
path-to-root: _site | |
base-url-path: https://sichanghe.github.io/ | |
- name: Remove dummy CV for search indexing, making clicks fall through to the other repository's pages | |
run: rm _site/curriculum_vitae/index.html | |
- name: Minify HTML and CSS | |
run: find _site -type f \( -name "*.html" -o -name "*.css" \) -print0 | xargs -0 ./minhtml-0.15.0-x86_64-unknown-linux-gnu | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v3 | |
deploy: | |
name: Deploy the site to GitHub Pages | |
needs: build | |
if: github.event_name == 'push' | |
permissions: | |
pages: write | |
id-token: write | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |