diff --git a/.github/workflows/check-i18n-task.yml b/.github/workflows/check-i18n-task.yml new file mode 100644 index 00000000..8735ed1d --- /dev/null +++ b/.github/workflows/check-i18n-task.yml @@ -0,0 +1,67 @@ +name: Check Internationalization + +env: + # See: https://github.com/actions/setup-go/tree/v2#readme + GO_VERSION: '1.16' + +# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows +on: + create: + push: + paths: + - '.github/workflows/check-i18n-task.ya?ml' + - 'package.json' + - '**/package.json' + - '**.ts' + - 'i18n/**' + pull_request: + paths: + - '.github/workflows/check-i18n-task.ya?ml' + - 'package.json' + - '**/package.json' + - '**.ts' + - 'i18n/**' + workflow_dispatch: + repository_dispatch: + +jobs: + run-determination: + runs-on: ubuntu-latest + outputs: + result: ${{ steps.determination.outputs.result }} + steps: + - name: Determine if the rest of the workflow should run + id: determination + run: | + RELEASE_BRANCH_REGEX="refs/heads/[0-9]+.[0-9]+.x" + # The `create` event trigger doesn't support `branches` filters, so it's necessary to use Bash instead. + if [[ \ + "${{ github.event_name }}" != "create" || \ + "${{ github.ref }}" =~ $RELEASE_BRANCH_REGEX \ + ]]; then + # Run the other jobs. + RESULT="true" + else + # There is no need to run the other jobs. + RESULT="false" + fi + + echo "::set-output name=result::$RESULT" + + check: + needs: run-determination + if: needs.run-determination.outputs.result == 'true' + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Install Node.js 12.x + uses: actions/setup-node@v1 + with: + node-version: '12.14.1' + registry-url: 'https://registry.npmjs.org' + + - name: Check for errors + run: yarn i18n:check diff --git a/.github/workflows/i18n-nightly-push.yml b/.github/workflows/i18n-nightly-push.yml new file mode 100644 index 00000000..942a3f6d --- /dev/null +++ b/.github/workflows/i18n-nightly-push.yml @@ -0,0 +1,30 @@ +name: i18n-nightly-push + +on: + schedule: + # run every day at 1AM + - cron: '0 1 * * *' + +jobs: + push-to-transifex: + # This workflow is only of value to the arduino/arduino-ide repository and + # would always fail in forks + if: github.repository == 'arduino/arduino-ide' + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Install Node.js 12.x + uses: actions/setup-node@v1 + with: + node-version: '12.14.1' + registry-url: 'https://registry.npmjs.org' + + - name: Run i18n:push script + run: yarn run i18n:push + env: + TRANSIFEX_ORGANIZATION: ${{ secrets.TRANSIFEX_ORGANIZATION }} + TRANSIFEX_PROJECT: ${{ secrets.TRANSIFEX_PROJECT }} + TRANSIFEX_RESOURCE: ${{ secrets.TRANSIFEX_RESOURCE }} + TRANSIFEX_API_KEY: ${{ secrets.TRANSIFEX_API_KEY }} diff --git a/.github/workflows/i18n-weekly-pull.yml b/.github/workflows/i18n-weekly-pull.yml new file mode 100644 index 00000000..e97fc213 --- /dev/null +++ b/.github/workflows/i18n-weekly-pull.yml @@ -0,0 +1,38 @@ +name: i18n-weekly-pull + +on: + schedule: + # run every monday at 2AM + - cron: '0 2 * * 1' + +jobs: + pull-from-transifex: + # This workflow is only of value to the arduino/arduino-ide repository and + # would always fail in forks + if: github.repository == 'arduino/arduino-ide' + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Install Node.js 12.x + uses: actions/setup-node@v1 + with: + node-version: '12.14.1' + registry-url: 'https://registry.npmjs.org' + + - name: Run i18n:pull script + run: yarn run i18n:pull + env: + TRANSIFEX_ORGANIZATION: ${{ secrets.TRANSIFEX_ORGANIZATION }} + TRANSIFEX_PROJECT: ${{ secrets.TRANSIFEX_PROJECT }} + TRANSIFEX_RESOURCE: ${{ secrets.TRANSIFEX_RESOURCE }} + TRANSIFEX_API_KEY: ${{ secrets.TRANSIFEX_API_KEY }} + + - name: Create Pull Request + uses: peter-evans/create-pull-request@v3 + with: + commit-message: Updated translation files + title: Updated translation files + branch: i18n/translations-update + author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>