Repository navigation
85 lines (80 loc) · 2.8 KB
/
Copy pathdocs-deployment.yml
File metadata and controls
85 lines (80 loc) · 2.8 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
name: Build and deploy documentation
on:
pull_request:
paths:
- 'book/**'
- 'docs/**'
- 'spec/**'
- 'rpc/openapi/**'
- 'scripts/prepare-docs.py'
- 'scripts/check-docs.py'
- 'scripts/tests/test_prepare_docs.py'
- 'Makefile'
- '.github/workflows/docs-deployment.yml'
push:
branches:
- '**'
paths:
- 'book/**'
- 'docs/**'
- 'spec/**'
- 'rpc/openapi/**'
- 'scripts/prepare-docs.py'
- 'scripts/check-docs.py'
- 'scripts/tests/test_prepare_docs.py'
- 'Makefile'
- '.github/workflows/docs-deployment.yml'
workflow_dispatch:
permissions:
contents: read
concurrency:
group: docs-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
build:
if: github.event_name != 'push' || github.ref == 'refs/heads/dev'
name: Build mdBook and RPC documentation
runs-on: ubuntu-26.04
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- name: Install mdBook (same version as Platform)
run: |
curl --fail --location --silent --show-error \
https://github.com/rust-lang/mdBook/releases/download/v0.4.40/mdbook-v0.4.40-x86_64-unknown-linux-gnu.tar.gz \
--output "$RUNNER_TEMP/mdbook.tar.gz"
echo "9ef07fd288ba58ff3b99d1c94e6d414d431c9a61fdb20348e5beb74b823d546b $RUNNER_TEMP/mdbook.tar.gz" | sha256sum --check
mkdir -p "$HOME/.local/bin"
tar -xzf "$RUNNER_TEMP/mdbook.tar.gz" -C "$HOME/.local/bin"
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
- name: Test documentation staging
run: python3 -m unittest discover -s scripts/tests -p test_prepare_docs.py
- name: Build documentation
run: make build-docs
- name: Upload preview
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7
with:
name: documentation-preview
path: book/book
retention-days: 14
if-no-files-found: error
- name: Upload Pages artifact
if: github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && github.ref == 'refs/heads/dev')
uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5
with:
path: book/book
deploy:
name: Deploy to GitHub Pages
if: github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && github.ref == 'refs/heads/dev')
needs: build
runs-on: ubuntu-slim
timeout-minutes: 15
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy
id: deployment
uses: actions/deploy-pages@368f82528645a54fb793d4d04e342629a3f51346 # v5