-
-
Notifications
You must be signed in to change notification settings - Fork 0
143 lines (119 loc) · 4.27 KB
/
deploy-github-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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
name: Deploy Github Pages
on:
push:
branches: [master]
workflow_dispatch:
workflow_call:
inputs:
skip-publish:
default: false
description: "Creates the documentation in this workflow without publishing"
required: false
type: boolean
jobs:
generate:
name: Generate cargo docs
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Prepare runner
uses: ./.github/actions/prepare-runner
- name: Install toolchain
uses: ./.github/actions/rust-toolchain
with:
rust: nightly
- name: Install mdbook
uses: ./.github/actions/cargo-install
with:
target: mdbook
- name: Install mdbook-mermaid
uses: ./.github/actions/cargo-install
with:
target: mdbook-mermaid
- name: Install mdbook-admonish
uses: ./.github/actions/cargo-install
with:
target: mdbook-admonish
- name: Install mdbook-dependencies
working-directory: docs
run: mdbook-admonish install
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Install markdownlint
uses: ./.github/actions/npm-install
with:
target: markdownlint-cli
- name: Install markdownlint-github-annotation
uses: ./.github/actions/cargo-install
with:
target: markdownlint-github-annotation
git-repo: https://github.com/bitwizeshift/markdownlint-github-annotation
- name: Lint Markdown
shell: bash
run: |
markdownlint \
--json docs/**.md README.md 2>&1 \
| markdownlint-github-annotation
- name: Build
uses: ./.github/actions/cargo-build
- name: Generate Cargo Docs
run: |
RUSTDOCFLAGS="--enable-index-page -Zunstable-options" \
cargo +nightly doc --no-deps --workspace
- name: Get mdbook dependencies
shell: bash
run: ./docs/get-dependencies.bash
- name: Generate Book
run: |
mdbook build docs
mkdir -p target/doc
cp -r docs/book target/doc/book
- name: Generate coverage report
run: |
cargo llvm-cov --html
cp -r target/llvm-cov/html target/doc/coverage
- name: Generate license manifest
uses: ./.github/actions/cargo-about
with:
output-file: target/doc/licenses.html
# Some of the doc generation steps above create the directories with
# 0750 for permissions -- which is triggering warning annotations in the
# workflow summaries. Manually converting this to 0755 helps to suppress
# this.
- name: Fix permissions
run: |
find ./target -type d -exec chmod 0755 {} \;
find ./target -type f -name '.lock' -delete
- name: Upload Pages Artifact
if: inputs.skip-publish != true
uses: actions/upload-pages-artifact@v3
with:
path: ./target/doc
deploy:
name: Deploy to GH Pages
runs-on: ubuntu-latest
if: inputs.skip-publish != true
needs: generate
permissions:
contents: read
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Upload GH Pages
id: deployment
uses: actions/deploy-pages@v4
- name: Create summary
if: success()
run: |
echo "# Documentation successfully deployed 🚀" >> "${GITHUB_STEP_SUMMARY}"
echo "" >> "${GITHUB_STEP_SUMMARY}"
echo "Deployed documentation links:" >> "${GITHUB_STEP_SUMMARY}"
echo "" >> "${GITHUB_STEP_SUMMARY}"
echo "* [📦 Crate documentation](https://bitwizeshift.github.io/alloy-rs/)" >> "${GITHUB_STEP_SUMMARY}"
echo "* [📕 Handbook](https://bitwizeshift.github.io/alloy-rs/book/)" >> "${GITHUB_STEP_SUMMARY}"
echo "* [📈 Coverage Report](https://bitwizeshift.github.io/alloy-rs/coverage)" >> "${GITHUB_STEP_SUMMARY}"
echo "* [🔑 Licenses](https://bitwizeshift.github.io/alloy-rs/licenses.html)" >> "${GITHUB_STEP_SUMMARY}"