/
/
/
1name: Upload Lokalise source strings
2
3# Pushes the generated English source file (music_assistant/translations/en.json,
4# produced by scripts/build_translations.py from the per-module strings.json files)
5# to the Lokalise server project. Together with lokalise-download.yml this gives a fully
6# GitHub-Actions-driven push/pull sync: the repo is the source of truth for the English
7# source keys, Lokalise holds the translations, and the download workflow brings them back.
8#
9# Triggers on changes to the generated source file on dev (immediate sync) plus a weekly
10# safety-net run and manual dispatch.
11#
12# Uses the org/repo secrets LOKALISE_RW_API_TOKEN (read-write token for upload) and
13# LOKALISE_SERVER_PROJECT_ID (the Lokalise server project id).
14
15on:
16 push:
17 branches: [dev]
18 paths:
19 - music_assistant/translations/en.json
20 schedule:
21 - cron: "0 1 * * 2" # weekly safety net, before the Tuesday download run
22 workflow_dispatch:
23
24# Only checks out the repo and pushes to Lokalise (via the Lokalise token), so read-only.
25permissions:
26 contents: read
27
28jobs:
29 upload:
30 runs-on: ubuntu-latest
31 steps:
32 - uses: actions/checkout@v7
33 - name: Install Lokalise CLI
34 # pin the installer and CLI to a tagged release (don't run a script off a moving branch)
35 run: curl -sfL https://raw.githubusercontent.com/lokalise/lokalise-cli-2-go/v3.1.4/install.sh | sh -s -- -b ./bin v3.1.4
36 - name: Upload source strings
37 env:
38 VAR_LOKALISE_API_TOKEN: ${{ secrets.LOKALISE_RW_API_TOKEN }}
39 VAR_LOKALISE_PROJECT_ID: ${{ secrets.LOKALISE_SERVER_PROJECT_ID }}
40 run: |
41 ./bin/lokalise2 \
42 --token "${VAR_LOKALISE_API_TOKEN}" \
43 --project-id "${VAR_LOKALISE_PROJECT_ID}" \
44 file upload \
45 --file music_assistant/translations/en.json \
46 --lang-iso en \
47 --replace-modified \
48 --distinguish-by-file=false \
49 --convert-placeholders=false \
50 --poll \
51 --poll-timeout 120s
52 # NOTE: add --cleanup-mode to prune keys removed from the source (destructive:
53 # also deletes their translations). Left off by default as a safety measure.
54