Skip to content

Download Translations #323

Download Translations

Download Translations #323

name: Translation
run-name: Download Translations
on:
schedule:
- cron: 10 17 * * *
workflow_dispatch:
jobs:
crowdin:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@main
- name: Crowdin pull
uses: crowdin/github-action@master
with:
upload_sources: false
download_translations: true
create_pull_request: false
push_translations: false
push_sources: false
skip_untranslated_strings: true
env:
GITHUB_TOKEN: ${{ secrets.TOKEN }}
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
- name: Handle files
id: handle
run: |
sudo chmod -R ugo+rwX .
sed -i ":a;N;s/^ '\([a-z][a-z]-[A-Z][A-Z]\|lzh\)',\?\n//g;ta" scripts/init.js
for TF in $(ls -r locales); do
if [[ $TF == *.json ]]; then
if [[ $(sed -n '$=' locales/$TF) -ge 12 ]]; then
TL=$(basename $TF .json)
sed -i -e '2i\ "language": "'$TL'",\n "data": {' -e 's/^}/ }/g' -e '$a}' locales/$TF
sed -i "s/\/\/ Crowdin/\/\/ Crowdin\n '$TL',/g" scripts/init.js
else
rm locales/$TF
fi
fi
done
MESSAGE='modify: translations
[Auto] Update Translation Files'"
(Time: `date +'%F %X %Z'`)"
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64) # To define the separator
echo "message<<EOF"$'\n'"$MESSAGE"$'\n'EOF >> $GITHUB_OUTPUT # For the multi-line output
- name: Commit & Push
uses: EndBug/add-and-commit@main
with:
default_author: github_actions
message: ${{ steps.handle.outputs.message }}
deploy:
name: Deploy
runs-on: ubuntu-latest
needs: crowdin
steps:
- name: Run remote commands
id: run
uses: fifsky/ssh-action@master
with:
host: ${{ secrets.HOST }}
port: ${{ secrets.PORT }}
key: ${{ secrets.KEY }}
command: |
echo ===============================================================
cd /www/wwwroot/mcisee.top
git pull
echo ===============================================================