fix #234
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: mdbook | |
on: | |
push: | |
branches: [ "master" ] | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Dependency | |
run: | | |
cd .. | |
mkdir dep | |
cd dep | |
# wget https://ftp.kevinzonda.com/dist/mdbook%400.4.37-x64/mdbook | |
wget -qO- https://github.com/rust-lang/mdBook/releases/download/v0.4.40/mdbook-v0.4.40-x86_64-unknown-linux-gnu.tar.gz | tar xvz | |
# wget https://ftp.kevinzonda.com/dist/mdbook-katex%400.8.0-x64/mdbook-katex | |
wget -qO- https://github.com/lzanini/mdbook-katex/releases/download/0.9.0-binaries/mdbook-katex-v0.9.0-x86_64-unknown-linux-gnu.tar.gz | tar xvz | |
# wget https://ftp.kevinzonda.com/dist/mdbook-mermaid%400.13.0-x64/mdbook-mermaid | |
wget -qO- https://github.com/badboy/mdbook-mermaid/releases/download/v0.13.0/mdbook-mermaid-v0.13.0-x86_64-unknown-linux-gnu.tar.gz | tar xvz | |
# wget https://ftp.kevinzonda.com/dist/mdbook-open-on-gh%402.4.3-x64/mdbook-open-on-gh | |
wget -qO- https://github.com/badboy/mdbook-open-on-gh/releases/download/2.4.3/mdbook-open-on-gh-2.4.3-x86_64-unknown-linux-gnu.tar.gz | tar xvz | |
# wget https://ftp.kevinzonda.com/dist/mdbook-pagetoc%400.2.0-x64/mdbook-pagetoc | |
wget -qO- https://github.com/slowsage/mdbook-pagetoc/releases/download/v0.2.0/mdbook-pagetoc-v0.2.0-aarch64-unknown-linux-gnu.tar.gz | tar xvz | |
# wget https://ftp.kevinzonda.com/dist/mdbook-admonish%401.16.0-x64/mdbook-admonish | |
wget -qO- https://github.com/tommilligan/mdbook-admonish/releases/download/v1.16.0/mdbook-admonish-v1.16.0-x86_64-unknown-linux-gnu.tar.gz | tar xvz | |
chmod +x * | |
echo "$(pwd)" >> $GITHUB_PATH | |
cd ../MLBook | |
- name: Build book | |
run: | | |
chmod +x *.sh | |
sh ./preprocess.sh | |
mdbook build --dest-dir ../out | |
git reset --hard HEAD | |
- name: Patch dist | |
run: | | |
rm -rf ../out/.git | |
rm -rf ../out/*.py | |
rm -rf ../out/*.sh | |
commit=$(git rev-parse HEAD) | |
branch=$(git rev-parse --abbrev-ref HEAD) | |
date=$(date "+%Y-%m-%d %H:%M:%S UTC%:z") | |
echo $commit > ../out/COMMIT.html | |
echo $branch > ../out/HEAD.html | |
echo "$date" > ../out/DATE.html | |
echo 'pong' > ../out/ping.html | |
echo $branch > ../out/GIT_INFO.html | |
echo $commit >> ../out/GIT_INFO.html | |
echo "$date" >> ../out/GIT_INFO.html | |
- name: Deploy | |
run: | | |
sh ./postprocess.sh | |
git fetch | |
git pull --force | |
git checkout gh-pages | |
git fetch | |
git pull --force | |
git config user.name KevinZonda | |
git config user.email [email protected] | |
ls | grep -xv ".git" | xargs rm -fr | |
mv ../out/* . | |
echo 1 >> .nojekyll | |
echo mlbook.dev > CNAME | |
git add . | |
git commit -m "docs(sync): `date "+%Y-%m-%d %H:%M:%S UTC%:z"`" || true | |
git push |