-
Notifications
You must be signed in to change notification settings - Fork 71
110 lines (90 loc) · 2.86 KB
/
pages.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
name: pages
on:
push:
branches:
- master
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false
env:
CARGO_INCREMENTAL: 0
CARGO_NET_RETRY: 10
RUSTFLAGS: "-D warnings"
RUSTUP_MAX_RETRIES: 10
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
jobs:
build:
if: github.repository == 'redbadger/crux'
runs-on: ubuntu-latest
steps:
- name: Export LATEST_TAG
env:
GH_TOKEN: ${{ github.token }}
run: |
echo "LATEST_TAG=$(gh api \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
--jq .tag_name \
/repos/redbadger/crux/releases/latest)" >> $GITHUB_ENV
- name: Checkout latest master
uses: actions/checkout@v4
with:
path: latest_master
- name: Checkout latest release
uses: actions/checkout@v4
with:
ref: ${{ env.LATEST_TAG }}
path: latest_release
- uses: dtolnay/rust-toolchain@stable
- name: Run sccache-cache
uses: mozilla-actions/[email protected]
- name: Setup mdBook
uses: jontze/action-mdbook@v3
with:
token: ${{secrets.GITHUB_TOKEN}}
use-linkcheck: true
use-admonish: true
- name: Setup Pages
id: pages
uses: actions/configure-pages@v5
- name: Build Documentation (latest_master)
working-directory: latest_master
run: cargo doc --all --no-deps
- name: Build Documentation (latest_release)
working-directory: latest_release
run: cargo doc --all --no-deps
- name: Build book (latest_master)
working-directory: latest_master/docs
run: mdbook build
- name: Build book (latest_release)
working-directory: latest_release/docs
run: mdbook build
- name: Move outputs
run: |
set -e
mkdir -p ./public/latest_master
mv latest_master/target/doc ./public/latest_master/master_api_docs
mv latest_master/docs/book/html/* ./public/latest_master/
mv latest_release/target/doc ./public/master_api_docs
mv latest_release/docs/book/html/* ./public/
- name: Upload GitHub Pages artifact
id: deployment
uses: actions/upload-pages-artifact@v3
with:
path: public/
deploy:
needs: build
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4