Skip to content

Update translations #189

Update translations

Update translations #189

name: Update translations
on:
workflow_dispatch:
push:
paths:
- "l10n/*.arb"
branches:
- '**'
tags-ignore:
- '**'
pull_request:
paths:
- "l10n/*.arb"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
translate:
runs-on: ubuntu-latest
steps:
- name: Clone repositories
run: |
git -C $HOME clone --single-branch --no-tags --depth=1 https://${{ secrets.LIBRESCORE_USERNAME }}:${{ secrets.LIBRESCORE_TOKEN }}@github.com/LibreScore/app-librescore
git -C $HOME clone --single-branch --no-tags --depth=1 https://${{ secrets.LIBRESCORE_USERNAME }}:${{ secrets.LIBRESCORE_TOKEN }}@github.com/LibreScore/${{ secrets.LIBRESCORE_REPO_A }}
git -C $HOME clone --single-branch --no-tags --depth=1 https://${{ secrets.LIBRESCORE_USERNAME }}:${{ secrets.LIBRESCORE_TOKEN }}@github.com/LibreScore/${{ secrets.LIBRESCORE_REPO_B }}
- name: Update translations
run: |
sudo apt update -y
sudo apt install moreutils apt-transport-https -y
wget -qO- https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo gpg --dearmor -o /usr/share/keyrings/dart.gpg
echo 'deb [signed-by=/usr/share/keyrings/dart.gpg arch=amd64] https://storage.googleapis.com/download.dartlang.org/linux/debian stable main' | sudo tee /etc/apt/sources.list.d/dart_stable.list
sudo apt update -y
sudo apt install dart -y
cd $HOME/${{ secrets.LIBRESCORE_REPO_A }}
bash ./lang.sh
sed -ri 's/version: '"([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\+([[:digit:]]+)"'/echo version: \1.\2.$((\3+1))+$((\4+1))/e' pubspec.yaml
sed -ri 's/msix_version: '"([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)"'/echo \\ \\ \\ \\ msix_version: \1.\2.$((\3+1)).$((\4+1))/e' pubspec.yaml
sed -ri 's/#define VERSION_AS_NUMBER '"([[:digit:]]+),([[:digit:]]+),([[:digit:]]+)"'/echo \\#define VERSION_AS_NUMBER \1,\2,$((\3+1))/e' windows/runner/Runner.rc
sed -ri 's/#define VERSION_AS_STRING "'"([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)"'"/echo \\#define VERSION_AS_STRING \\"\1.\2.$((\3+1))\\"/e' windows/runner/Runner.rc
sed -ri 's/#define MyAppVersion "'"([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)"'"/echo \\#define MyAppVersion \\"\1.\2.$((\3+1))\\"/e' installer/Inno/LibreScore.iss
filere='version: '"([[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+)\+[[:digit:]]+"
while IFS="" read -r line || [ -n "$line" ]; do
if [[ $line =~ $filere ]]; then
version=v${BASH_REMATCH[1]}
break
fi
done < pubspec.yaml
git config user.name github-actions
git config user.email [email protected]
git add -A
git commit -m "chore: update translations"
git tag $version
git push --atomic origin master $version
cd $HOME/${{ secrets.LIBRESCORE_REPO_B }}
bash ./lang.sh
sed -ri 's/version: '"([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\+([[:digit:]]+)"'/echo version: \1.\2.$((\3+1))+$((\4+1))/e' pubspec.yaml
git config user.name github-actions
git config user.email [email protected]
git add -A
git commit -m "chore: update translations"
git tag $version
git push --atomic origin master $version
cd $HOME/app-librescore
git tag $version
git push origin $version
git tag --delete $version
git push origin :refs/tags/$version