From 901ab87717f642f2ab5ce68ef0d01be38ca6726d Mon Sep 17 00:00:00 2001 From: Alexandre Flament Date: Thu, 5 Aug 2021 13:57:48 +0200 Subject: [translations] web integration * make babel.translations.to.master: pull weblate updates * make babel.master.to.translations: push .pot and .po files to weblate --- .github/workflows/integration.yml | 40 +++++++++++----------- .github/workflows/translations-update.yml | 56 +++++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+), 20 deletions(-) create mode 100644 .github/workflows/translations-update.yml (limited to '.github/workflows') diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 78fc66e3f..886df3b2f 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -91,7 +91,7 @@ jobs: COMMIT_MESSAGE: build from commit ${{ github.sha }} babel: - name: Babel + name: Update translations branch runs-on: ubuntu-20.04 if: ${{ github.repository_owner == 'searxng' && github.ref == 'refs/heads/master' }} needs: @@ -102,32 +102,32 @@ jobs: - name: Checkout uses: actions/checkout@v2 with: - persist-credentials: false + fetch-depth: '0' + token: ${{ secrets.WEBLATE_GITHUB_TOKEN }} - name: Set up Python uses: actions/setup-python@v2 with: python-version: '3.9' architecture: 'x64' + - name: Cache Python dependencies + id: cache-python + uses: actions/cache@v2 + with: + path: ./local + key: python-ubuntu-20.04-3.9-${{ hashFiles('requirements*.txt', 'setup.py') }} + - name: weblate & git setup + env: + WEBLATE_CONFIG: ${{ secrets.WEBLATE_CONFIG }} + run: | + mkdir -p ~/.config + echo "${WEBLATE_CONFIG}" > ~/.config/weblate + git config --global user.email "searxng-bot@users.noreply.github.com" + git config --global user.name "searxng-bot" - name: Update transations id: update - continue-on-error: true - run: make V=1 ci.babel.update - - name: Open pull request - if: steps.update.outcome == 'success' - uses: peter-evans/create-pull-request@v3 - with: - commit-message: Update translations (pot, po) - committer: searx-bot - author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com> - signoff: false - branch: update_translations_pot - delete-branch: true - draft: false - title: 'Update translations (pot, po)' - body: | - Update messages.pot and messages.po files - labels: | - translation + run: | + git restore utils/brand.env + make V=1 babel.master.to.translations dockers: name: Docker diff --git a/.github/workflows/translations-update.yml b/.github/workflows/translations-update.yml new file mode 100644 index 000000000..274a093df --- /dev/null +++ b/.github/workflows/translations-update.yml @@ -0,0 +1,56 @@ +name: "Update translations" +on: + schedule: + - cron: "05 07 * * 5" + workflow_dispatch: + +jobs: + babel: + name: "translations: update master branch" + runs-on: ubuntu-20.04 + if: ${{ github.repository_owner == 'searxng' && github.ref == 'refs/heads/master' }} + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: '0' + token: ${{ secrets.WEBLATE_GITHUB_TOKEN }} + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: '3.9' + architecture: 'x64' + - name: Cache Python dependencies + id: cache-python + uses: actions/cache@v2 + with: + path: ./local + key: python-ubuntu-20.04-3.9-${{ hashFiles('requirements*.txt', 'setup.py') }} + - name: weblate & git setup + env: + WEBLATE_CONFIG: ${{ secrets.WEBLATE_CONFIG }} + run: | + mkdir -p ~/.config + echo "${WEBLATE_CONFIG}" > ~/.config/weblate + git config --global user.email "searxng-bot@users.noreply.github.com" + git config --global user.name "searxng-bot" + - name: Merge and push transation updates + run: | + make V=1 babel.translations.to.master + - name: Create Pull Request + id: cpr + uses: peter-evans/create-pull-request@v3 + with: + token: ${{ secrets.WEBLATE_GITHUB_TOKEN }} + commit-message: Update translations + committer: searxng-bot + author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com> + signoff: false + branch: translations_update + delete-branch: true + draft: false + title: 'Update translations' + body: | + Update translations + labels: | + translation -- cgit v1.2.3 From 0dc8d244c51ca391538c31bc34bc9ef9806d1a62 Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Mon, 9 Aug 2021 18:03:25 +0200 Subject: [translation] ./manage: add comments to new functions, rename job ./mange Comment functions: - babel.setup.translations.worktree - babel.weblate.to.translations - babel.translations.to.master - babel.master.to.translations BTW: - changed some cd into pushd - removed obsolete `set -x` - remove not needed echo from `last_commit_message=$(echo ..` .github/workflows/translations-update.yml docs/dev/translation.rst Rename job to: "create PR for additons from weblate" Signed-off-by: Markus Heiser --- .github/workflows/translations-update.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to '.github/workflows') diff --git a/.github/workflows/translations-update.yml b/.github/workflows/translations-update.yml index 274a093df..2db9c3d78 100644 --- a/.github/workflows/translations-update.yml +++ b/.github/workflows/translations-update.yml @@ -6,7 +6,7 @@ on: jobs: babel: - name: "translations: update master branch" + name: "create PR for additons from weblate" runs-on: ubuntu-20.04 if: ${{ github.repository_owner == 'searxng' && github.ref == 'refs/heads/master' }} steps: -- cgit v1.2.3 From 97355672cd0956ef9c3c4da558a5de20fa01ed9f Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Mon, 16 Aug 2021 11:30:53 +0200 Subject: [translations] ./manage rename shell functions to integrate weblate Functions implemented to run *Weblate* workflows should use prefix 'weblate.': - babel.setup.translations.worktree --> weblate.translations.worktree Create git worktree ${TRANSLATIONS_WORKTREE} and checkout branch 'translations' from Weblate's counterpart (weblate) of the SearXNG (origin):: remote weblate https://weblate.bubu1.eu/git/searxng/searxng/ - babel.weblate.to.translations --> weblate.to.translations Update 'translations' branch of SearXNG (origin) with last additions from Weblate. - babel.translations.to.master --> weblate.translations.commit Update 'translations' branch of SearXNG (origin) with last additions from Weblate. Copy the changes to the master branch, compile translations and create a commit in the local branch (master) - babel.master.to.translations --> weblate.push.translations Push *translation changes* from SearXNG (origin) to Weblate's counterpart (weblate). Signed-off-by: Markus Heiser --- .github/workflows/integration.yml | 2 +- .github/workflows/translations-update.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to '.github/workflows') diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 886df3b2f..84ce51a04 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -127,7 +127,7 @@ jobs: id: update run: | git restore utils/brand.env - make V=1 babel.master.to.translations + make V=1 weblate.push.translations dockers: name: Docker diff --git a/.github/workflows/translations-update.yml b/.github/workflows/translations-update.yml index 2db9c3d78..c3120ce1e 100644 --- a/.github/workflows/translations-update.yml +++ b/.github/workflows/translations-update.yml @@ -36,7 +36,7 @@ jobs: git config --global user.name "searxng-bot" - name: Merge and push transation updates run: | - make V=1 babel.translations.to.master + make V=1 weblate.translations.commit - name: Create Pull Request id: cpr uses: peter-evans/create-pull-request@v3 -- cgit v1.2.3