Update actions/checkout action to v4.1.5 #224
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: | |
- main | |
pull_request: | |
jobs: | |
mdbook: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5 | |
with: | |
fetch-depth: 0 | |
- name: setup mdbook | |
uses: peaceiris/[email protected] | |
with: | |
mdbook-version: 'latest' | |
- name: preprocess | |
shell: bash | |
run: ./prepro.sh | |
- name: build | |
run: mdbook build | |
- name: prepare deploy | |
run: | | |
git config --local user.name "github-actions[bot]" | |
git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
git worktree add gh-pages gh-pages | |
cd gh-pages | |
# Delete the ref to avoid keeping history. | |
git update-ref -d refs/heads/gh-pages | |
rm -rf ./* | |
mv ../book/* . | |
git add . | |
git commit -m "Deploy $GITHUB_SHA to gh-pages" | |
- name: deploy | |
if: ${{ github.ref == 'refs/heads/main' }} | |
working-directory: ./gh-pages | |
run: | | |
git push -f origin gh-pages |