Repository navigation
99 lines (80 loc) · 3.15 KB
/
Copy pathdocs.yml
File metadata and controls
99 lines (80 loc) · 3.15 KB
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
name: "docs"
permissions: {}
on:
pull_request:
# run "deploy-pages" job to deploy main branch to GitHub pages
push:
branches: [ "main" ]
env:
RUSTFLAGS: "-Dwarnings"
CARGO_INCREMENTAL: "false"
CARGO_PROFILE_TEST_DEBUG: "false"
CARGO_TERM_VERBOSE: "true"
CARGO_TERM_COLOR: "always"
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
build-rustdoc:
name: "cargo docs-rs"
permissions:
contents: read
runs-on: ubuntu-24.04
steps:
- uses: step-security/harden-runner@fa2e9d605c4eeb9fcad4c99c224cee0c6c7f3594 # v2.16.0
with:
egress-policy: audit
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- id: toolchain
uses: dtolnay/rust-toolchain@efa25f7f19611383d5b0ccf2d1c8914531636bf9 # doesn't have usual versioned releases/tags
with:
toolchain: nightly
- run: echo "RUSTUP_TOOLCHAIN=${RUSTUP_TOOLCHAIN}" >> "${GITHUB_ENV}"
env:
RUSTUP_TOOLCHAIN: ${{ steps.toolchain.outputs.name }}
- uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
- uses: taiki-e/install-action@06203676c62f0d3c765be3f2fcfbebbcb02d09f5 # v2.69.6
with:
# renovate: taiki-e/install-action
tool: cargo-docs-rs@1.0.0
- run: |
crate_version=$(cargo metadata --format-version 1 --no-deps | jq --raw-output '.packages[] | select(.name == "magic-sys").version')
echo "ver=${crate_version}" >> "${GITHUB_OUTPUT}"
repo_rev=$(git rev-parse --short=4 "${SHA}")
echo "rev=${repo_rev}" >> "${GITHUB_OUTPUT}"
id: crate-info
env:
SHA: ${{ github.event.pull_request.head.sha || github.sha }}
- run: cargo docs-rs --version
- run: RUSTDOCFLAGS="--crate-version ${VER}+${REV} --enable-index-page" cargo docs-rs --verbose --color always --locked --target-dir 'target/doc'
env:
VER: ${{ steps.crate-info.outputs.ver }}
REV: ${{ steps.crate-info.outputs.rev }}
- uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b # v5.0.0
- name: Fix permissions
run: |
chmod -c -R +rX "target/doc/" | while read line; do
echo "::warning title=Invalid file permissions automatically fixed::$line"
done
- uses: actions/upload-pages-artifact@7b1f4a764d45c48632c6b24a0339c27f5614fb0b # v4.0.0
with:
path: target/doc/x86_64-unknown-linux-gnu/doc/
deploy-pages:
name: "deploy GitHub Pages"
if: github.event_name == 'push'
permissions:
id-token: write
pages: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-24.04
needs: build-rustdoc
steps:
- uses: step-security/harden-runner@fa2e9d605c4eeb9fcad4c99c224cee0c6c7f3594 # v2.16.0
with:
egress-policy: audit
- id: deployment
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4.0.5