Skip to content

Commit 7c10c10

Browse files
committed
ci(deploy-docs): merge with test-docs
1 parent 277d545 commit 7c10c10

File tree

3 files changed

+65
-79
lines changed

3 files changed

+65
-79
lines changed

.github/workflows/ci.yaml

Lines changed: 33 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1517,24 +1517,50 @@ jobs:
15171517
# stable is placed in the root of the gh-pages branch, while master is placed at /devel
15181518
doc: # job-name
15191519
runs-on: ubuntu-latest
1520-
if: ${{ contains('["pull_request", "merge_group"]', github.event_name) }}
15211520
steps:
15221521
- uses: actions/checkout@v4
15231522
with:
15241523
fetch-depth: 0
15251524
- name: Install mdbook
1525+
uses: taiki-e/install-action@v2
1526+
with:
1527+
tool: mdbook
1528+
- name: Prepare directories
1529+
run: |
1530+
mkdir -p ${{ runner.temp }}/book
1531+
mkdir -p ${{ runner.temp }}/book/devel
1532+
mkdir -p ${{ runner.temp }}/book/dev-guide
1533+
- name: Build user-guide (stable)
1534+
if: ${{ !contains('["pull_request", "merge_group"]', github.event_name) }}
1535+
run: |
1536+
git checkout stable
1537+
# Support both old and new directory structure during the transition
1538+
cd doc/user-guide || cd doc
1539+
mdbook build
1540+
mv book ${{ runner.temp }}
1541+
- name: Build user-guide (master)
15261542
run: |
1527-
mkdir mdbook
1528-
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
1529-
echo "`pwd`/mdbook" >> $GITHUB_PATH
1530-
- name: Build user-guide
1531-
run: |
1543+
git checkout master
15321544
cd doc/user-guide
15331545
mdbook build
1534-
- name: Build dev-guide
1546+
mv book ${{ runner.temp }}/book/devel
1547+
- name: Build dev-guide (master)
15351548
run: |
1549+
git checkout master
15361550
cd doc/dev-guide
15371551
mdbook build
1552+
mv book ${{ runner.temp }}/book/dev-guide
1553+
- name: Deploy to GitHub
1554+
if: ${{ !contains('["pull_request", "merge_group"]', github.event_name) }}
1555+
run: |
1556+
cd ${{ runner.temp }}/book
1557+
git init
1558+
git config user.name "Deploy from CI"
1559+
git config user.email ""
1560+
git add . .nojekyll
1561+
git commit -m "Deploy $GITHUB_REF $GITHUB_SHA to gh-pages"
1562+
git remote add origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY
1563+
git push --force --set-upstream origin master:gh-pages
15381564
15391565
# This is ci/actions-templates/conclusion-template.yaml
15401566
# Do not edit this file in .github/workflows

.github/workflows/deploy-docs.yaml

Lines changed: 0 additions & 66 deletions
This file was deleted.

ci/actions-templates/test-docs-template.yaml

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,47 @@ jobs: # skip-all
77
# stable is placed in the root of the gh-pages branch, while master is placed at /devel
88
doc: # job-name
99
runs-on: ubuntu-latest
10-
if: ${{ contains('["pull_request", "merge_group"]', github.event_name) }}
1110
steps:
1211
- uses: actions/checkout@v4
1312
with:
1413
fetch-depth: 0
1514
- name: Install mdbook
15+
uses: taiki-e/install-action@v2
16+
with:
17+
tool: mdbook
18+
- name: Prepare directories
19+
run: |
20+
mkdir -p ${{ runner.temp }}/book
21+
mkdir -p ${{ runner.temp }}/book/devel
22+
mkdir -p ${{ runner.temp }}/book/dev-guide
23+
- name: Build user-guide (stable)
24+
if: ${{ !contains('["pull_request", "merge_group"]', github.event_name) }}
1625
run: |
17-
mkdir mdbook
18-
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
19-
echo "`pwd`/mdbook" >> $GITHUB_PATH
20-
- name: Build user-guide
26+
git checkout stable
27+
# Support both old and new directory structure during the transition
28+
cd doc/user-guide || cd doc
29+
mdbook build
30+
mv book ${{ runner.temp }}
31+
- name: Build user-guide (master)
2132
run: |
33+
git checkout master
2234
cd doc/user-guide
2335
mdbook build
24-
- name: Build dev-guide
36+
mv book ${{ runner.temp }}/book/devel
37+
- name: Build dev-guide (master)
2538
run: |
39+
git checkout master
2640
cd doc/dev-guide
2741
mdbook build
42+
mv book ${{ runner.temp }}/book/dev-guide
43+
- name: Deploy to GitHub
44+
if: ${{ !contains('["pull_request", "merge_group"]', github.event_name) }}
45+
run: |
46+
cd ${{ runner.temp }}/book
47+
git init
48+
git config user.name "Deploy from CI"
49+
git config user.email ""
50+
git add . .nojekyll
51+
git commit -m "Deploy $GITHUB_REF $GITHUB_SHA to gh-pages"
52+
git remote add origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY
53+
git push --force --set-upstream origin master:gh-pages

0 commit comments

Comments
 (0)