forked from digitalpalidictionary/dpd-db
-
Notifications
You must be signed in to change notification settings - Fork 2
426 lines (330 loc) · 14.5 KB
/
Copy pathru_release.yml
File metadata and controls
426 lines (330 loc) · 14.5 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
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
name: Russian Draft Release
on:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
# ----------------------------------------
# Setup
# ----------------------------------------
- name: Checkout repository
uses: actions/checkout@v3
with:
repository: 'sasanarakkha/dpd-db-sbs'
ref: 'sbs-ru'
submodules: 'recursive'
# Fetch depth 0 to allow committing back to the submodule
fetch-depth: 0
# Use PAT to allow pushing to submodule
token: ${{ secrets.GH_PAT }}
- name: Remove large dirs
run: |
rm -rf ${{ github.workspace }}/resources/bjt/dev/*
rm -rf ${{ github.workspace }}/resources/sc-data/html_text/*
- name: Unzip deconstructor_output
run: |
cd ${{ github.workspace }}/resources/deconstructor_output
tar -xzvf deconstructor_output.json.tar.gz
ls -la
cd ${{ github.workspace }}/
- name: Install dictzip
run: sudo apt-get update && sudo apt-get install -y dictzip
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: 3.11
- name: Install uv
run: curl -LsSf https://astral.sh/uv/install.sh | sh
- name: Install dependencies
run: uv sync
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: '1.22.2'
# ----------------------------------------
# Build Database
# ----------------------------------------
- name: Config for GitHub release
run: uv run python scripts/rus_exporter/ru_config_github_release.py
- name: Create dpd.db
run: touch dpd.db
- name: Build the database
run: uv run python scripts/build/db_rebuild_from_tsv.py
# - name: Apply Additions
# run: uv run python scripts/change_in_db/apply_all_additions.py
- name: Populating RU SBS tables
run: uv run python scripts/build/db_rebuild_from_tsv_ru_sbs.py
- name: Run initial setup script
run: uv run bash scripts/bash/initial_setup_run_once.sh
- name: Create version
run: uv run python tools/version_ru.py
- name: Create Inflection Templates
run: uv run python db/inflections/create_inflection_templates.py
- name: Create Inflection Tables
run: uv run python db/inflections/generate_inflection_tables.py
- name: Update Sanskrit Family Roots
run: uv run python scripts/build/sanskrit_root_families_updater.py
- name: Add Root Families
run: uv run python db/families/family_root.py
- name: Add Word Families
run: uv run db/families/family_word.py
- name: Add Compound Families
run: uv run python db/families/family_compound.py
- name: Add Sets
run: uv run python db/families/family_set.py
- name: Add Idioms
run: uv run python db/families/family_idiom.py
- name: Families to JSON
run: uv run python scripts/build/families_to_json.py
- name: Families to JSON RUS
run: uv run python scripts/build/families_to_json_ru.py
- name: Extract Variants
run: uv run python db/variants/main.py
- name: Generate Grammar data
run: uv run python db/grammar/grammar_to_lookup.py
- name: Run Deconstructor
run: uv run python scripts/build/deconstructor_output_add_to_db.py
- name: Add api ca eva iti to inflections
run: uv run python scripts/build/api_ca_evi_iti.py
- name: Transliterate Inflections
run: uv run python db/inflections/transliterate_inflections.py
- name: Inflections to Headwords
run: uv run python db/inflections/inflections_to_headwords.py
- name: Lookup Variants and Spelling Mistakes
run: uv run python db/lookup/spelling_mistakes.py
- name: Lookup Transliterate
run: uv run python db/lookup/transliterate_lookup_table.py
- name: Lookup Help and Abbreviations
run: uv run python db/lookup/help_abbrev_add_to_lookup.py
- name: Add Frequency
run: |
go build -o frequency go_modules/frequency/main.go
./frequency
- name: Run EBT Counter
run: uv run python scripts/build/ebt_counter.py
- name: Add EPD to Lookup Table
run: uv run python db/epd/epd_to_lookup.py
- name: Add RPD to Lookup Table
run: uv run python db/rpd/rpd_to_lookup.py
- name: Test Dealbreakers
run: uv run python scripts/build/dealbreakers.py
- name: Apply Corrections
run: uv run python scripts/change_in_db/apply_all_corrections.py
# ----------------------------------------
# Exporter
# ----------------------------------------
- name: Export Grammar Dictionary
run: uv run python exporter/grammar_dict/grammar_dict_ru.py
- name: Export GoldenDict & MDict
run: uv run python exporter/goldendict/main_ru.py
- name: Export Deconstructor
run: uv run python exporter/deconstructor/deconstructor_exporter_ru.py
- name: Export Kindle & ePub
run: uv run python exporter/kindle/kindle_exporter_ru.py
- name: Export Variants
run: uv run exporter/variants/variants_exporter.py
- name: Check disk space and memory
run: |
free -h # Check available memory
df -h # Check disk space
- name: Zip GoldenDict & Mdict
run: uv run python scripts/rus_exporter/ru_zip_goldendict_mdict.py
- name: Tarball DB
run: uv run python scripts/build/tarball_db.py
# ----------------------------------------
# Prepare Submodules
# ----------------------------------------
- name: Sync all submodules with Upstream
run: |
for submodule in resources/fdg_dpd resources/tpr_downloads; do
echo "Syncing $submodule..."
cd "$submodule"
if [ "$submodule" = "resources/tpr_downloads" ]; then
branch="master"
else
branch="main"
fi
git fetch origin $branch
git checkout $branch
git reset --hard origin/$branch
cd ../..
done
# ----------------------------------------
# Export FDG
# ----------------------------------------
- name: Run TBW Exporter
run: uv run python exporter/tbw/tbw_exporter_ru.py
# ----------------------------------------
# Git settings for DPD + RUS
# ----------------------------------------
- name: Config for DPD + RUS
run: uv run python scripts/rus_exporter/config_github_release_dpd_rus.py
- name: Run TPR Exporter
run: uv run python exporter/tpr/tpr_exporter.py
# ----------------------------------------
# Update Submodules
# ----------------------------------------
- name: Update All Submodules
shell: bash
run: |
declare -A submodules=(
["resources/fdg_dpd"]="fdg https://github.com/o28o/dictPlugin.git"
["resources/tpr_downloads"]="tpr https://github.com/bksubhuti/tpr_downloads"
)
for path in "${!submodules[@]}"; do
read name repo <<< "${submodules[$path]}"
echo "Updating $name submodule..."
cd "$path"
echo "Current branch: $(git branch --show-current)"
echo "Git status:"
git status --short
echo "Recent commits:"
git log -1 --oneline
if [ "$path" = "resources/tpr_downloads" ]; then
branch="master"
else
branch="main"
fi
git checkout $branch
git pull origin $branch
echo "=== POST-EXPORT STATUS ==="
git status --short
git add .
echo "=== STAGED CHANGES ==="
git diff --cached --name-only
git config --global user.name "GitHub Actions"
git config --global user.email "actions@github.com"
git commit -m "DPD RU: update $(date +'%d-%b-%y')" || echo "No changes to commit"
echo "=== PRE-PUSH STATUS ==="
git log -2 --oneline
git remote -v
echo "=== PUSHING CHANGES ==="
git push origin $branch:$branch
echo "=== PUSH EXIT CODE: $? ==="
cd "$GITHUB_WORKSPACE"
done
# ----------------------------------------
# Export DPD + RUS and DPD + SBS
# ----------------------------------------
- name: Export GoldenDict & MDict for DPD + RUS
run: uv run python exporter/goldendict/main.py
- name: Zip GoldenDict & Mdict for DPD + RUS
run: uv run python scripts/rus_exporter/zip_dpd_rus.py
- name: Config for DPD + SBS
run: uv run python scripts/rus_exporter/config_github_release_dpd_sbs.py
- name: Export GoldenDict & MDict for DPD + SBS
run: uv run python exporter/goldendict/main.py
- name: Zip GoldenDict & Mdict for DPD + SBS
run: uv run python scripts/rus_exporter/zip_dpd_sbs.py
# ----------------------------------------
# Create Draft Release
# ----------------------------------------
- name: Set Release Date
id: set_release_date
run: echo "RELEASE_DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
- name: Set Release Tag
id: set_release_tag
run: echo "RELEASE_TAG=$(uv run python scripts/build/version_print.py)" >> $GITHUB_ENV
- name: Create Draft Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
with:
tag_name: ${{ env.RELEASE_TAG }}
release_name: ${{ env.RELEASE_DATE }}
body: |
### [Цифровой Словарь Пали](https://devamitta.github.io/dpd.rus/)
DPD - это богатый возможностями словарь палийского языка на русском, который работает [онлайн](https://ru.dpdict.net) и в GoldenDict, MDict, DictTango и Kindle, или в любом другом приложении, поддерживающем форматы stardict, mdict, epub, mobi.
На этой странице доступа свежая русской версия словаря в разных форматах. Последнюю версию оригинального английского DPD можно найти на [этой GitHub странице](https://github.com/digitalpalidictionary/dpd-db/releases). Там же можно почитать историю изменений и дополнений.
Также доступна совмещенная версия английского DPD с русским переводом. Более подробную информацию можно найти на [этой странице.](https://devamitta.github.io/dpd.rus/dpd_rus.html)
---
Цифровой Словарь Пали распространяется под лицензией [С указанием авторства-Некоммерческая-С сохранением условий версии 4.0 Международная](http://creativecommons.org/licenses/by-nc-sa/4.0/deed.ru)
<a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/4.0/"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by-nc-sa/4.0/88x31.png" /></a><br />
draft: true
prerelease: false
# ----------------------------------------
# Update Release Assets
# ----------------------------------------
- name: Upload Asset ru-dpd-goldendict.zip
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: exporter/share/ru-dpd-goldendict.zip
asset_name: ru-dpd-goldendict.zip
asset_content_type: application/zip
- name: Upload Asset ru-dpd-mdict.zip
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: exporter/share/ru-dpd-mdict.zip
asset_name: ru-dpd-mdict.zip
asset_content_type: application/zip
- name: Upload Asset ru-dpd-kindle.epub
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: exporter/share/ru-dpd-kindle.epub
asset_name: ru-dpd-kindle.epub
asset_content_type: application/zip
- name: Upload Asset ru-dpd-kindle.mobi
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: exporter/share/ru-dpd-kindle.mobi
asset_name: ru-dpd-kindle.mobi
asset_content_type: application/zip
- name: Upload Asset dpd.db.tar.bz2
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: exporter/share/dpd.db.tar.bz2
asset_name: dpd.db.tar.bz2
asset_content_type: application/zip
- name: Upload Asset dpd+sbs-goldendict.zip
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: exporter/share/dpd+sbs-goldendict.zip
asset_name: dpd+sbs-goldendict.zip
asset_content_type: application/zip
- name: Upload Asset dpd+sbs-mdict.zip
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: exporter/share/dpd+sbs-mdict.zip
asset_name: dpd+sbs-mdict.zip
asset_content_type: application/zip
- name: Upload Asset dpd+rus-goldendict.zip
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: exporter/share/dpd+rus-goldendict.zip
asset_name: dpd+rus-goldendict.zip
asset_content_type: application/zip
- name: Upload Asset dpd+rus-mdict.zip
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: exporter/share/dpd+rus-mdict.zip
asset_name: dpd+rus-mdict.zip
asset_content_type: application/zip