OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Add action to push/pull crowdin translations
Oliver Günthercbacc596a234
diff --git a/.github/workflows/crowdin.yml b/.github/workflows/crowdin.ymlnew file mode 100644index 00000000000..8e01c8c3cd6--- /dev/null+++ b/.github/workflows/crowdin.yml@@ -0,0 +1,63 @@+name: Crowdin+on:+ workflow_dispatch:+ schedule:+ - cron: '0 3 * * *' # Daily at 03:00++jobs:+ setup:+ runs-on: ubuntu-latest+ outputs:+ latest_release_branch: ${{ steps.find_latest_release.outputs.branch }}+ steps:+ - id: find_latest_release+ env:+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}+ GITHUB_REPOSITORY: ${{ github.repository }}+ run: |+ BRANCH=$(curl -H "Authorization: token $GITHUB_TOKEN" \+ https://api.github.com/repos/$GITHUB_REPOSITORY/branches?protected=true | \+ jq -r .[].name | grep "release/" | sort -r | head -1+ )+ if [ "$BRANCH" = "" ]; then+ echo "Invalid release branch found: $BRANCH"+ exit 1+ fi+ echo "::set-output name=branch::${BRANCH}"++ crowdin:+ runs-on: ubuntu-latest+ needs: setup+ timeout-minutes: 60+ strategy:+ matrix:+ branch:+ - dev+ - "${{ needs.setup.outputs.latest_release_branch }}"+ steps:+ - uses: actions/checkout@v2+ with:+ ref: ${{ matrix.branch }}+ fetch-depth: 1+ - name: "Updating translations"+ uses: crowdin/[email protected]+ with:+ # Upload current source files+ upload_sources: true+ # Download updated translations+ download_translations: true+ # Which version branch to push to+ crowdin_branch_name: ${{ matrix.BRANCH }}+ # Dont create a PR for the updated translations+ push_translations: false+ env:+ OPENPROJECT_CROWDIN_PROJECT: ${{ secrets.OPENPROJECT_CROWDINV2_PROJECT }}+ OPENPROJECT_CROWDIN_API_KEY: ${{ secrets.OPENPROJECT_CROWDINV2_API_KEY }}+ - name: "Commit translations"+ run: |+ git config user.name "OpenProject Actions CI"+ git config user.email "[email protected]"+ echo "Updating combined translations"+ git ls-files -m | grep 'crowdin\/.*\.yml$' | xargs git add+ git diff --staged --name-only+ git diff --staged --exit-code --quiet || ( git commit -m "update locales from crowdin [ci skip]" && git pull --rebase && git push origin $BRANCH )\ No newline at end of filediff --git a/crowdin.yml b/crowdin.ymlindex 426294683eb..72d2dfe146f 100644--- a/crowdin.yml+++ b/crowdin.yml@@ -8,19 +8,11 @@"preserve_hierarchy": falsefiles: [{- "source": "config/locales/en.yml",- "translation": "config/locales/crowdin/%two_letters_code%.yml",+ "source": "/**/config/locales/en.yml",+ "translation": "/**/config/locales/crowdin/%two_letters_code%.yml",},{- "source": "config/locales/js-en.yml",- "translation": "config/locales/crowdin/js-%two_letters_code%.yml",+ "source": "/**/config/locales/js-en.yml",+ "translation": "/**/config/locales/crowdin/js-%two_letters_code%.yml",},- {- "source": "modules/*/config/locales/en.yml",- "translation": "config/locales/crowdin/%two_letters_code%.yml",- },- {- "source": "modules/*/config/locales/js-en.yml",- "translation": "config/locales/crowdin/js-%two_letters_code%.yml",- }]\ No newline at end of file