Skip to content

Commit

Permalink
ci(deploy-docs): merge with test-docs
Browse files Browse the repository at this point in the history
  • Loading branch information
rami3l committed Jan 17, 2025
1 parent fe9dce7 commit 69f8d66
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 79 deletions.
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
66 changes: 0 additions & 66 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

0 comments on commit 69f8d66

Please sign in to comment.