Skip to content

Merge pull request #105 from cyb3rpsych0s1s/chore/ci #88

Merge pull request #105 from cyb3rpsych0s1s/chore/ci

Merge pull request #105 from cyb3rpsych0s1s/chore/ci #88

Workflow file for this run

name: Pages
on:
push:
branches:
- main
paths:
- ".github/**"
- "book/book.toml"
- "book/pages/**"
- "**.md"
env:
MDBOOK_VERSION: '0.4.37'
MDBOOK_CODEBLOCKS_VERSION: '0.1.13'
MDBOOK_ADMONISH_VERSION: '1.15.0'
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install mdbook
run: |
mkdir mdbook
curl -sSL https://github.com/rust-lang/mdBook/releases/download/v${{ env.MDBOOK_VERSION }}/mdbook-v${{ env.MDBOOK_VERSION }}-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=./mdbook
echo `pwd`/mdbook >> $GITHUB_PATH
- name: Install mdbook-codeblocks
run: |
mkdir mdbook-codeblocks
curl -sSL https://github.com/Roms1383/mdbook-codeblocks/releases/download/v${{ env.MDBOOK_CODEBLOCKS_VERSION }}/mdbook-codeblocks-v${{ env.MDBOOK_CODEBLOCKS_VERSION }}-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=./mdbook-codeblocks
echo `pwd`/mdbook-codeblocks >> $GITHUB_PATH
- name: Install mdbook-admonish
run: |
mkdir mdbook-admonish
curl -sSL https://github.com/tommilligan/mdbook-admonish/releases/download/v${{ env.MDBOOK_ADMONISH_VERSION }}/mdbook-admonish-v${{ env.MDBOOK_ADMONISH_VERSION }}-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=./mdbook-codeblocks
echo `pwd`/mdbook-admonish >> $GITHUB_PATH
- name: Setup rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Deploy GitHub Pages
run: |
(cd book && mdbook build)
git worktree add gh-pages
git config user.name "Deploy from CI"
git config user.email ""
cd gh-pages
# Delete the ref to avoid keeping history.
git update-ref -d refs/heads/gh-pages
rm -rf *
mv ../book/site/html/* .
git add .
git commit -m "Deploy $GITHUB_SHA to gh-pages"
git push --force --set-upstream origin gh-pages