From 25bfa14543f341f05dcc4fbb84f1ab479b94558b Mon Sep 17 00:00:00 2001 From: David Eckhard Date: Tue, 28 Feb 2023 15:10:02 +0100 Subject: [PATCH] transifex: update config ci: use i18n reusable workflows --- .github/workflows/i18n-pull.yml | 77 +++++-------------------------- .github/workflows/i18n-push.yml | 80 ++++++--------------------------- .tx/config | 9 ++-- 3 files changed, 29 insertions(+), 137 deletions(-) diff --git a/.github/workflows/i18n-pull.yml b/.github/workflows/i18n-pull.yml index 7bbdc66b..00133035 100644 --- a/.github/workflows/i18n-pull.yml +++ b/.github/workflows/i18n-pull.yml @@ -1,69 +1,14 @@ -name: i18n:pull JS translations +# -*- coding: utf-8 -*- +# +# Copyright (C) 2023 Graz University of Technology. +# +# React-Invenio-Deposit is free software; you can redistribute it and/or modify it +# under the terms of the MIT License; see LICENSE file for more details. + +name: i18n:pull translations on: workflow_dispatch # manually trigger jobs: - pull-translations: - runs-on: ubuntu-20.04 - - strategy: - matrix: - node-version: [18.x] - - steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v1 - with: - node-version: ${{ matrix.node-version }} - - - name: Install & Build - run: | - npm install - - # setup python - - name: Set up Python ${{ env.PYTHON-VERSION }} - uses: actions/setup-python@v2 - with: - python-version: 3.9 - - # install transifex-client - - name: install transifex-client - run: | - pip install transifex-client - - # store token - - name: store token - run: | - touch ~/.transifexrc - echo [https://www.transifex.com] >> ~/.transifexrc - echo api_hostname=https://api.transifex.com >> ~/.transifexrc - echo hostname=https://www.transifex.com >> ~/.transifexrc - echo password=${{ secrets.TRANSIFEX_TOKEN }} >> ~/.transifexrc - echo username=api >> ~/.transifexrc - - # pull all lang - - name: pull translations - run: | - tx pull -a -f - - # compile .po file to json - - name: compile - run: | - npm run compile_catalog - - # remove transifex credential file - - name: remove transifexrc file - uses: JesseTG/rm@v1.0.2 - with: - path: ~/.transifexrc - - - name: Create Pull Request - uses: peter-evans/create-pull-request@v3 - with: - commit-message: i18n:pull translations - title: i18n:pull translations - body: i18n:pull translations - branch: 101-translations # name of branch which PR is created from - delete-branch: true # delete branch once merged,closed + i18n-pull: + uses: inveniosoftware/invenio-i18n/.github/workflows/i18n-pull-base.yml@master + secrets: inherit diff --git a/.github/workflows/i18n-push.yml b/.github/workflows/i18n-push.yml index 80afbc33..6133dba1 100644 --- a/.github/workflows/i18n-push.yml +++ b/.github/workflows/i18n-push.yml @@ -1,69 +1,17 @@ -name: i18n:extract & push JS translations +# -*- coding: utf-8 -*- +# +# Copyright (C) 2023 Graz University of Technology. +# +# React-Invenio-Deposit is free software; you can redistribute it and/or modify it +# under the terms of the MIT License; see LICENSE file for more details. + +name: i18n:push translations on: workflow_dispatch # manually trigger jobs: - extract-push-translations: - runs-on: ubuntu-20.04 - - strategy: - matrix: - node-version: [18.x] - - steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v1 - with: - node-version: ${{ matrix.node-version }} - - - name: Install & Build - run: | - npm install - - # setup python - - name: Set up Python ${{ env.PYTHON-VERSION }} - uses: actions/setup-python@v2 - with: - python-version: 3.9 - - # install transifex-client - - name: install transifex-client - run: | - pip install transifex-client - - # store token - - name: store token - run: | - touch ~/.transifexrc - echo [https://www.transifex.com] >> ~/.transifexrc - echo api_hostname=https://api.transifex.com >> ~/.transifexrc - echo hostname=https://www.transifex.com >> ~/.transifexrc - echo password=${{ secrets.TRANSIFEX_TOKEN }} >> ~/.transifexrc - echo username=api >> ~/.transifexrc - - # extract - - name: extract_messages - run: | - npm run extract_messages - - # push - - name: push_messages - run: | - tx push -s - - # remove transifex credential file - - name: remove transifexrc file - uses: JesseTG/rm@v1.0.2 - with: - path: ~/.transifexrc - - - name: Create Pull Request - uses: peter-evans/create-pull-request@v3 - with: - commit-message: i18n:push translations - title: i18n:push translations - body: i18n:push translations - branch: 101-translations # name of branch which PR is created from - delete-branch: true # delete branch once merged,closed + i18n-extract: + uses: inveniosoftware/invenio-i18n/.github/workflows/i18n-push-base.yml@master + with: + extract-backend: false + frontend-package-path: "./" + secrets: inherit diff --git a/.tx/config b/.tx/config index 8c33720e..0cd26ecf 100644 --- a/.tx/config +++ b/.tx/config @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # -# Copyright (C) 2021 CERN. -# Copyright (C) 2021 Graz University of Technology. +# Copyright (C) 2021 CERN. +# Copyright (C) 2021-2023 Graz University of Technology. # # React-Invenio-Deposit is free software; you can redistribute it and/or modify it # under the terms of the MIT License; see LICENSE file for more details. @@ -30,11 +30,10 @@ # 9) Convert .po file for a single language # $ npm run compile_catalog lang - [main] -host = https://www.transifex.com +host = https://app.transifex.com -[invenio.react-invenio-deposit-messages] +[o:inveniosoftware:p:invenio:r:react-invenio-deposit-messages] file_filter = src/lib/translations/messages//messages.po source_file = src/lib/translations/translations.pot source_lang = en