Skip to content

Commit a157194

Browse files
committed
Auto merge of #2933 - JohnTitor:ghpages-from-gha, r=JohnTitor
Deploy GitHub Pages via GitHub Actions This simplifies the deployment workflow. Tested it works fine on https://github.com/JohnTitor/libc/actions/runs/3151392197, you can also see https://johntitor.github.io/libc/. r? `@ghost` Signed-off-by: Yuki Okushi <[email protected]>
2 parents a2281d3 + 9dc36bd commit a157194

File tree

1 file changed

+22
-21
lines changed

1 file changed

+22
-21
lines changed

.github/workflows/docs.yml

+22-21
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)