name: Update translation source on: workflow_dispatch: schedule: # runs once per month - cron: '0 0 1 * *' jobs: translations: # Do not run the scheduled workflow on forks if: github.event != 'schedule' || github.repository_owner == 'Cockatrice' runs-on: ubuntu-latest steps: - name: Install lupdate shell: bash run: | sudo apt-get update sudo apt-get install -y --no-install-recommends qttools5-dev-tools - name: Checkout repo uses: actions/checkout@v2 - name: Update cockatrice translations shell: bash run: | shopt -s globstar # globstar is needed for recursive ** lupdate -version echo "reading the following source files:" # note: there are three strings to translate in common right now echo {cockatrice,common}/**/*.{cpp,h} echo "$(echo {cockatrice,common}/**/*.{cpp,h} | wc -w) files total" lupdate {cockatrice,common}/**/*.{cpp,h} -ts cockatrice/translations/cockatrice_en@source.ts - name: Update oracle translations shell: bash run: | shopt -s globstar # globstar is needed for recursive ** lupdate -version echo "reading the following source files:" echo oracle/**/*.{cpp,h} echo "$(echo oracle/**/*.{cpp,h} | wc -w) files total" lupdate oracle/**/*.{cpp,h} -ts oracle/translations/oracle_en@source.ts - name: Check for updates id: check shell: bash run: | set +e # do not fail, just save the exit state git diff --exit-code echo "::set-output name=deploy::$?" - name: Commit changes if: steps.check.outputs.deploy == '1' shell: bash working-directory: ${{env.OUTPUT_PATH}} run: | git config user.name github-actions git config user.email github-actions@github.com git add cockatrice/translations/cockatrice_en@source.ts oracle/translations/oracle_en@source.ts git commit -m "Automated translation update ( $GITHUB_SHA )" git push deploy_commit=$(git rev-parse HEAD) echo "Created commit: $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/commit/$deploy_commit"