Skip to content

Commit 486a2a7

Browse files
committed
Deploy GitHub pages from Actions API (not using gh-pages branch)
1 parent 0af8af8 commit 486a2a7

File tree

1 file changed

+47
-14
lines changed

1 file changed

+47
-14
lines changed

.github/workflows/gh-pages.yml

Lines changed: 47 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,55 @@
1-
name: GitHub Pages
1+
# Based on starter workflow
2+
# https://github.com/actions/starter-workflows/blob/8217436fdee2338da2d6fd02b7c9fcff634c40e7/pages/static.yml
3+
#
4+
# Simple workflow for deploying static content to GitHub Pages
5+
name: "GitHub Pages"
26

37
on:
8+
# Runs on pushes targeting the default branch
49
push:
510
branches:
611
- master
712

13+
# Allows you to run this workflow manually from the Actions tab
14+
workflow_dispatch:
15+
16+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
17+
permissions:
18+
contents: read
19+
pages: write
20+
id-token: write
21+
22+
# Allow one concurrent deployment
23+
concurrency:
24+
group: "pages"
25+
cancel-in-progress: true
26+
827
jobs:
9-
pages:
10-
runs-on: ubuntu-22.04
28+
# Single deploy job since we're just deploying
29+
deploy:
30+
environment:
31+
name: github-pages
32+
url: ${{ steps.deployment.outputs.page_url }}
33+
runs-on: ubuntu-latest
1134
steps:
12-
- uses: actions/checkout@v2
13-
- uses: actions-rs/cargo@v1
14-
with:
15-
command: doc
16-
args: --no-deps
17-
- name: Deploy GitHub Pages
18-
uses: peaceiris/actions-gh-pages@v3
19-
with:
20-
github_token: ${{ secrets.GITHUB_TOKEN }}
21-
publish_dir: ./target/doc
22-
force_orphan: true
35+
- name: Checkout
36+
uses: actions/checkout@v3
37+
38+
# Generate cargo-doc
39+
- uses: actions-rs/cargo@v1
40+
with:
41+
command: doc
42+
args: --no-deps
43+
44+
- name: Setup Pages
45+
uses: actions/configure-pages@v2
46+
47+
# Upload target/doc directory
48+
- name: Upload artifact
49+
uses: actions/upload-pages-artifact@v1
50+
with:
51+
path: 'target/doc'
52+
53+
- name: Deploy to GitHub Pages
54+
id: deployment
55+
uses: actions/deploy-pages@v1

0 commit comments

Comments
 (0)