-
Notifications
You must be signed in to change notification settings - Fork 2
173 lines (149 loc) · 4.87 KB
/
docs.yml
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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
name: Docs
on:
push:
pull_request:
jobs:
user_lint:
# Deduplicate jobs from pull requests and branch pushes within the same repo.
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/[email protected]
- name: Setup Node
uses: actions/[email protected]
with:
node-version: 18
- name: Install Yarn dependencies
uses: borales/[email protected]
with:
cmd: global add markdownlint-cli2 markdown-it-admon
- name: Lint with markdownlint-cli2
run: >
markdownlint-cli2
**/*.{md,markdown}
user_build:
# Deduplicate jobs from pull requests and branch pushes within the same repo.
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository
needs: user_lint
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/[email protected]
- name: Setup Python
uses: actions/[email protected]
with:
python-version: 3.12
- name: Install Python Dependencies
run: pip install -r docs/requirements.txt
- name: Build User Docs
run: mkdocs build
- name: Fix file permissions for pages
run: chmod -R +rX site
- name: Upload User Docs Artifact
uses: actions/[email protected]
with:
name: user-docs
path: site
publish_user_s3:
# Deduplicate jobs from pull requests and branch pushes within the same repo.
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository
needs: user_build
runs-on: ubuntu-latest
steps:
- name: Get docs artifact
uses: actions/[email protected]
with:
name: user-docs
path: site
- name: Publish docs to s3 bucket
if: github.ref == 'refs/heads/main'
run: >
timeout -v 10m
npx @techdocs/cli publish
--entity default/system/auth-bundler
--publisher-type awsS3
--storage-name techdocs
--awsEndpoint https://s3.echo.stfc.ac.uk
--awsS3ForcePathStyle
env:
AWS_ACCESS_KEY_ID: ${{ secrets.TECHDOCS_S3_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.TECHDOCS_S3_SECRET_ACCESS_KEY }}
AWS_REGION: "eu-west-2"
bundler_build:
# Deduplicate jobs from pull requests and branch pushes within the same repo.
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository
runs-on: ubuntu-latest
services:
ispyb:
image: ghcr.io/diamondlightsource/ispyb-database:v3.0.0
ports:
- 3306:3306
env:
MARIADB_ROOT_PASSWORD: rootpassword
options: >
--health-cmd "/usr/local/bin/healthcheck.sh --defaults-file=/ispyb/.my.cnf --connect"
env:
DATABASE_URL: mysql://root:rootpassword@localhost/ispyb_build
steps:
- name: Checkout source
uses: actions/[email protected]
- name: Install stable toolchain
uses: actions-rs/[email protected]
with:
toolchain: stable
default: true
- name: Cache Rust Build
uses: Swatinem/[email protected]
- name: Build docs
uses: actions-rs/[email protected]
with:
command: doc
args: >
--no-deps
--all-features
--document-private-items
--manifest-path bundler/Cargo.toml
- name: Fix file permissions for pages
run: chmod -R +rX bundler/target/doc
- name: Upload Bundler Docs Artifact
uses: actions/[email protected]
with:
name: bundler-docs
path: bundler/target/doc/bundler
combine:
runs-on: ubuntu-latest
needs:
- user_build
- bundler_build
steps:
- name: Download User Docs Artifact
uses: actions/[email protected]
with:
name: user-docs
path: docs
- name: Download User Docs Artifact
uses: actions/[email protected]
with:
name: bundler-docs
path: docs/bundler
- name: Upload Pages Artifact
uses: actions/[email protected]
with:
path: docs
publish:
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
needs: combine
runs-on: ubuntu-latest
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Setup Pages
uses: actions/[email protected]
- name: Publish docs to GitHub Pages
id: deployment
uses: actions/[email protected]