feat(post): add Saturating #121
Workflow file for this run
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: Deploy Book | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
types: | |
- opened | |
- synchronize | |
jobs: | |
book: | |
name: Build mdBook and Deploy | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup mdBook | |
uses: peaceiris/actions-mdbook@v2 | |
with: | |
mdbook-version: latest | |
- name: Setup mbBook linkcheck | |
run: | | |
mkdir -p mdbook-linkcheck && cd "$_" && \ | |
curl -L https://github.com/Michael-F-Bryan/mdbook-linkcheck/releases/latest/download/mdbook-linkcheck.x86_64-unknown-linux-gnu.zip -o mdbook-linkcheck.zip && \ | |
unzip "$_" && \ | |
chmod +x mdbook-linkcheck && \ | |
export PATH=$PWD:$PATH && \ | |
echo "$PWD" >> $GITHUB_PATH | |
- name: Get site url | |
env: | |
repo: ${{ github.event.repository.name }} | |
run: | | |
# Construct $url from repo name | |
# Repo name can be "rust-tieng-viet" or "rust-tieng-viet.github.io" | |
export url="https://${repo//.github.io/}.github.io" | |
echo $url | |
echo "url=$url" >> $GITHUB_ENV | |
echo "Book URL: $url" >> $GITHUB_STEP_SUMMARY | |
- name: Build mdBook | |
run: mdbook build | |
- name: Generate sitemap | |
run: | | |
cd book/html | |
npx static-sitemap-cli --base ${{ env.url }} | |
cat sitemap.xml | |
- name: Comment PR | |
if: github.event_name == 'pull_request' | |
uses: thollander/actions-comment-pull-request@v2 | |
with: | |
message: Build book successfully! | |
reactions: tada | |
comment_tag: build_book | |
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }} | |
- name: Deploy to GitHub | |
if: github.event_name == 'push' | |
id: deploy | |
uses: JamesIves/[email protected] | |
with: | |
branch: gh-pages | |
folder: book/html | |
- name: Comment Commit | |
if: github.event_name == 'push' && steps.deploy.outputs.deployment-status == 'success' | |
uses: peter-evans/commit-comment@v3 | |
with: | |
body: Deploy successfully ${{ env.url }}! | |
token: ${{ secrets.BOT_TOKEN }} |