Update dictionaries #1221
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Update dictionaries | |
on: | |
schedule: | |
# At 00:00 (UTC) every day | |
- cron: '0 0 * * *' | |
# Allow to call the workflow manually | |
workflow_dispatch: | |
jobs: | |
dicthtml: | |
runs-on: ubuntu-latest | |
# List of locales to generate | |
# Sorted by the number of words | |
strategy: | |
matrix: | |
locale: | |
- fr | |
- en | |
- es | |
- pt | |
- sv | |
- ca | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2.2.1 | |
with: | |
python-version: 3.9 | |
- name: Install LaTeX requirements | |
run: | | |
sudo apt update | |
sudo apt install dvipng texlive-latex-extra | |
- name: Install requirements | |
run: python -m pip install -r requirements.txt | |
- name: Download the latest Wiktionary dump | |
run: python -Wd -m wikidict ${{ matrix.locale }} --download | |
- name: Parse the dump | |
run: python -Wd -m wikidict ${{ matrix.locale }} --parse | |
- name: Render templates | |
run: python -Wd -m wikidict ${{ matrix.locale }} --render | |
- name: Convert to dictionaries (DictFile and Kobo) | |
run: python -Wd -m wikidict ${{ matrix.locale }} --convert | |
- name: Generate dictionary (StarDict) | |
run: | | |
pyglossary --no-progress-bar --no-color data/${{ matrix.locale }}/dict-${{ matrix.locale }}.df dict-data.ifo | |
zip -r dict-${{ matrix.locale }}.zip dict-data.* res | |
- name: Upload the dictionary (DictFile) | |
uses: svenstaro/upload-release-action@v1-release | |
with: | |
repo_token: ${{ secrets.TOKEN }} | |
file: data/${{ matrix.locale }}/dict-${{ matrix.locale }}.df | |
asset_name: dict-${{ matrix.locale }}.df | |
tag: ${{ matrix.locale }} | |
overwrite: true | |
- name: Upload the dictionary (Kobo) | |
uses: svenstaro/upload-release-action@v1-release | |
with: | |
repo_token: ${{ secrets.TOKEN }} | |
file: data/${{ matrix.locale }}/dicthtml-${{ matrix.locale }}.zip | |
asset_name: dicthtml-${{ matrix.locale }}.zip | |
tag: ${{ matrix.locale }} | |
overwrite: true | |
- name: Upload the dictionary (StarDict) | |
uses: svenstaro/upload-release-action@v1-release | |
with: | |
repo_token: ${{ secrets.TOKEN }} | |
file: dict-${{ matrix.locale }}.zip | |
asset_name: dict-${{ matrix.locale }}.zip | |
tag: ${{ matrix.locale }} | |
overwrite: true | |
- name: Update the release description | |
run: python -Wd -m wikidict ${{ matrix.locale }} --update-release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |