2023-12-29 17:38:23 +01:00
|
|
|
name: "🌐 Synchronize Localization"
|
|
|
|
|
|
|
|
on:
|
|
|
|
workflow_dispatch:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- master
|
|
|
|
paths:
|
2024-05-25 12:04:50 +02:00
|
|
|
- 'common/src/commonMain/composeResources/values/*.xml'
|
2023-12-29 17:38:23 +01:00
|
|
|
- 'listing/google/base/*.html'
|
|
|
|
- 'listing/google/base/*.xml'
|
|
|
|
# Configuration.
|
|
|
|
- 'crowdin.yml'
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
sync-localization:
|
|
|
|
name: Synchronize Crowdin Translations
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v4
|
2024-06-04 10:24:08 +02:00
|
|
|
- uses: crowdin/github-action@v2
|
2023-12-29 17:38:23 +01:00
|
|
|
with:
|
|
|
|
upload_sources: true
|
|
|
|
# We only want to upload the sources, nothing else is
|
|
|
|
# supported.
|
|
|
|
upload_translations: false
|
|
|
|
download_translations: true
|
|
|
|
config: 'crowdin.yml'
|
2024-06-06 10:32:44 +02:00
|
|
|
create_pull_request: false
|
2024-06-06 10:34:57 +02:00
|
|
|
push_translations: false
|
2023-12-29 17:38:23 +01:00
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.PERSONAL_TOKEN }}
|
|
|
|
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
|
|
|
|
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
|
2024-06-06 10:32:44 +02:00
|
|
|
# https://github.com/crowdin/github-action/issues/229
|
|
|
|
- name: Fix permissions Crowdin created
|
|
|
|
run: |
|
2024-06-06 10:34:57 +02:00
|
|
|
sudo chmod -R 666 common/src/commonMain/composeResources/values-*/*.xml
|
2024-06-06 08:18:51 +02:00
|
|
|
- name: "Update library"
|
|
|
|
run: |
|
|
|
|
python .github/update_localization.py
|
|
|
|
- name: "Check if any changes"
|
|
|
|
id: check-changes
|
|
|
|
run: |
|
|
|
|
has_changes=$(if [ -n "$(git status --porcelain)" ]; then echo "true"; else echo "false"; fi)
|
|
|
|
echo "$has_changes"
|
|
|
|
echo "HAS_CHANGES=$has_changes" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Commit and push changes
|
|
|
|
uses: devops-infra/action-commit-push@v0.9.2
|
|
|
|
if: ${{ startsWith(steps.check-changes.outputs.HAS_CHANGES, 'true') }}
|
|
|
|
with:
|
|
|
|
github_token: "${{ secrets.PERSONAL_TOKEN }}"
|
|
|
|
add_timestamp: false
|
|
|
|
commit_prefix: "[AUTO]"
|
|
|
|
commit_message: "Update localization library"
|
|
|
|
force: true
|
|
|
|
target_branch: localization_action
|
|
|
|
- name: Create pull request
|
|
|
|
uses: devops-infra/action-pull-request@v0.5.5
|
|
|
|
if: ${{ startsWith(steps.check-changes.outputs.HAS_CHANGES, 'true') }}
|
|
|
|
with:
|
|
|
|
github_token: "${{ secrets.PERSONAL_TOKEN }}"
|
|
|
|
source_branch: localization_action
|
|
|
|
target_branch: master
|
|
|
|
assignee: AChep
|
|
|
|
label: "robot,enhancement"
|
|
|
|
title: New Crowdin translations by GitHub Action
|