-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
39 additions
and
26 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 |