mirror of
https://github.com/hassio-addons/repository-edge.git
synced 2025-05-04 19:21:26 +00:00
Remove translations workflows (#43)
This commit is contained in:
parent
6f38a49dab
commit
6e283bdf7c
2 changed files with 0 additions and 128 deletions
75
.github/workflows/translations-download.yaml
vendored
75
.github/workflows/translations-download.yaml
vendored
|
@ -1,75 +0,0 @@
|
||||||
---
|
|
||||||
name: Translations Download
|
|
||||||
|
|
||||||
# yamllint disable-line rule:truthy
|
|
||||||
on:
|
|
||||||
schedule:
|
|
||||||
- cron: "0 8 * * *"
|
|
||||||
workflow_dispatch:
|
|
||||||
workflow_run:
|
|
||||||
workflows: ["Translations Upload"]
|
|
||||||
branches: [master]
|
|
||||||
types:
|
|
||||||
- completed
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
json:
|
|
||||||
name: Download Translations
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: ⤵️ Check out code from GitHub
|
|
||||||
uses: actions/checkout@v2.3.5
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
- 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: ⤵️ Download translations
|
|
||||||
run: |
|
|
||||||
echo "Downloading translations to lokalise"
|
|
||||||
lokalise2 file download \
|
|
||||||
--token "${LOKALISE_TOKEN}" \
|
|
||||||
--project-id "${LOKALISE_PROJECT}" \
|
|
||||||
--format yaml \
|
|
||||||
--original-filenames=false \
|
|
||||||
--export-empty-as base \
|
|
||||||
--bundle-structure ".translations/%LANG_ISO%.yaml"
|
|
||||||
env:
|
|
||||||
LOKALISE_TOKEN: ${{ secrets.LOKALISE_TOKEN }}
|
|
||||||
LOKALISE_PROJECT: ${{ secrets.LOKALISE_PROJECT }}
|
|
||||||
- name: 🚀 Process translations
|
|
||||||
run: |
|
|
||||||
addons=$(yq e '.addons | keys | .[]' .addons.yml)
|
|
||||||
mkdir -p .translations
|
|
||||||
for file in .translations/*.yaml;
|
|
||||||
do
|
|
||||||
filename=$(basename "${file}")
|
|
||||||
language="${filename%.*}"
|
|
||||||
if [[ "${language}" == "en" ]]; then
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
echo "Processing downloaded translations in ${language}..."
|
|
||||||
while read addon;
|
|
||||||
do
|
|
||||||
if [[ -f "${addon}/translations/en.yaml" ]];
|
|
||||||
then
|
|
||||||
echo "Processing downloaded translations in ${language} for ${addon}..."
|
|
||||||
yq e ".${addon}" "${file}" \
|
|
||||||
> "${addon}/translations/${filename}"
|
|
||||||
fi
|
|
||||||
done <<<"${addons}"
|
|
||||||
done
|
|
||||||
- name: 🚀 Commit changes
|
|
||||||
continue-on-error: true
|
|
||||||
run: |
|
|
||||||
git config --local user.email "action@github.com"
|
|
||||||
git config --local user.name "${GITHUB_ACTOR}"
|
|
||||||
git add .
|
|
||||||
git commit -m "🌍 Updating translations" -a
|
|
||||||
- name: 🚀 Push changes
|
|
||||||
uses: ad-m/github-push-action@v0.6.0
|
|
||||||
continue-on-error: true
|
|
||||||
with:
|
|
||||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
branch: ${{ github.ref }}
|
|
53
.github/workflows/translations-upload.yaml
vendored
53
.github/workflows/translations-upload.yaml
vendored
|
@ -1,53 +0,0 @@
|
||||||
---
|
|
||||||
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.5
|
|
||||||
- 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 }}
|
|
Loading…
Add table
Add a link
Reference in a new issue