Improve i18n CI (#10390)
This commit is contained in:
21
.github/workflows/i18n-pull.yaml
vendored
21
.github/workflows/i18n-pull.yaml
vendored
@ -1,7 +1,7 @@
|
|||||||
# Pull down translations from Crowdin every two hours or when triggered manually.
|
# Pull down translations from Crowdin every two hours or when triggered manually.
|
||||||
# When force_pull input is true, translations will be pulled regardless of compilation status.
|
# When force_pull input is true, translations will be pulled regardless of compilation status.
|
||||||
|
|
||||||
name: 'Pull translations'
|
name: 'Pull translations from Crowdin'
|
||||||
|
|
||||||
on:
|
on:
|
||||||
schedule:
|
schedule:
|
||||||
@ -53,7 +53,7 @@ jobs:
|
|||||||
|
|
||||||
# Strict mode fails if there are missing translations.
|
# Strict mode fails if there are missing translations.
|
||||||
- name: Compile translations
|
- name: Compile translations
|
||||||
id: compile_translations
|
id: compile_translations_strict
|
||||||
run: |
|
run: |
|
||||||
npx nx run twenty-server:lingui:compile --strict
|
npx nx run twenty-server:lingui:compile --strict
|
||||||
npx nx run twenty-emails:lingui:compile --strict
|
npx nx run twenty-emails:lingui:compile --strict
|
||||||
@ -68,7 +68,7 @@ jobs:
|
|||||||
git stash
|
git stash
|
||||||
|
|
||||||
- name: Pull translations from Crowdin
|
- name: Pull translations from Crowdin
|
||||||
if: inputs.force_pull || steps.compile_translations.outcome == 'failure'
|
if: inputs.force_pull || steps.compile_translations_strict.outcome == 'failure'
|
||||||
uses: crowdin/github-action@v2
|
uses: crowdin/github-action@v2
|
||||||
with:
|
with:
|
||||||
upload_sources: false
|
upload_sources: false
|
||||||
@ -98,18 +98,13 @@ jobs:
|
|||||||
run: sudo chown -R runner:docker .
|
run: sudo chown -R runner:docker .
|
||||||
|
|
||||||
- name: Compile translations
|
- name: Compile translations
|
||||||
if: inputs.force_pull || steps.compile_translations.outcome == 'failure'
|
id: compile_translations
|
||||||
|
if: inputs.force_pull || steps.compile_translations_strict.outcome == 'failure'
|
||||||
run: |
|
run: |
|
||||||
npx nx run twenty-server:lingui:compile
|
npx nx run twenty-server:lingui:compile
|
||||||
npx nx run twenty-emails:lingui:compile
|
npx nx run twenty-emails:lingui:compile
|
||||||
npx nx run twenty-front:lingui:compile
|
npx nx run twenty-front:lingui:compile
|
||||||
|
git status
|
||||||
- name: Debug git status
|
|
||||||
run: git status
|
|
||||||
|
|
||||||
- name: Check and commit compiled files
|
|
||||||
id: check_changes
|
|
||||||
run: |
|
|
||||||
git config --global user.name 'github-actions'
|
git config --global user.name 'github-actions'
|
||||||
git config --global user.email 'github-actions@twenty.com'
|
git config --global user.email 'github-actions@twenty.com'
|
||||||
git add .
|
git add .
|
||||||
@ -121,11 +116,11 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Push changes
|
- name: Push changes
|
||||||
if: steps.check_changes.outputs.changes_detected == 'true'
|
if: steps.compile_translations.outputs.changes_detected == 'true'
|
||||||
run: git push origin HEAD:i18n
|
run: git push origin HEAD:i18n
|
||||||
|
|
||||||
- name: Create pull request
|
- name: Create pull request
|
||||||
if: steps.check_changes.outputs.changes_detected == 'true'
|
if: steps.compile_translations.outputs.changes_detected == 'true'
|
||||||
run: |
|
run: |
|
||||||
if git diff --name-only origin/main..HEAD | grep -q .; then
|
if git diff --name-only origin/main..HEAD | grep -q .; then
|
||||||
gh pr create -B main -H i18n --title 'i18n - translations' --body 'Created by Github action' || true
|
gh pr create -B main -H i18n --title 'i18n - translations' --body 'Created by Github action' || true
|
||||||
|
|||||||
3
.github/workflows/i18n-push.yaml
vendored
3
.github/workflows/i18n-push.yaml
vendored
@ -1,4 +1,4 @@
|
|||||||
name: 'Extract translations when there is a push to main, and upload them to Crowdin'
|
name: 'Push translations to Crowdin'
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
@ -16,6 +16,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
|
pull-requests: write
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|||||||
Reference in New Issue
Block a user