1
0
mirror of https://github.com/libretro/RetroArch synced 2024-07-05 09:48:42 +00:00

Read Crowdin API key from GitHub Secrets

This commit is contained in:
Guo Yunhe 2020-08-21 21:16:52 +03:00
parent 6a3273d306
commit 5ac64932d0
3 changed files with 33 additions and 3 deletions

View File

@ -23,6 +23,9 @@ jobs:
- name: Checkout
uses: actions/checkout@v2
- name: Crowdin Sync
shell: bash
env:
CROWDIN_API_KEY: ${{ secrets.CROWDIN_API_KEY }}
run: |
cd intl
python3 crowdin_sync.py
python3 crowdin_sync.py "$CROWDIN_API_KEY"

View File

@ -1,5 +1,5 @@
"project_identifier": "retroarch"
"api_key": "07c53d49b32e30803060b1acec1623ab"
"api_key": "_secret_"
"preserve_hierarchy": true
"files":
@ -15,5 +15,5 @@
{
"source": "/googleplay_us.json",
"translation": "/googleplay_%two_letters_code%.json",
},
},
]

View File

@ -3,10 +3,28 @@
import os
import shutil
import subprocess
import sys
import time
import urllib.request
import zipfile
# Check Crowdin API Key
if len(sys.argv) < 1:
print('Please Provides Crowdin API Key!')
exit()
api_key = sys.argv[1]
# Apply Crowdin API Key
crowdin_config_file = open('crowdin.yaml', 'r')
crowdin_config = crowdin_config_file.read()
crowdin_config_file.close()
crowdin_config = crowdin_config.replace('_secret_', api_key)
crowdin_config_file = open('crowdin.yaml', 'w')
crowdin_config_file.write(crowdin_config)
crowdin_config_file.close()
# Download Crowdin CLI
dir_path = os.path.dirname(os.path.realpath(__file__))
jar_name = 'crowdin-cli.jar'
@ -48,3 +66,12 @@ for file in os.listdir(dir_path):
print('fetch translation progress')
subprocess.run(['python3', 'fetch_progress.py'])
# Reset Crowdin API Key
crowdin_config_file = open('crowdin.yaml', 'r')
crowdin_config = crowdin_config_file.read()
crowdin_config_file.close()
crowdin_config = crowdin_config.replace(api_key, '_secret_')
crowdin_config_file = open('crowdin.yaml', 'w')
crowdin_config_file.write(crowdin_config)
crowdin_config_file.close()