inkstitch/.github/workflows/translations.yml

64 wiersze
2.3 KiB
YAML

2020-03-08 03:50:12 +00:00
name: Translations
on:
schedule:
- cron: '0 0 * * *'
jobs:
crowdin:
2021-03-05 16:19:25 +00:00
runs-on: ubuntu-20.04
2020-03-08 03:50:12 +00:00
steps:
- uses: actions/checkout@v4
2020-03-08 03:50:12 +00:00
with:
fetch-depth: 0
2020-08-19 00:53:46 +00:00
ref: main
2020-03-08 03:50:12 +00:00
token: ${{secrets.INKSTITCH_BUILDS_GITHUB_TOKEN}}
- name: checkout submodules
run: |
git submodule update --init --recursive
- uses: actions/setup-python@v5
2020-03-08 03:50:12 +00:00
with:
2022-10-16 15:24:11 +00:00
python-version: '3.8.x'
2020-03-08 03:50:12 +00:00
- env:
2023-06-28 04:40:36 +00:00
CROWDIN_API_KEY: ${{ secrets.CROWDIN_API_V2_KEY }}
CROWDIN_PROJECT_ID: "299419"
2020-03-08 03:50:12 +00:00
run: |
git config --global user.email "inkstitch-crowdin@lex.gd"
git config --global user.name "Ink/Stitch Crowdin integration"
2023-06-28 04:40:36 +00:00
wget --quiet https://downloads.crowdin.com/cli/v3/crowdin-cli.zip
2020-03-08 03:50:12 +00:00
unzip -j crowdin-cli.zip
2021-10-15 06:12:23 +00:00
sudo apt-get update
2021-10-12 06:37:43 +00:00
sudo apt install gettext
# for wxPython
sudo apt install glib-networking libsdl2-dev libsdl2-2.0-0
2021-10-12 06:55:04 +00:00
# for PyGObject
sudo apt install libgirepository1.0-dev libcairo2-dev
2021-10-12 06:37:43 +00:00
# for shapely
sudo apt install libgeos-dev build-essential libgtk-3-dev
2020-03-08 03:50:12 +00:00
python -m pip install --upgrade pip
2021-10-12 06:37:43 +00:00
python -m pip install wheel
2022-10-16 15:24:11 +00:00
python -m pip install pycairo
python -m pip install PyGObject
python -m pip install https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-20.04/wxPython-4.1.1-cp38-cp38-linux_x86_64.whl
2021-10-10 07:31:35 +00:00
python -m pip install -r requirements.txt
python -m pip install Babel
2020-03-08 03:50:12 +00:00
make messages.po
echo "uploading messages.po to crowdin"
2023-06-28 04:40:36 +00:00
java -jar crowdin-cli.jar -v upload -b main -T "$CROWDIN_API_KEY" -i "$CROWDIN_PROJECT_ID"
2020-03-08 03:50:12 +00:00
echo "downloading new translations"
2023-06-28 04:40:36 +00:00
java -jar crowdin-cli.jar -v pull -b main -T "$CROWDIN_API_KEY" -i "$CROWDIN_PROJECT_ID"
2020-03-08 03:50:12 +00:00
# Try to only commit if translations changed. Crowdin will update all
# files when a new translation string is added but we don't need to
# commit those until folks actually translate the new strings.
if git diff translations | grep -qE '^[-+]msgstr ".+"$'; then
git add translations
2020-03-08 03:50:12 +00:00
git commit -m "new translations from Crowdin"
2020-08-19 00:53:46 +00:00
git push https://github.com/inkstitch/inkstitch main
2020-03-08 03:50:12 +00:00
fi