-
Notifications
You must be signed in to change notification settings - Fork 278
71 lines (66 loc) · 2.09 KB
/
build-ota-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
name: OTA translations
on:
workflow_dispatch:
schedule:
# Every day at 10:11 UTC
- cron: '11 10 * * *'
jobs:
download-translations:
name: Get Crowdin translations
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Crowdin CLI
run: npm i -g @crowdin/cli
- name: Download latest translations from Crowdin
run: |
echo 'api_token: "${{secrets.CROWDIN_PERSONAL_TOKEN}}"' >>crowdin.yaml
crowdin download
rm crowdin.yaml
- uses: actions/upload-artifact@v4
with:
name: translations
path: locales/*.po
check-po-validity:
name: Check translations
runs-on: ubuntu-latest
needs: download-translations
steps:
- uses: actions/download-artifact@v4
with:
name: translations
path: locales
- name: Install GNU gettext
run: sudo apt-get install gettext
- name: Check PO files with msgfmt -v -c
run: |
for i in locales/*.po ; do
echo "checking $i..."
msgfmt -v -c -o /dev/null $i
done
build-ota-translations:
name: Build OTA translations
runs-on: ubuntu-latest
needs: download-translations
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: translations
path: locales
- name: Install GNU gettext
run: sudo apt-get install gettext
- name: Build OTA updates
run: scripts/build-ota-translations.sh
- name: Upload OTA updates
run: |
VERSION=$(sed -n -e 's/.*POEDIT_VERSION_SHORT.* "\(.*\)".*/\1/p' src/version.h)
echo "OTA version: $VERSION"
curl --fail-with-body -F "version=$VERSION" -F "[email protected]" -H "X-Api-Key: ${{secrets.OTA_API_KEY}}" ${{vars.OTA_UPLOAD_ENDPOINT}} >response
cat response
modified=$(echo `jq -r '.modified[]' < response`)
if [ -n "$modified" ] ; then
echo "::notice title=Translations updated::Updated translation files: $modified"
else
echo "::notice title=No updates::No translations were updated."
fi