Update dictionaries #1278
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 01:00 (UTC) every day | |
- cron: "0 1 * * *" | |
# Allow to call the workflow manually | |
workflow_dispatch: | |
jobs: | |
# First job just to fill the pip cache | |
warmup: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.11" | |
- uses: actions/cache@v3 | |
id: cache | |
with: | |
path: ${{ env.pythonLocation }} | |
key: ${{ env.pythonLocation }}-${{ hashFiles('requirements.txt') }} | |
- name: Install requirements | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: python -m pip install -r requirements.txt | |
update: | |
runs-on: ubuntu-latest | |
needs: [warmup] | |
# List of locales to generate | |
strategy: | |
fail-fast: false | |
matrix: | |
locale: | |
- "ca" | |
- "de" | |
- "en" | |
- "el" | |
- "es" | |
- "fr" | |
- "it" | |
- "no" | |
- "pt" | |
- "ro" | |
# - "ru" | |
- "sv" | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.11" | |
- name: Install dictzip | |
run: sudo apt install dictzip | |
- uses: actions/cache@v3 | |
id: cache | |
with: | |
path: ${{ env.pythonLocation }} | |
key: ${{ env.pythonLocation }}-${{ hashFiles('requirements.txt') }} | |
- name: Install requirements | |
if: steps.cache.outputs.cache-hit != 'true' | |
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 | |
run: python -Wd -m wikidict ${{ matrix.locale }} --convert | |
- name: Generate the release description | |
run: python -Wd -m wikidict ${{ matrix.locale }} --release > release.txt | |
- name: Upload release data | |
if: github.ref == 'refs/heads/master' | |
uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: ${{ matrix.locale }} | |
body_path: release.txt | |
files: | | |
data/${{ matrix.locale }}/dicthtml-${{ matrix.locale }}-${{ matrix.locale }}*.zip | |
data/${{ matrix.locale }}/dict-${{ matrix.locale }}-${{ matrix.locale }}*.df.bz2 | |
data/${{ matrix.locale }}/dict-${{ matrix.locale }}-${{ matrix.locale }}*.zip |