Skip to content

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

Migrate translations workflows to GitHub Action (#9077)

Cyril Rohrf74b198c99d7
diff --git a/.github/workflows/translations-core.yml b/.github/workflows/translations-core.yml
new file mode 100644
index 00000000000..4e00993dcdf
--- /dev/null
+++ b/.github/workflows/translations-core.yml
@@ -0,0 +1,61 @@
+name: Core / Translations
+on:
+ schedule:
+ - cron: '0 3 * * *' # Daily at 03:00
+ push:
+ branches:
+ - feature/translations-with-github-action
+
+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
+ - uses: ruby/setup-ruby@v1
+ with:
+ bundler-cache: true
+ - name: run
+ env:
+ DATABASE_URL: 'nulldb://nohost'
+ OPENPROJECT_CROWDIN_PROJECT: ${{ secrets.OPENPROJECT_CROWDIN_PROJECT }}
+ OPENPROJECT_CROWDIN_API_KEY: ${{ secrets.OPENPROJECT_CROWDIN_API_KEY }}
+ run: |
+ git config user.name "OpenProject Actions CI"
+ git config user.email "[email protected]"
+ bundle exec rake db:create
+ echo "Updating combined translations"
+ bundle exec rake translations:update
+ git add config/locales/**/*.yml
+ git add modules/**/*.yml
+ 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 )