Skip to content

Commit 140fe74

Browse files
authored
Create docs.yaml (#81)
Add GitHub action to push the docs to GitHub pages when code is merged to main
1 parent 5f815ca commit 140fe74

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

.github/workflows/docs.yaml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
on:
2+
push:
3+
branches: [main]
4+
5+
env:
6+
rust_version: 1.51.0
7+
8+
jobs:
9+
build-and-deploy:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v2
14+
with:
15+
persist-credentials: false
16+
- uses: actions-rs/toolchain@v1
17+
with:
18+
toolchain: nightly
19+
- name: Generate docs
20+
run: cargo +nightly doc --target-dir ../docs-new --no-deps
21+
env:
22+
RUSTDOCFLAGS: "--enable-index-page -Zunstable-options"
23+
working-directory: sdk
24+
- name: Push the docs
25+
run: |
26+
ls
27+
git checkout -B gh-pages
28+
ls
29+
rm -rf docs
30+
mv docs-new/doc docs
31+
git config --local user.email "[email protected]"
32+
git config --local user.name "GitHub Action (docs)"
33+
git add docs
34+
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
35+
git commit -m 'Add docs'
36+
git push -f origin gh-pages

0 commit comments

Comments
 (0)