Skip to content

Commit bebfcb0

Browse files
authored
Merge pull request #405 from ehuss/gh-pages-deploy
Switch docs deployment to use artifact upload
2 parents 5cbeaad + e1247fa commit bebfcb0

File tree

1 file changed

+23
-15
lines changed

1 file changed

+23
-15
lines changed

.github/workflows/docs.yml

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@ permissions:
88
contents: read
99

1010
jobs:
11-
deploy:
12-
permissions:
13-
contents: write # for Git to git push
11+
build:
1412
runs-on: ubuntu-latest
1513
env:
1614
MDBOOK_VERSION: 0.4.51
@@ -23,18 +21,28 @@ jobs:
2321
mkdir mdbook
2422
curl -Lf https://github.com/rust-lang/mdBook/releases/download/v${MDBOOK_VERSION}/mdbook-v${MDBOOK_VERSION}-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=./mdbook
2523
echo `pwd`/mdbook >> $GITHUB_PATH
26-
- name: Deploy docs
24+
- name: Build the book
2725
run: |
2826
cd guide
2927
mdbook build
30-
git worktree add gh-pages
31-
git config user.name "Deploy from CI"
32-
git config user.email ""
33-
cd gh-pages
34-
# Delete the ref to avoid keeping history.
35-
git update-ref -d refs/heads/gh-pages
36-
rm -rf *
37-
mv ../book/* .
38-
git add .
39-
git commit -m "Deploy $GITHUB_SHA to gh-pages"
40-
git push --force --set-upstream origin gh-pages
28+
- name: Upload Artifact
29+
uses: actions/upload-pages-artifact@v3
30+
with:
31+
path: ./guide/book
32+
33+
deploy:
34+
needs: build
35+
36+
permissions:
37+
pages: write
38+
id-token: write
39+
40+
environment:
41+
name: github-pages
42+
url: ${{ steps.deployment.outputs.page_url }}
43+
44+
runs-on: ubuntu-latest
45+
steps:
46+
- name: Deploy to GitHub Pages
47+
id: deployment
48+
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)