-
Notifications
You must be signed in to change notification settings - Fork 10
218 lines (192 loc) · 6.35 KB
/
Copy pathwebsite.yml
File metadata and controls
218 lines (192 loc) · 6.35 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
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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
name: Docs
on:
push:
branches:
- main
pull_request:
branches:
- main
schedule:
- cron: "0 2 * * *"
jobs:
build:
name: Build website artifacts
runs-on: ubuntu-latest
steps:
- name: Checkout uutils.github.io Repository
uses: actions/checkout@v5
with:
repository: uutils/uutils.github.io
path: './uutils.github.io'
fetch-depth: 0
- name: Checkout Coreutils Repository
uses: actions/checkout@v5
with:
repository: uutils/coreutils
path: './coreutils'
fetch-depth: 0
- name: Checkout Coreutils L10n Repository
uses: actions/checkout@v5
with:
repository: uutils/coreutils-l10n
path: './coreutils-l10n'
fetch-depth: 0
- name: Checkout Findutils Repository
uses: actions/checkout@v5
with:
repository: uutils/findutils
path: './findutils'
fetch-depth: 0
- name: Install `rust` toolchain
uses: dtolnay/rust-toolchain@stable
- name: Install system deps
run: |
sudo apt update
sudo apt install libacl1-dev libselinux1-dev libsystemd-dev
pip install babel
- name: Install necessary tools (mdbook and mdbook-toc)
uses: taiki-e/install-action@v2
with:
tool: mdbook,mdbook-toc
- name: Copy l10n locales into coreutils
run: |
# Only copy locales into utilities that already exist in coreutils
# Exclude en-US.ftl to preserve the coreutils English originals
for util_dir in coreutils-l10n/src/uu/*/; do
util=$(basename "$util_dir")
if [ -d "coreutils/src/uu/$util/locales" ]; then
for ftl in "$util_dir"/locales/*.ftl; do
[ -f "$ftl" ] || continue
[ "$(basename "$ftl")" = "en-US.ftl" ] && continue
cp "$ftl" "coreutils/src/uu/$util/locales/"
done
fi
done
# Copy uucore l10n files, excluding en-US.ftl
if [ -d "coreutils-l10n/src/uucore/locales" ]; then
for ftl in coreutils-l10n/src/uucore/locales/*.ftl; do
[ -f "$ftl" ] || continue
[ "$(basename "$ftl")" = "en-US.ftl" ] && continue
cp "$ftl" "coreutils/src/uucore/locales/"
done
fi
- name: Patch mdbook theme with language selector
run: |
uutils.github.io/scripts/patch-mdbook-theme.sh coreutils/docs coreutils-l10n
- name: Build Coreutils Docs
run: |
cd coreutils
# Download and repack tldr zip: uudoc expects pages/common/ prefix
curl -sfL https://github.com/tldr-pages/tldr/releases/download/v2.3/tldr-pages.zip -o /tmp/tldr-raw.zip || true
if [ -f /tmp/tldr-raw.zip ]; then
mkdir -p /tmp/tldr-repack/pages
cd /tmp/tldr-repack && unzip -o /tmp/tldr-raw.zip -d pages/ > /dev/null
zip -r "$OLDPWD/docs/tldr.zip" pages/ > /dev/null
cd "$OLDPWD"
fi
cargo run --bin uudoc --all-features
cd docs
# Remove deprecated 'multilingual' field unsupported by newer mdbook
sed -i '/^multilingual/d' book.toml
mdbook build
- name: Build Coreutils Docs (translations)
run: |
uutils.github.io/scripts/build-docs-l10n.sh coreutils
- name: Build Findutils Docs
run: |
cd findutils/docs
# Remove deprecated 'multilingual' field unsupported by newer mdbook
sed -i '/^multilingual/d' book.toml
mdbook build
- name: Run Zola
uses: shalzz/zola-deploy-action@v0.22.1
env:
BUILD_DIR: uutils.github.io
BUILD_ONLY: true
- name: Collect results into `public` folder
run: |
cp -r uutils.github.io/public public
cp -r coreutils/docs/book public/coreutils/docs
cp -r findutils/docs/book public/findutils/docs
# Copy translated docs to /coreutils/docs-{lang}/
for lang_dir in coreutils/docs/book-*/; do
[ -d "$lang_dir" ] || continue
lang=$(basename "$lang_dir" | sed 's/^book-//')
cp -r "$lang_dir" "public/coreutils/docs-${lang}"
done
- name: Upload artifact for checking the output
uses: actions/upload-artifact@v4
with:
path: ./public
- name: Upload artifact for pages
uses: actions/upload-pages-artifact@v4
with:
path: ./public
# dev-docs:
# name: generate the dev doc
# runs-on: ubuntu-latest
# steps:
# - name: Checkout repository
# uses: actions/checkout@v4
# with:
# repository: uutils/coreutils
# path: './coreutils'
# fetch-depth: 0
# - name: Install `rust` toolchain
# uses: actions-rs/toolchain@v1
# with:
# toolchain: stable
# default: true
# profile: minimal
# - name: Build dev documentation
# run: |
# cd coreutils
# cargo doc --no-deps --all-features --workspace
# - name: Deploy Docs
# uses: peaceiris/actions-gh-pages@v3
# with:
# github_token: ${{ secrets.GITHUB_TOKEN }}
# publish_dir: ./coreutils/target/doc
# destination_dir: coreutils/dev/
# build-report:
# name: generate the build report
# runs-on: ubuntu-latest
# steps:
# - name: Checkout repository
# uses: actions/checkout@v4
# with:
# repository: uutils/coreutils
# path: './coreutils'
# fetch-depth: 0
# - name: Install `rust` toolchain
# uses: actions-rs/toolchain@v1
# with:
# toolchain: nightly
# default: true
# profile: minimal
# - name: Build report
# run: |
# cd coreutils
# cargo +nightly build --timings=html -Zunstable-options
# - name: Deploy build report
# uses: peaceiris/actions-gh-pages@v3
# with:
# github_token: ${{ secrets.GITHUB_TOKEN }}
# publish_dir: ./coreutils/target/cargo-timings/
# destination_dir: cargo-timings/
# Deployment job
deploy:
permissions:
contents: read
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
if: (github.event_name == 'push' && github.ref == 'refs/heads/main') || github.event_name == 'schedule'
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v5