-
Notifications
You must be signed in to change notification settings - Fork 34
111 lines (98 loc) · 4.9 KB
/
remote-get-japanese-v5.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# This workflow fetches the Japanese V5 Version of the Joomla CMS and syncs the needed translation language files
# into the core-translations repository. After this it creates a new commit.
# The second part uploads the translation to the CMS Crowdin project.
name: J5 Get Japanese Translation files
on:
workflow_dispatch:
# Runs once a day at 9:16
schedule:
- cron: '16 9 * * *'
jobs:
collect-from-external:
if: (github.event_name == 'schedule' && github.repository == 'joomla/core-translations') || (github.event_name != 'schedule')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Fetch and extract Japanese j5 cms
run: |
cd ..
ls -l
wget -nv "https://github.com/joomlajp/Joomla-in-Japanese/archive/refs/heads/5.x.zip"
unzip 5.x.zip
- name: Syncing j5 directories
# We use a simple copy paste syntax here if needed customization for different directories
run: |
cd ..
SYNC_VERION="v5"
LANGUAGE_CODE="ja-JP"
ZIP_PATH="administrator/language/${LANGUAGE_CODE}/"
REPO_PATH="${LANGUAGE_CODE}/administrator/language/${LANGUAGE_CODE}/"
echo /${ZIP_PATH}
echo /${REPO_PATH}
mkdir -p core-translations/joomla_${SYNC_VERION}/translations/package/${REPO_PATH}
rsync -i -rptgo --checksum --ignore-times --delete Joomla-in-Japanese-5.x/${ZIP_PATH} core-translations/joomla_${SYNC_VERION}/translations/package/${REPO_PATH}
ZIP_PATH="pkg_${LANGUAGE_CODE}.xml"
REPO_PATH="${LANGUAGE_CODE}/"
echo /${ZIP_PATH}
echo /${REPO_PATH}
mkdir -p core-translations/joomla_${SYNC_VERION}/translations/package/${REPO_PATH}
rsync -i -rptgo --checksum --ignore-times --delete Joomla-in-Japanese-5.x/${ZIP_PATH} core-translations/joomla_${SYNC_VERION}/translations/package/${REPO_PATH}
ZIP_PATH="api/language/${LANGUAGE_CODE}/"
REPO_PATH="${LANGUAGE_CODE}/api/language/${LANGUAGE_CODE}/"
echo /${ZIP_PATH}
echo /${REPO_PATH}
mkdir -p core-translations/joomla_${SYNC_VERION}/translations/package/${REPO_PATH}
rsync -i -rptgo --checksum --ignore-times --delete Joomla-in-Japanese-5.x/${ZIP_PATH} core-translations/joomla_${SYNC_VERION}/translations/package/${REPO_PATH}
ZIP_PATH="language/${LANGUAGE_CODE}/"
REPO_PATH="${LANGUAGE_CODE}/language/${LANGUAGE_CODE}/"
echo /${ZIP_PATH}
echo /${REPO_PATH}
mkdir -p core-translations/joomla_${SYNC_VERION}/translations/package/${REPO_PATH}
rsync -i -rptgo --checksum --ignore-times --delete Joomla-in-Japanese-5.x/${ZIP_PATH} core-translations/joomla_${SYNC_VERION}/translations/package/${REPO_PATH}
- name: Validate PHP code
run: |
SYNC_VERION="v5"
LANGUAGE_CODE="ja-JP"
find ./joomla_${SYNC_VERION}/translations/package/${LANGUAGE_CODE}/ -name "*.php" -exec php -l {} \; | fgrep -i "No syntax errors detected" || exit 1
- name: Push translations to repo
run: |
git config user.name Translation Bot
git config user.email [email protected]
git status
git add .
git diff --quiet && git diff --staged --quiet || git commit -am "J5 Japanese Language update on `date +'%Y-%m-%d'`"
git push
# This workflow contains a single job called "build"
synchronize-with-crowdin:
needs: collect-from-external
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout
uses: actions/checkout@v4
# Runs the Crowdin action command - https://github.com/crowdin/github-action
- name: Crowdin Upload Japanese
uses: crowdin/[email protected]
with:
# Upload sources to Crowdin
upload_sources: false
# Upload translations to Crowdin
upload_translations: true
# Define the languages to upload for translations
upload_language: 'ja'
# Automatically approves uploaded translations
auto_approve_imported: true
# Defines whether to add translation if it is equal to source string in Crowdin project
import_eq_suggestions: true
# Option to specify a path to the configuration file, without / at the beginning
config: 'Configurations/Crowdin-J5-All.yml'
# Upload sources to Crowdin branch
crowdin_branch_name: JoomlaV5
# Use true for dryrun to test the run without actually processing anything
dryrun_action: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}