Skip to content

Commit

Permalink
Update mdbook.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
hyder authored Dec 15, 2023
1 parent 3521467 commit d3796ff
Showing 1 changed file with 39 additions and 26 deletions.
65 changes: 39 additions & 26 deletions .github/workflows/mdbook.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,37 +17,50 @@ concurrency:
cancel-in-progress: false

jobs:
build-and-publish-book:
install-mdbook:
environment:
name: github-pages
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Install mdbook
run: |
mkdir mdbook
curl -sSL https://github.com/rust-lang/mdBook/releases/download/v0.4.34/mdbook-v0.4.34-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=./mdbook
echo `pwd`/mdbook >> $GITHUB_PATH
- uses: actions/cache@v3
continue-on-error: true
id: cache-mdbook
with:
key: mdbook
path: ./cargo/**/*
- if: ${{ steps.cache-mdbook.outputs.cache-hit != 'true' }}
name: Install mdbook
env:
CARGO_HOME: ./cargo
run: cargo install --locked --force [email protected] [email protected] [email protected] [email protected] [email protected]
- name: Deploy Book to GitHub Pages
run: |
# Build the HTML content
mdbook build -d book/ docs/
- uses: actions/cache@v3
continue-on-error: true
id: deploy-to-github-pages
with:
key: mdbook
path: ./cargo/**/*
- if: ${{ steps.cache-mdbook.outputs.cache-hit != 'true' }}
name: Deploy to GitHub Pages
env:
CARGO_HOME: ./cargo
run: |
# Build the HTML content
mdbook build -d book/ docs/
# Create and switch to the gh-pages work tree
git worktree add gh-pages gh-pages
cd $GITHUB_WORKSPACE/gh-pages
# Create and switch to the gh-pages work tree
git worktree add gh-pages gh-pages
cd $GITHUB_WORKSPACE/gh-pages
git config user.name "GitHub Actions"
git config user.email "[email protected]"
git config user.name "GitHub Actions"
git config user.email "[email protected]"
# Delete the ref to avoid keeping history.
git update-ref -d refs/heads/gh-pages
rm -rf *
# Delete the ref to avoid keeping history.
git update-ref -d refs/heads/gh-pages
rm -rf *
mv $GITHUB_WORKSPACE/docs/book/* $GITHUB_WORKSPACE/gh-pages
touch $GITHUB_WORKSPACE/gh-pages/.nojekyll
mv $GITHUB_WORKSPACE/docs/book/* $GITHUB_WORKSPACE/gh-pages
touch $GITHUB_WORKSPACE/gh-pages/.nojekyll
git add .
git commit -m "Deploy $GITHUB_SHA to gh-pages"
git push --force-with-lease
git add .
git commit -m "Deploy $GITHUB_SHA to gh-pages"
git push --force-with-lease

0 comments on commit d3796ff

Please sign in to comment.