Skip to content

Commit

Permalink
Update crowdin workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
AiroPi authored Dec 6, 2023
1 parent 66b0694 commit 1c761ac
Show file tree
Hide file tree
Showing 7 changed files with 94 additions and 809 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/crowdin-download.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Download from crowdin

on:
workflow_dispatch:
schedule:
- cron: 0 * * * *

jobs:
download:
runs-on: ubuntu-latest
# secrets cannot be accessed inside an `if` so this needs to be checked in separate job
name: dowload
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
ref: master

- name: Install crowdin cli
run: |
wget -qO - https://artifacts.crowdin.com/repo/GPG-KEY-crowdin | sudo apt-key add -
echo "deb https://artifacts.crowdin.com/repo/deb/ /" | sudo tee -a /etc/apt/sources.list.d/crowdin.list
sudo apt-get update && sudo apt-get install crowdin3
- name: Download translations
shell: bash
run: |
crowdin download --all
env:
CROWDIN_API_KEY: ${{ secrets.CROWDIN_API_KEY }}

# - uses: EndBug/add-and-commit@v9
# with:
# message: "PO files updated."

# - name: Create pull request
# id: cpr_crowdin
# uses: peter-evans/create-pull-request@v3
# with:
# token: ${{ secrets.GITHUB_TOKEN }}
# commit-message: Crowdin translations download
# title: "[Crowdin] Updated translation files"
# body: |
# Created by the [Crowdin download workflow](.github/workflows/crowdin_download.yml).
# branch: "auto/crowdin"
# author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

- name: create pull request
run: gh pr create -B auto/crowdin -H master --title 'Update translations.' --body 'Created by Github action'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40 changes: 40 additions & 0 deletions .github/workflows/crowdin-upload.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Upload to crowdin

on:
workflow_dispatch:
push:
branches: [master]
paths:
- "**.py"

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
ref: master

- name: Install crowdin cli
run: |
wget -qO - https://artifacts.crowdin.com/repo/GPG-KEY-crowdin | sudo apt-key add -
echo "deb https://artifacts.crowdin.com/repo/deb/ /" | sudo tee -a /etc/apt/sources.list.d/crowdin.list
sudo apt-get update && sudo apt-get install crowdin3
- uses: actions/setup-python@v4
with:
python-version: "3.11"
cache: pip

- name: babel extract (pot file generation)
run: |
pip install babel
sh ./bin/pot-generation.sh
- name: Upload sources
shell: bash
run: |
crowdin upload
env:
CROWDIN_API_KEY: ${{ secrets.CROWDIN_API_KEY }}
27 changes: 0 additions & 27 deletions .github/workflows/generate-mo-files.yml

This file was deleted.

38 changes: 0 additions & 38 deletions .github/workflows/generate-pot-file.yml

This file was deleted.

3 changes: 3 additions & 0 deletions crowdin.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
project_id: "532668"
api_token_env: CROWDIN_API_KEY

files:
- source: /resources/locale/*.pot
translation: /resources/locale/%locale%/LC_MESSAGES/%file_name%.po
Binary file removed resources/locale/fr/LC_MESSAGES/mybot.mo
Binary file not shown.
Loading

0 comments on commit 1c761ac

Please sign in to comment.