This repository has been archived by the owner on Aug 7, 2024. It is now read-only.
forked from rust-lang/cargo
-
Notifications
You must be signed in to change notification settings - Fork 0
52 lines (45 loc) · 1.51 KB
/
contrib.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
name: Contrib Deploy
on:
push:
branches:
- master
concurrency:
cancel-in-progress: false
group: "gh-pages"
permissions:
contents: read
jobs:
deploy:
permissions:
contents: write # for Git to git push
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install mdbook
run: |
mkdir mdbook
curl -Lf https://github.com/rust-lang/mdBook/releases/download/v0.4.40/mdbook-v0.4.40-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=./mdbook
echo `pwd`/mdbook >> $GITHUB_PATH
- name: Deploy docs
run: |
GENERATE_PY="$(pwd)/ci/generate.py"
cd src/doc/contrib
mdbook build
# Override previous ref to avoid keeping history.
git worktree add --orphan -B gh-pages gh-pages
git config user.name "Deploy from CI"
git config user.email ""
cd gh-pages
mv ../book contrib
git add contrib
# Generate HTML for link redirections.
python3 "$GENERATE_PY"
git add *.html
# WARN: The CNAME file is for GitHub to redirect requests to the custom domain.
# Missing this may entail security hazard and domain takeover.
# 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>
git add CNAME
git commit -m "Deploy $GITHUB_SHA to gh-pages"
git push origin +gh-pages