62 lines
2.3 KiB
YAML
62 lines
2.3 KiB
YAML
name: Crowdin Sync
|
|
|
|
on:
|
|
schedule:
|
|
- cron: '0 0 * * *'
|
|
|
|
jobs:
|
|
synchronize-with-crowdin:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
|
with:
|
|
ssh-key: ${{ secrets.SSH_PRIVATE_KEY }}
|
|
persist-credentials: true
|
|
- name: push source files
|
|
uses: crowdin/github-action@52aa776766211d83d975df51f3b9c53c2f8ba35f # v2.16.3
|
|
with:
|
|
command: 'push'
|
|
env:
|
|
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
|
|
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
|
|
- name: pull translations
|
|
uses: crowdin/github-action@52aa776766211d83d975df51f3b9c53c2f8ba35f # v2.16.3
|
|
with:
|
|
command: 'download'
|
|
command_args: '--export-only-approved --skip-untranslated-strings'
|
|
env:
|
|
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
|
|
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
|
|
with:
|
|
node-version-file: frontend/.nvmrc
|
|
- name: Ensure file permissions
|
|
run: |
|
|
find pkg/i18n/lang frontend/src/i18n/lang -type f -name "*.json" -exec sudo chmod 666 {} \;
|
|
- name: Fix exported files
|
|
run: |
|
|
node contrib/clean-translations.js
|
|
- name: Check for changes
|
|
id: check_changes
|
|
run: |
|
|
if [ -z "$(git status --porcelain pkg/i18n/lang frontend/src/i18n/lang)" ]; then
|
|
echo "changes_exist=0" >> "$GITHUB_OUTPUT"
|
|
else
|
|
echo "changes_exist=1" >> "$GITHUB_OUTPUT"
|
|
fi
|
|
- name: Commit files
|
|
if: steps.check_changes.outputs.changes_exist != '0'
|
|
run: |
|
|
git config --local user.email "bot@vikunja.io"
|
|
git config --local user.name "Frederick [Bot]"
|
|
git add pkg/i18n/lang frontend/src/i18n/lang
|
|
git commit -m "chore(i18n): update translations via Crowdin"
|
|
- name: Push changes
|
|
if: steps.check_changes.outputs.changes_exist != '0'
|
|
uses: ad-m/github-push-action@881a6320fdb16eb5318c5054f31c218aec2b324c # master
|
|
with:
|
|
ssh: true
|
|
branch: ${{ github.ref }}
|