Skip to content

The open alternative to Salesforce, designed for AI.

chore: improve i18n workflow to prevent stale compiled translations (#18850)

Félix Malfait2dfa7425439d
diff --git a/.github/workflows/docs-i18n-pull.yaml b/.github/workflows/docs-i18n-pull.yaml
index 40cd4413b07..76ad5b042f3 100644
--- a/.github/workflows/docs-i18n-pull.yaml
+++ b/.github/workflows/docs-i18n-pull.yaml
@@ -150,3 +150,11 @@ jobs:
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+
+ - name: Trigger i18n automerge
+ if: github.event_name != 'pull_request' && steps.check_changes.outputs.changes_detected == 'true'
+ uses: peter-evans/repository-dispatch@v2
+ with:
+ token: ${{ secrets.TWENTY_INFRA_TOKEN }}
+ repository: twentyhq/twenty-infra
+ event-type: i18n-pr-ready
diff --git a/.github/workflows/i18n-pull.yaml b/.github/workflows/i18n-pull.yaml
index 27e023af005..6d3cdbf179f 100644
--- a/.github/workflows/i18n-pull.yaml
+++ b/.github/workflows/i18n-pull.yaml
@@ -138,3 +138,11 @@ jobs:
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+
+ - name: Trigger i18n automerge
+ if: steps.compile_translations.outputs.changes_detected == 'true'
+ uses: peter-evans/repository-dispatch@v2
+ with:
+ token: ${{ secrets.TWENTY_INFRA_TOKEN }}
+ repository: twentyhq/twenty-infra
+ event-type: i18n-pr-ready
diff --git a/.github/workflows/i18n-push.yaml b/.github/workflows/i18n-push.yaml
index 7b30d98bbe4..2f7229674de 100644
--- a/.github/workflows/i18n-push.yaml
+++ b/.github/workflows/i18n-push.yaml
@@ -102,3 +102,11 @@ jobs:
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+
+ - name: Trigger i18n automerge
+ if: steps.check_extract_changes.outputs.changes_detected == 'true' || steps.check_compile_changes.outputs.changes_detected == 'true'
+ uses: peter-evans/repository-dispatch@v2
+ with:
+ token: ${{ secrets.TWENTY_INFRA_TOKEN }}
+ repository: twentyhq/twenty-infra
+ event-type: i18n-pr-ready
diff --git a/packages/twenty-docker/twenty/Dockerfile b/packages/twenty-docker/twenty/Dockerfile
index ed3b82045a7..7c2147dd8f9 100644
--- a/packages/twenty-docker/twenty/Dockerfile
+++ b/packages/twenty-docker/twenty/Dockerfile
@@ -30,6 +30,11 @@ COPY ./packages/twenty-ui /app/packages/twenty-ui
COPY ./packages/twenty-sdk /app/packages/twenty-sdk
COPY ./packages/twenty-server /app/packages/twenty-server
+RUN npx nx run twenty-server:lingui:extract && \
+ npx nx run twenty-server:lingui:compile && \
+ npx nx run twenty-emails:lingui:extract && \
+ npx nx run twenty-emails:lingui:compile
+
RUN npx nx run twenty-server:build
RUN yarn workspaces focus --production twenty-emails twenty-shared twenty-sdk twenty-server
@@ -43,6 +48,8 @@ COPY ./packages/twenty-front /app/packages/twenty-front
COPY ./packages/twenty-ui /app/packages/twenty-ui
COPY ./packages/twenty-shared /app/packages/twenty-shared
COPY ./packages/twenty-sdk /app/packages/twenty-sdk
+RUN npx nx run twenty-front:lingui:extract && \
+ npx nx run twenty-front:lingui:compile
RUN npx nx build twenty-front
diff --git a/packages/twenty-emails/project.json b/packages/twenty-emails/project.json
index 6f73f1f85e7..57153312595 100644
--- a/packages/twenty-emails/project.json
+++ b/packages/twenty-emails/project.json
@@ -38,6 +38,7 @@
},
"lingui:extract": {
"executor": "nx:run-commands",
+ "dependsOn": ["^build"],
"options": {
"cwd": "{projectRoot}",
"command": "lingui extract --overwrite --clean"
@@ -45,6 +46,7 @@
},
"lingui:compile": {
"executor": "nx:run-commands",
+ "dependsOn": ["^build"],
"options": {
"cwd": "{projectRoot}",
"command": "lingui compile --typescript"
diff --git a/packages/twenty-front/project.json b/packages/twenty-front/project.json
index c2937e4f03a..380b44cce30 100644
--- a/packages/twenty-front/project.json
+++ b/packages/twenty-front/project.json
@@ -292,6 +292,7 @@
},
"lingui:extract": {
"executor": "nx:run-commands",
+ "dependsOn": ["^build"],
"options": {
"cwd": "{projectRoot}",
"command": "lingui extract --overwrite --clean"
@@ -299,6 +300,7 @@
},
"lingui:compile": {
"executor": "nx:run-commands",
+ "dependsOn": ["^build"],
"options": {
"cwd": "{projectRoot}",
"command": "lingui compile --typescript"
diff --git a/packages/twenty-server/project.json b/packages/twenty-server/project.json
index 4cef79ce2e2..edb65f0bffe 100644
--- a/packages/twenty-server/project.json
+++ b/packages/twenty-server/project.json
@@ -279,6 +279,7 @@
},
"lingui:extract": {
"executor": "nx:run-commands",
+ "dependsOn": ["^build"],
"options": {
"cwd": "{projectRoot}",
"command": "lingui extract --overwrite --clean"
@@ -286,6 +287,7 @@
},
"lingui:compile": {
"executor": "nx:run-commands",
+ "dependsOn": ["^build"],
"options": {
"cwd": "{projectRoot}",
"command": "lingui compile --typescript"