Skip to content

Commit cdf0596

Browse files
committed
ci: add sync_translations job for CircleCI
1 parent d605cdc commit cdf0596

File tree

1 file changed

+38
-1
lines changed

1 file changed

+38
-1
lines changed

.circleci/config.yml

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,31 @@ jobs:
8585
- test
8686
- deploy_gh_pages
8787
- deploy_npm
88+
sync_translations:
89+
<<: *defaults
90+
steps:
91+
- run:
92+
name: Sync Translations
93+
command: |
94+
echo "Starting translation sync"
95+
set -ev
96+
git checkout develop
97+
# update translations, and test any updated messages
98+
npm run translate
99+
npm run translate:update
100+
npm run test:messages
101+
# stage any changes in the msg directory
102+
git add ./msg
103+
if git diff --cached --exit-code --quiet; then
104+
echo "Nothing to commit."
105+
else
106+
git commit -m 'Update translations from Transifex [skip ci]'
107+
# add remote, make sure that API token doesn't end up in the log
108+
git remote add origin-translation \
109+
https://${GH_TOKEN}@github.com/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}.git \
110+
> /dev/null 2>&1
111+
git push --set-upstream origin-translation develop
112+
fi
88113
workflows:
89114
version: 2
90115
default:
@@ -93,4 +118,16 @@ workflows:
93118
context:
94119
- dockerhub-credentials
95120
- scratch-npm-creds
96-
# TODO: another job to replace i18n/sync_translations.sh
121+
sync_translations:
122+
triggers:
123+
- schedule:
124+
cron: 0 0 * * 1 # weekly on Monday
125+
filters:
126+
branches:
127+
only:
128+
- develop
129+
jobs:
130+
- sync_translations:
131+
context:
132+
- dockerhub-credentials
133+
- scratch-npm-creds

0 commit comments

Comments
 (0)