mirror of
https://github.com/Mesteriis/hassio-addons-avm.git
synced 2026-06-11 16:01:20 +02:00
init
This commit is contained in:
53
.github/workflows/translations-upload.yaml
vendored
Normal file
53
.github/workflows/translations-upload.yaml
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
---
|
||||
name: Translations Upload
|
||||
|
||||
# yamllint disable-line rule:truthy
|
||||
on:
|
||||
workflow_dispatch:
|
||||
workflow_run:
|
||||
workflows: ["Repository Updater"]
|
||||
branches: [master]
|
||||
types:
|
||||
- completed
|
||||
|
||||
jobs:
|
||||
upload:
|
||||
name: Upload Translations
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: ⤵️ Check out code from GitHub
|
||||
uses: actions/checkout@v2.3.4
|
||||
- name: 🏗 Set up yq
|
||||
uses: frenck/action-setup-yq@v1.0.0
|
||||
- name: 🏗 Set up the Lokalise CLI
|
||||
uses: frenck/action-setup-lokalise@v1.0.0
|
||||
- name: 🚀 Combine translations
|
||||
run: |
|
||||
addons=$(yq e '.addons | keys | .[]' .addons.yml)
|
||||
mkdir -p .translations
|
||||
while read addon;
|
||||
do
|
||||
if [[ -f "${addon}/translations/en.yaml" ]];
|
||||
then
|
||||
echo "Prepping translation upload for $addon..."
|
||||
ADDON="${addon}" \
|
||||
yq e '{env(ADDON): .}' "${addon}/translations/en.yaml" \
|
||||
> ".translations/${addon}.yaml"
|
||||
fi
|
||||
done <<<"${addons}"
|
||||
|
||||
echo "Combining translation files..."
|
||||
yq ea '. as $item ireduce ({}; . * $item)' ./.translations/*.yaml > translations.yaml
|
||||
- name: 🚀 Upload translations
|
||||
run: |
|
||||
echo "Uploading translations to lokalise"
|
||||
lokalise2 file upload \
|
||||
--apply-tm \
|
||||
--lang-iso en \
|
||||
--poll \
|
||||
--token "${LOKALISE_TOKEN}" \
|
||||
--project-id "${LOKALISE_PROJECT}" \
|
||||
--file translations.yaml
|
||||
env:
|
||||
LOKALISE_TOKEN: ${{ secrets.LOKALISE_TOKEN }}
|
||||
LOKALISE_PROJECT: ${{ secrets.LOKALISE_PROJECT }}
|
||||
Reference in New Issue
Block a user