fork/cargo

git clone https://git.julia.blue/fork/cargo

Weihang LoUpdate to mdbook 0.5 (#16292)e90598ede

master
1.6 KiB55 linesraw
1name: Contrib Deploy
2on:
3  push:
4    branches:
5      - master
6
7concurrency:
8  cancel-in-progress: false
9  group: "gh-pages"
10
11permissions:
12  contents: read
13
14env:
15  MDBOOK_VERSION: 0.5.1
16
17jobs:
18  deploy:
19    permissions:
20      contents: write  # for Git to git push
21    runs-on: ubuntu-latest
22    steps:
23    - uses: actions/checkout@v5
24      with:
25        fetch-depth: 0
26    - name: Install mdbook
27      run: |
28        mkdir mdbook
29        curl -Lf https://github.com/rust-lang/mdBook/releases/download/v${MDBOOK_VERSION}/mdbook-v${MDBOOK_VERSION}-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=./mdbook
30        echo `pwd`/mdbook >> $GITHUB_PATH
31    - name: Deploy docs
32      run: |
33        GENERATE_PY="$(pwd)/ci/generate.py"
34
35        cd src/doc/contrib
36        mdbook build
37
38        # Override previous ref to avoid keeping history.
39        git worktree add --orphan -B gh-pages gh-pages
40        git config user.name "Deploy from CI"
41        git config user.email ""
42        cd gh-pages
43        mv ../book contrib
44        git add contrib
45
46        # Generate HTML for link redirections.
47        python3 "$GENERATE_PY"
48        git add *.html
49        # WARN: The CNAME file is for GitHub to redirect requests to the custom domain.
50        # Missing this may entail security hazard and domain takeover.
51        # See <https://docs.github.com/en/pages/configuring-a-custom-domain-for-your-github-pages-site/managing-a-custom-domain-for-your-github-pages-site#securing-your-custom-domain>
52        git add CNAME
53
54        git commit -m "Deploy $GITHUB_SHA to gh-pages"
55        git push origin +gh-pages