Skip to content

add new files

add new files #7

Workflow file for this run

name: Deploy GitHub Pages
on:
push:
branches: ["main", "book"]
workflow_dispatch:
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
# Build job
build:
runs-on: ubuntu-latest
env:
MDBOOK_VERSION: 0.4.44
EMBEDIFY_VERSION: 0.2.11
ALERTS_VERSION: 0.7.0
steps:
- name: Checkout site source
uses: actions/checkout@v4
- name: Download mdBook
run: |
set -x
wget https://github.com/rust-lang/mdBook/releases/download/v${MDBOOK_VERSION}/mdbook-v${MDBOOK_VERSION}-x86_64-unknown-linux-gnu.tar.gz
tar xzf mdbook-v${MDBOOK_VERSION}-x86_64-unknown-linux-gnu.tar.gz
wget https://github.com/MR-Addict/mdbook-embedify/releases/download/${EMBEDIFY_VERSION}/mdbook-embedify-${EMBEDIFY_VERSION}-x86_64-unknown-linux-gnu.zip
unzip mdbook-embedify-${EMBEDIFY_VERSION}-x86_64-unknown-linux-gnu.zip
mv mdbook-embedify-${EMBEDIFY_VERSION}-x86_64-unknown-linux-gnu/mdbook-embedify .
wget https://github.com/lambdalisue/rs-mdbook-alerts/releases/download/v${ALERTS_VERSION}/mdbook-alerts-x86_64-unknown-linux-gnu
mv mdbook-alerts-x86_64-unknown-linux-gnu mdbook-alerts
chmod +x mdbook-alerts
#- name: Setup Pages
# uses: actions/configure-pages@v5
- name: Generate pages
run: |
export PATH=$PATH:.
./mdbook build book/
perl -i -p -e 's{href="index.html"}{href="."}g' book/book/toc.js
perl -i -p -e 's{(href="[a-zA-Z0-9.][^"]+)\.html"}{$1"}g' book/book/toc.js
find book/book/ -name *.html | xargs perl -i -p -e 's{href="index.html"}{href="."}g'
find book/book/ -name *.html | xargs perl -i -p -e 's{(href="[a-zA-Z0-9.][^"]+)\.html"}{$1"}g'
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: book/book/
# Deployment job
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4