Skip to content

Commit ed4ade3

Browse files
updated gh-pages CI deployment script
1 parent a6c9dea commit ed4ade3

File tree

1 file changed

+22
-15
lines changed

1 file changed

+22
-15
lines changed

.github/workflows/deploy.yml

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,14 @@ on:
33
push:
44
branches:
55
- master
6+
workflow_dispatch:
67

8+
permissions:
9+
contents: read
10+
pages: write
11+
id-token: write
712
jobs:
8-
deploy:
13+
build:
914
runs-on: ubuntu-latest
1015
steps:
1116
- uses: actions/checkout@v3
@@ -16,17 +21,19 @@ jobs:
1621
mkdir mdbook
1722
curl -sSL https://github.com/rust-lang/mdBook/releases/download/v0.4.14/mdbook-v0.4.14-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=./mdbook
1823
echo `pwd`/mdbook >> $GITHUB_PATH
19-
- name: Deploy GitHub Pages
20-
run: |
21-
mdbook build
22-
git worktree add gh-pages
23-
git config user.name "Deploy from CI"
24-
git config user.email ""
25-
cd gh-pages
26-
# Delete the ref to avoid keeping history.
27-
git update-ref -d refs/heads/gh-pages
28-
rm -rf *
29-
mv ../book/* .
30-
git add .
31-
git commit -m "Deploy $GITHUB_SHA to gh-pages"
32-
git push --force --set-upstream origin gh-pages
24+
- name: Build artifacts
25+
run: mdbook build
26+
- name: Upload artifact
27+
uses: actions/upload-pages-artifact@v1
28+
with:
29+
path: ./book
30+
deploy:
31+
environment:
32+
name: github-pages
33+
url: ${{ steps.deployment.outputs.page_url }}
34+
runs-on: ubuntu-latest
35+
needs: build
36+
steps:
37+
- name: Deploy to GitHub Pages
38+
id: deployment
39+
uses: actions/deploy-pages@v1

0 commit comments

Comments
 (0)