2024-05-24 22:45:59 +08:00
|
|
|
name: "CI"
|
|
|
|
|
|
|
|
on:
|
2024-05-24 22:47:14 +08:00
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- main
|
2024-05-24 22:45:59 +08:00
|
|
|
pull_request:
|
|
|
|
branches:
|
|
|
|
- main
|
|
|
|
|
|
|
|
jobs:
|
2024-05-25 00:15:38 +08:00
|
|
|
build:
|
2024-05-24 23:00:03 +08:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2024-05-25 00:15:38 +08:00
|
|
|
- uses: actions/checkout@v4
|
2024-05-25 00:26:15 +08:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
2024-05-25 00:15:38 +08:00
|
|
|
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
|
|
|
- name: Install plugin
|
|
|
|
run: cargo install --path helpers/mdbook-exercise-linker
|
|
|
|
- uses: taiki-e/install-action@v2
|
|
|
|
with:
|
|
|
|
tool: mdbook
|
2024-05-24 22:45:59 +08:00
|
|
|
- name: Build book
|
|
|
|
run: |
|
|
|
|
cd book
|
2024-05-25 00:15:38 +08:00
|
|
|
mdbook build
|
2024-05-24 22:45:59 +08:00
|
|
|
- name: Link Checker
|
|
|
|
uses: lycheeverse/lychee-action@v1
|
|
|
|
with:
|
|
|
|
fail: true
|
|
|
|
args: |
|
|
|
|
--exclude-loopback
|
|
|
|
--require-https
|
|
|
|
--no-progress
|
|
|
|
book/book
|
2024-05-25 00:15:38 +08:00
|
|
|
# Upload the book as an artifact
|
|
|
|
- uses: actions/upload-artifact@v4
|
|
|
|
with:
|
|
|
|
name: book
|
|
|
|
path: book/book
|
|
|
|
# Commit and push all changed files.
|
|
|
|
# Must only affect files that are listed in "paths-ignore".
|
|
|
|
- name: Git commit build artifacts
|
|
|
|
# Only run on main branch push (e.g. pull request merge).
|
|
|
|
if: github.event_name == 'push'
|
|
|
|
run: |
|
2024-05-25 00:26:59 +08:00
|
|
|
git checkout -b deploy
|
2024-05-25 00:20:45 +08:00
|
|
|
git config --global user.name "Deployer"
|
2024-05-25 00:15:38 +08:00
|
|
|
git config --global user.email "username@users.noreply.github.com"
|
|
|
|
git add --force book/book
|
2024-05-25 00:20:45 +08:00
|
|
|
git commit -m "Render book"
|
2024-05-25 00:15:38 +08:00
|
|
|
git push --set-upstream --force-with-lease origin deploy
|
|
|
|
|
|
|
|
formatter:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- uses: dprint/check@v2.2
|