From 43422ca169938f11b83aa6036d2b58abb54ccc85 Mon Sep 17 00:00:00 2001 From: Matthias Mair <66015116+matmair@users.noreply.github.com> Date: Sun, 18 Apr 2021 01:42:52 +0200 Subject: [PATCH 1/3] squashing dev-branch (#14) * added action to auto-gen the translation base-file --- .github/workflows/translations.yml | 63 ++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 .github/workflows/translations.yml diff --git a/.github/workflows/translations.yml b/.github/workflows/translations.yml new file mode 100644 index 0000000000..e0f38eb20a --- /dev/null +++ b/.github/workflows/translations.yml @@ -0,0 +1,63 @@ +name: Make Translation + +on: ["push", "pull_request"] +# on: +# push: +# branches: +# - master + + +jobs: + build: + + runs-on: ubuntu-latest + + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + INVENTREE_DB_NAME: './test_db.sqlite' + INVENTREE_DB_ENGINE: django.db.backends.sqlite3 + INVENTREE_DEBUG: info + INVENTREE_MEDIA_ROOT: ./media + INVENTREE_STATIC_ROOT: ./static + + steps: + - uses: actions/checkout@v2 + - name: get current translations + run: | + git fetch + git checkout origin/l10_base -- `git ls-tree origin/l10_base -r --name-only | grep ".po"` + git reset + - name: Set up Python 3.7 + uses: actions/setup-python@v1 + with: + python-version: 3.7 + - name: Install Dependencies + run: | + sudo apt-get update + sudo apt-get install -y gettext + pip3 install invoke + invoke install + - name: Make Translations + run: | + cd InvenTree + python manage.py makemessages -e py -e html -e js + - name: stash changes + run: | + git stash + - name: Checkout tranlation-branch + uses: actions/checkout@v2.3.4 + with: + ref: l10_base + - name: Commit files + run: | + git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" + git config --local user.name "github-actions[bot]" + git checkout stash -- . + git reset + git add "*.po" + git commit -m "generated translation base" + - name: Push changes + uses: ad-m/github-push-action@master + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + branch: l10_base From cdea39def0e22c1ddc30bd06c615a6f00ddcf890 Mon Sep 17 00:00:00 2001 From: Matthias Mair <66015116+matmair@users.noreply.github.com> Date: Wed, 21 Apr 2021 11:16:05 +0200 Subject: [PATCH 2/3] use invoke for trans instead of commandline --- .github/workflows/translations.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/translations.yml b/.github/workflows/translations.yml index e0f38eb20a..b6579de008 100644 --- a/.github/workflows/translations.yml +++ b/.github/workflows/translations.yml @@ -39,8 +39,7 @@ jobs: invoke install - name: Make Translations run: | - cd InvenTree - python manage.py makemessages -e py -e html -e js + invoke translate - name: stash changes run: | git stash From decb56e3532276757021ab63b85784f1ed98fa52 Mon Sep 17 00:00:00 2001 From: Matthias Mair <66015116+matmair@users.noreply.github.com> Date: Wed, 21 Apr 2021 14:27:25 +0200 Subject: [PATCH 3/3] updated reference for InvenTree/InvenTree won't work if there isn't a origin/l10 in the repo --- .github/workflows/translations.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/translations.yml b/.github/workflows/translations.yml index b6579de008..efce44fc14 100644 --- a/.github/workflows/translations.yml +++ b/.github/workflows/translations.yml @@ -25,7 +25,7 @@ jobs: - name: get current translations run: | git fetch - git checkout origin/l10_base -- `git ls-tree origin/l10_base -r --name-only | grep ".po"` + git checkout origin/l10 -- `git ls-tree origin/l10 -r --name-only | grep ".po"` git reset - name: Set up Python 3.7 uses: actions/setup-python@v1 @@ -46,7 +46,7 @@ jobs: - name: Checkout tranlation-branch uses: actions/checkout@v2.3.4 with: - ref: l10_base + ref: l10 - name: Commit files run: | git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" @@ -54,9 +54,9 @@ jobs: git checkout stash -- . git reset git add "*.po" - git commit -m "generated translation base" + git commit -m "updated translation base" - name: Push changes uses: ad-m/github-push-action@master with: github_token: ${{ secrets.GITHUB_TOKEN }} - branch: l10_base + branch: l10