Skip to content

Commit 9dc36bd

Browse files
committed
Deploy GitHub Pages via GitHub Actions
Signed-off-by: Yuki Okushi <jtitor@2k36.org>
1 parent e507572 commit 9dc36bd

File tree

1 file changed

+22
-21
lines changed

1 file changed

+22
-21
lines changed

.github/workflows/docs.yml

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,35 @@
1-
name: Upload documentation
1+
name: Upload documentation to GitHub Pages
22

33
on:
44
push:
55
branches:
66
- master
77

8+
# Sets permissions of `GITHUB_TOKEN` to allow deployment to GitHub Pages
9+
permissions:
10+
contents: read
11+
pages: write
12+
id-token: write
13+
814
jobs:
9-
upload_docs:
10-
name: Upload documentation
15+
deploy:
16+
environment:
17+
name: github-pages
18+
url: ${{ steps.deployment.outputs.page_url }}
1119
runs-on: ubuntu-22.04
12-
if: github.repository == 'rust-lang/libc'
13-
1420
steps:
15-
- uses: actions/checkout@v3
16-
with:
17-
fetch-depth: 0
21+
- name: Checkout
22+
uses: actions/checkout@v3
1823
- name: Setup Rust toolchain
1924
run: TARGET=x86_64-unknown-linux-gnu sh ./ci/install-rust.sh
2025
- name: Generate documentation
2126
run: LIBC_CI=1 sh ci/dox.sh
22-
- name: Deploy GitHub Pages
23-
run: |
24-
git worktree add gh-pages gh-pages
25-
git config user.name "Deploy from CI"
26-
git config user.email ""
27-
cd gh-pages
28-
# Delete the ref to avoid keeping history.
29-
git update-ref -d refs/heads/gh-pages
30-
rm -rf *
31-
mv ../target/doc/* .
32-
git add .
33-
git commit -m "Deploy $GITHUB_SHA to gh-pages"
34-
git push --force
27+
- name: Setup Pages
28+
uses: actions/configure-pages@v2
29+
- name: Upload artifact
30+
uses: actions/upload-pages-artifact@v1
31+
with:
32+
path: 'target/doc'
33+
- name: Deploy to GitHub Pages
34+
id: deployment
35+
uses: actions/deploy-pages@v1

0 commit comments

Comments
 (0)