-
-
Notifications
You must be signed in to change notification settings - Fork 1
132 lines (110 loc) · 3.09 KB
/
build-website.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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
name: Build website
on:
workflow_call:
workflow_dispatch:
jobs:
build-docs:
name: Build docs (${{ matrix.kind }})
runs-on: ubuntu-latest
strategy:
matrix:
kind: [internal, public]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
repository: time-rs/time
- name: Cache cargo output
uses: Swatinem/rust-cache@v2
- name: Install toolchain
uses: dtolnay/rust-toolchain@nightly
- name: Generate documentation
run: cargo doc -p time --all-features ${{ matrix.kind == 'internal' && '--document-private-items' || '' }}
env:
RUSTDOCFLAGS: --cfg __time_03_docs ${{ matrix.kind == 'internal' && '--document-hidden-items' || '' }} -Zunstable-options --generate-link-to-definition
- name: Upload artifact
uses: actions/upload-artifact@v4
id: docs-upload
with:
name: ${{ matrix.kind }}-docs
path: target/doc/
retention-days: 1
if-no-files-found: error
compression-level: 9
build-book:
name: Build book
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
repository: time-rs/book
- name: Check for typos
uses: crate-ci/typos@master
- name: Install mdbook
uses: taiki-e/install-action@mdbook
- name: Build diagrams
run: |
pip install -r diagrams/requirements.txt
mkdir src/diagrams
python diagrams/diagrams.py
- name: Build book
run: mdbook build
- name: Upload artifact
uses: actions/upload-artifact@v4
id: book-upload
with:
name: book
path: book/
retention-days: 1
if-no-files-found: error
compression-level: 9
deploy:
name: Deploy
runs-on: ubuntu-latest
needs: [build-docs, build-book]
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
sparse-checkout: |
website
- name: Download internal docs
uses: actions/download-artifact@v4
with:
name: internal-docs
path: website/internal-api
- name: Download public docs
uses: actions/download-artifact@v4
with:
name: public-docs
path: website/api
- name: Download book
uses: actions/download-artifact@v4
with:
name: book
path: website/book
- name: Upload website
uses: actions/upload-pages-artifact@v3
with:
path: website
- name: Deploy
id: deployment
uses: actions/deploy-pages@v4
- name: Delete artifacts
uses: geekyeggo/delete-artifact@v4
with:
name: |
internal-docs
public-docs
book
github-pages
failOnError: false
if: always()
continue-on-error: true