-
Notifications
You must be signed in to change notification settings - Fork 9
138 lines (124 loc) · 3.96 KB
/
translations.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
name: Translations
on:
push:
branches: [main]
paths:
- .github/workflows/translations.yml
- apps/**
- packages/**
- api/app/Enums/**
- api/lang/**
pull_request:
paths:
- .github/workflows/translations.yml
- apps/**
- packages/**
- api/app/Enums/**
- api/lang/**
merge_group:
branches: [main]
jobs:
translations:
name: Translations
runs-on: ubuntu-24.04
env:
PNPM_VERSION: "9.12.3"
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: ${{ env.PNPM_VERSION }}
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version-file: "./.nvmrc"
cache: pnpm
- name: "Install dependencies: workspace"
working-directory: ./
run: pnpm install
- name: "Extract English files: all workspaces"
working-directory: ./
run: pnpm run intl-extract
- name: "Generate untranslated files: all workspaces"
working-directory: ./
run: |
pnpm run check-intl --force
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: "8.3"
extensions: bcmath
- name: Install composer dependencies
working-directory: api
run: |
cp .env.example .env
composer install --no-interaction --prefer-dist --optimize-autoloader
- name: "Generate lang files: api"
working-directory: api
run: php artisan app:check-intl
- name: "Verify no untranslated file: i18n"
if: always()
working-directory: packages/i18n/src/lang
run: >
if test -f "untranslated.json"; then
echo ":x: i18n has untranslated strings" | tee -a $GITHUB_STEP_SUMMARY;
exit 1;
else
echo ":heavy_check_mark: i18n is fully translated" | tee -a $GITHUB_STEP_SUMMARY;
exit 0;
fi
- name: "Verify clean file: i18n"
if: always()
working-directory: packages/i18n/src/lang
run: >
if [[ "$(git status --porcelain)" == *packages/i18n/src/lang/fr.json* ]]; then
echo ":x: i18n is dirty" | tee -a $GITHUB_STEP_SUMMARY;
exit 1;
else
echo ":heavy_check_mark: i18n is clean" | tee -a $GITHUB_STEP_SUMMARY;
exit 0;
fi
- name: "Verify no untranslated file: web"
if: always()
working-directory: apps/web/src/lang
run: >
if test -f "untranslated.json"; then
echo ":x: Web has untranslated strings" | tee -a $GITHUB_STEP_SUMMARY;
exit 1;
else
echo ":heavy_check_mark: Web is fully translated" | tee -a $GITHUB_STEP_SUMMARY;
exit 0;
fi
- name: "Verify clean file: web"
if: always()
working-directory: apps/web/src/lang
run: >
if [[ "$(git status --porcelain)" == *apps/web/src/lang/fr.json* ]]; then
echo ":x: Web is dirty" | tee -a $GITHUB_STEP_SUMMARY;
exit 1;
else
echo ":heavy_check_mark: Web is clean" | tee -a $GITHUB_STEP_SUMMARY;
exit 0;
fi
- name: "Verify: api"
if: always()
working-directory: api/storage/app
run: >
if test -f "intlErrors.json"; then
echo ":x: API has missing files" | tee -a $GITHUB_STEP_SUMMARY;
exit 1;
else
echo ":heavy_check_mark: All API files exist" | tee -a $GITHUB_STEP_SUMMARY;
exit 0;
fi
- name: "Upload untranslated files: all workspaces"
if: always()
uses: actions/upload-artifact@v4
with:
name: untranslated
path: |
apps/**/lang/untranslated.json
packages/**/lang/untranslated.json
!packages/node_modules/**
api/**/intlErrors.json
if-no-files-found: ignore