-
Notifications
You must be signed in to change notification settings - Fork 43
38 lines (37 loc) · 1.59 KB
/
gh-pages.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
on:
push:
branches: [master]
jobs:
gh-pages:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: update rust
run: |
rustup install stable
- name: get metadata.docs.rs.features in Cargo.toml
run: |
docs_features=$(cargo read-manifest | jq -r '.metadata.docs.rs.features | join(",")')
echo DOCS_FEATURES=$docs_features
echo DOCS_FEATURES=$docs_features >> $GITHUB_ENV
- name: cargo doc
run: |
cargo doc --no-deps --features "${{ env.DOCS_FEATURES }}"
- name: push docs
run: |
git submodule deinit --all
git fetch --depth=1 origin gh-pages
git checkout gh-pages
rm -rf docs
mv target/doc docs
echo '<html>' > docs/index.html
echo '<head><meta http-equiv="refresh" content="5; url=./oracle"/></head>' >> docs/index.html
echo '<body><p>Redirect to <a href="./oracle">here</a> in 5 seconds.</p></body>' >> docs/index.html
echo '</html>' >> docs/index.html
sed -i -E 's/(Version [0-9]+\.[0-9]+\.[0-9]+)/\1<br\/>(in development)/g' docs/oracle/index.html docs/oracle/all.html
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action (docs)"
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
git diff --quiet || (git add docs && git commit -m 'Add docs' && git push origin gh-pages && echo Add docs)