-
Notifications
You must be signed in to change notification settings - Fork 0
245 lines (221 loc) · 8.9 KB
/
check_for_crowdin_updates.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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
name: Check for Crowdin Updates
on:
schedule:
- cron: '0 0 * * 1' # Every Monday at 12:00 AM UTC, which is 10:00 AM Melbourne time (AEST)
workflow_dispatch:
jobs:
fetch_translations:
runs-on: ubuntu-latest
steps:
- name: Checkout Repo Content
uses: actions/checkout@v4
with:
path: 'scripts'
# don't provide a branch (ref) so it uses the default for that event
- name: Setup shared
uses: ./scripts/actions/setup_shared
- name: Download Translations
env:
CROWDIN_API_TOKEN: ${{ secrets.CROWDIN_API_TOKEN }}
run: |
python "${{ github.workspace }}/scripts/crowdin/download_translations_from_crowdin.py" \
"$CROWDIN_API_TOKEN" \
618696 \
"${{ github.workspace }}/raw_translations" \
--glossary_id 407522 \
--concept_id 36 \
--skip-untranslated-strings
- name: Upload xliff artefacts
uses: actions/upload-artifact@v4
with:
name: session-xliff-artefact
path: |
${{ github.workspace }}/raw_translations/*.xliff
overwrite: true
if-no-files-found: warn
retention-days: 7
build_ios:
runs-on: ubuntu-latest
needs: [fetch_translations]
steps:
- name: Checkout Repo Content
uses: actions/checkout@v4
with:
path: 'scripts'
# don't provide a branch (ref) so it uses the default for that event
- name: Checkout iOS
uses: actions/checkout@v4
with:
repository: 'oxen-io/session-ios'
path: 'ios'
ref: 'dev'
- name: Setup shared
uses: ./scripts/actions/setup_shared
- name: Prepare iOS Strings
run: |
python "${{ github.workspace }}/scripts/crowdin/generate_ios_strings.py" \
"${{ github.workspace }}/raw_translations" \
"${{ github.workspace }}/ios/Session/Meta" \
"${{ github.workspace }}/ios/SessionUtilitiesKit/General/Constants.swift"
- name: Upload iOS artefacts
uses: actions/upload-artifact@v4
with:
name: session-ios-artifact
path: |
${{ github.workspace }}/ios/Session/Meta/Localizable.xcstrings
${{ github.workspace }}/ios/SessionUtilitiesKit/General/Constants.swift
overwrite: true
if-no-files-found: warn
retention-days: 7
build_qa:
runs-on: ubuntu-latest
needs: [fetch_translations]
steps:
- name: Checkout Repo Content
uses: actions/checkout@v4
with:
path: 'scripts'
# don't provide a branch (ref) so it uses the default for that event
- name: Setup shared
uses: ./scripts/actions/setup_shared
# It's easier to find what went wrong with some strings if we can get the files from the artefact upload step above.
# The job will still be marked as failed and no Pull Requests will be made.
- name: Prepare QA strings
run: |
cd ${{ github.workspace }}/desktop/
python ./tools/localization/generateLocales.py --generate-types --print-problems --print-problem-strings --print-problem-formatting-tag-strings --error-on-problems
cd -
- name: Upload QA artefacts
uses: actions/upload-artifact@v4
with:
name: session-qa-artifact
path: |
${{ github.workspace }}/desktop/ts/localization/locales.ts
${{ github.workspace }}/desktop/ts/localization/constants.ts
overwrite: true
if-no-files-found: warn
retention-days: 7
build_desktop:
needs: [fetch_translations]
runs-on: ubuntu-latest
steps:
- name: Checkout Repo Content
uses: actions/checkout@v4
with:
path: 'scripts'
# don't provide a branch (ref) so it uses the default for that event
- name: Setup shared
uses: ./scripts/actions/setup_shared
- name: Checkout Desktop
uses: actions/checkout@v4
with:
repository: 'oxen-io/session-desktop'
path: 'desktop'
ref: 'standardised_strings_qa_2'
- name: Prepare Desktop Strings
run: |
rm -rf ${{ github.workspace }}/desktop/_locales/*
python "${{ github.workspace }}/scripts/crowdin/generate_desktop_strings.py" \
"${{ github.workspace }}/raw_translations" \
"${{ github.workspace }}/desktop/_locales" \
"${{ github.workspace }}/desktop/ts/localization/constants.ts"
- name: Upload Desktop artifacts
uses: actions/upload-artifact@v4
with:
name: session-desktop-artifact
path: |
${{ github.workspace }}/desktop/_locales
${{ github.workspace }}/desktop/ts/localization/constants.ts
overwrite: true
if-no-files-found: warn
retention-days: 7
build_android:
runs-on: ubuntu-latest
needs: [fetch_translations]
steps:
- name: Checkout Repo Content
uses: actions/checkout@v4
with:
path: 'scripts'
# don't provide a branch (ref) so it uses the default for that event
- name: Checkout Android
uses: actions/checkout@v4
with:
repository: 'oxen-io/session-android'
path: 'android'
submodules: recursive
ref: 'release/1.20.0'
- name: Setup shared
uses: ./scripts/actions/setup_shared
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 17
cache: gradle
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Prepare Android Strings
run: |
python "${{ github.workspace }}/scripts/crowdin/generate_android_strings.py" \
"${{ github.workspace }}/raw_translations" \
"${{ github.workspace }}/android/libsession/src/main/res" \
"${{ github.workspace }}/android/libsession/src/main/java/org/session/libsession/utilities/NonTranslatableStringConstants.kt"
- name: Upload Android artefacts
uses: actions/upload-artifact@v4
with:
name: session-android-artefact
path: |
${{ github.workspace }}/android/libsession/src/main/res/values*/strings.xml
${{ github.workspace }}/android/libsession/src/main/java/org/session/libsession/utilities/NonTranslatableStringConstants.kt
overwrite: true
if-no-files-found: warn
retention-days: 7
- name: Validate strings for Android
run: ${{ github.workspace }}/android/gradlew :libsession:packageDebugResources
make_prs:
needs: [build_android, build_ios, build_qa, build_desktop]
runs-on: ubuntu-latest
steps:
# Not sure why yet, but uploading artefacts after creating the pull requests
# seems to only include a part of what should be in.
# As a dirty fix we upload the artefacts first, and then make the pull request
- name: Create Android Pull Request
uses: peter-evans/create-pull-request@v6
with:
path: 'android'
token: ${{ secrets.CROWDIN_PR_TOKEN }}
title: "[Automated] Update translations from Crowdin"
body: |
[Automated]
This PR includes the latest translations from Crowdin
Session uses the community-driven translation platform Crowdin for localization, anyone can contribute at https://getsession.org/translate
branch: feature/update-crowdin-translations
commit-message: "[Automated] Update translations from Crowdin"
delete-branch: true
- name: Create Desktop Pull Request
uses: peter-evans/create-pull-request@v6
with:
path: 'desktop'
token: ${{ secrets.CROWDIN_PR_TOKEN }}
title: "[Automated] Update translations from Crowdin"
body: |
[Automated]
This PR includes the latest translations from Crowdin
Session uses the community-driven translation platform Crowdin for localization, anyone can contribute at https://getsession.org/translate
branch: feature/update-crowdin-translations
commit-message: "[Automated] Update translations from Crowdin"
delete-branch: true
- name: Create iOS Pull Request
uses: peter-evans/create-pull-request@v6
with:
path: 'ios'
token: ${{ secrets.CROWDIN_PR_TOKEN }}
title: "[Automated] Update translations from Crowdin"
body: |
[Automated]
This PR includes the latest translations from Crowdin
Session uses the community-driven translation platform Crowdin for localization, anyone can contribute at https://getsession.org/translate
branch: feature/update-crowdin-translations
commit-message: "[Automated] Update translations from Crowdin"
delete-branch: true