-
Notifications
You must be signed in to change notification settings - Fork 278
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'devel/ota-translations'
- Loading branch information
Showing
5 changed files
with
91 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: OTA translations | ||
|
||
on: | ||
workflow_dispatch: | ||
schedule: | ||
# Every day at 10:11 UTC | ||
- cron: '11 10 * * *' | ||
|
||
jobs: | ||
build-ota-translations: | ||
name: Build OTA translations | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Install GNU gettext | ||
run: sudo apt-get install gettext | ||
|
||
- 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 | ||
- name: Build OTA updates | ||
run: scripts/build-ota-translations.sh | ||
|
||
- name: Upload OTA updates | ||
run: | | ||
VERSION=$(sed -n -e 's/.*POEDIT_VERSION.* "\([0-9]*\)\.\([0-9]*\).*".*/\1.\2/p' src/version.h) | ||
echo "OTA version: $VERSION" | ||
curl --fail-with-body -F '[email protected]' -H "X-Api-Key: ${{secrets.OTA_API_KEY}}" "${{secrets.OTA_UPLOAD_ENDPOINT}}?version=${VERSION}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
DESTDIR="ota-update-$$" | ||
rm -rf "$DESTDIR" | ||
mkdir -p "$DESTDIR" | ||
function finish { | ||
rm -rf "$DESTDIR" | ||
} | ||
trap finish EXIT | ||
|
||
# compile PO files, taking care to make them reproducible, i.e. not change if the actual | ||
# translations didn't change: | ||
for po in locales/*.po ; do | ||
mo="$(basename "$po" .po).mo" | ||
mogz="$mo.gz" | ||
printf "%-30s" "$po" | ||
|
||
sed -e 's/^"PO-Revision-Date: .*/"PO-Revision-Date: \\n"/g' "$po" | msgfmt -c -o "$DESTDIR/$mo" - | ||
gzip --no-name -9 "$DESTDIR/$mo" | ||
|
||
size=$(ls -ks "$DESTDIR/$mogz" | cut -d' ' -f1) | ||
printf "%'3d kB %s\n" "$size" "$(cd $DESTDIR && md5sum $mogz)" | ||
done | ||
|
||
# create a tarball of all updates: | ||
tar -C "$DESTDIR" -cf ota-update.tar . | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters