Skip to content

ci(deploy-docs): install mdbook with install-action #4157

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jan 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 33 additions & 7 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1517,24 +1517,50 @@ jobs:
# stable is placed in the root of the gh-pages branch, while master is placed at /devel
doc: # job-name
runs-on: ubuntu-latest
if: ${{ contains('["pull_request", "merge_group"]', github.event_name) }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install mdbook
uses: taiki-e/install-action@v2
with:
tool: mdbook
- name: Prepare directories
run: |
mkdir -p ${{ runner.temp }}/book
mkdir -p ${{ runner.temp }}/book/devel
mkdir -p ${{ runner.temp }}/book/dev-guide
- name: Build user-guide (stable)
if: ${{ !contains('["pull_request", "merge_group"]', github.event_name) }}
run: |
git checkout stable
# Support both old and new directory structure during the transition
cd doc/user-guide || cd doc
mdbook build
mv book ${{ runner.temp }}
- name: Build user-guide (master)
run: |
mkdir mdbook
curl -Lf https://github.com/rust-lang/mdBook/releases/download/v0.4.37/mdbook-v0.4.37-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=./mdbook
echo "`pwd`/mdbook" >> $GITHUB_PATH
- name: Build user-guide
run: |
git checkout master
cd doc/user-guide
mdbook build
- name: Build dev-guide
mv book ${{ runner.temp }}/book/devel
- name: Build dev-guide (master)
run: |
git checkout master
cd doc/dev-guide
mdbook build
mv book ${{ runner.temp }}/book/dev-guide
- name: Deploy to GitHub
if: ${{ !contains('["pull_request", "merge_group"]', github.event_name) }}
run: |
cd ${{ runner.temp }}/book
git init
git config user.name "Deploy from CI"
git config user.email ""
git add . .nojekyll
git commit -m "Deploy $GITHUB_REF $GITHUB_SHA to gh-pages"
git remote add origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY
git push --force --set-upstream origin master:gh-pages

# This is ci/actions-templates/conclusion-template.yaml
# Do not edit this file in .github/workflows
Expand Down
55 changes: 0 additions & 55 deletions .github/workflows/deploy-docs.yaml

This file was deleted.

38 changes: 32 additions & 6 deletions ci/actions-templates/test-docs-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,47 @@ jobs: # skip-all
# stable is placed in the root of the gh-pages branch, while master is placed at /devel
doc: # job-name
runs-on: ubuntu-latest
if: ${{ contains('["pull_request", "merge_group"]', github.event_name) }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install mdbook
uses: taiki-e/install-action@v2
with:
tool: mdbook
- name: Prepare directories
run: |
mkdir -p ${{ runner.temp }}/book
mkdir -p ${{ runner.temp }}/book/devel
mkdir -p ${{ runner.temp }}/book/dev-guide
- name: Build user-guide (stable)
if: ${{ !contains('["pull_request", "merge_group"]', github.event_name) }}
run: |
mkdir mdbook
curl -Lf https://github.com/rust-lang/mdBook/releases/download/v0.4.37/mdbook-v0.4.37-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=./mdbook
echo "`pwd`/mdbook" >> $GITHUB_PATH
- name: Build user-guide
git checkout stable
# Support both old and new directory structure during the transition
cd doc/user-guide || cd doc
mdbook build
mv book ${{ runner.temp }}
- name: Build user-guide (master)
run: |
git checkout master
cd doc/user-guide
mdbook build
- name: Build dev-guide
mv book ${{ runner.temp }}/book/devel
- name: Build dev-guide (master)
run: |
git checkout master
cd doc/dev-guide
mdbook build
mv book ${{ runner.temp }}/book/dev-guide
- name: Deploy to GitHub
if: ${{ !contains('["pull_request", "merge_group"]', github.event_name) }}
run: |
cd ${{ runner.temp }}/book
git init
git config user.name "Deploy from CI"
git config user.email ""
git add . .nojekyll
git commit -m "Deploy $GITHUB_REF $GITHUB_SHA to gh-pages"
git remote add origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY
git push --force --set-upstream origin master:gh-pages
Loading