forked from opencast/opencast
-
Notifications
You must be signed in to change notification settings - Fork 0
62 lines (54 loc) · 1.75 KB
/
update-translations.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
name: Update translations
# Update every Monday at 5am
on:
schedule:
- cron: "0 5 * * 1"
jobs:
update-translations:
if: github.repository_owner == 'opencast'
runs-on: ubuntu-20.04
env:
CROWDIN_API_KEY: ${{ secrets.CROWDIN_API_KEY }}
steps:
- uses: actions/checkout@v2
- name: prepare git
run: |
git config --global user.email '[email protected]'
git config --global user.name 'Crowdin Bot'
- name: prepare crowdin client
run: |
wget --quiet https://artifacts.crowdin.com/repo/deb/crowdin.deb
sudo dpkg -i crowdin.deb
echo "api_key: ${CROWDIN_API_KEY}" > ~/.crowdin.yaml
- name: prepare github ssh key
env:
DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }}
run: |
install -dm 700 ~/.ssh/
echo "${DEPLOY_KEY}" > ~/.ssh/id_ed25519
chmod 600 ~/.ssh/id_ed25519
ssh-keyscan github.com >> ~/.ssh/known_hosts
- name: clone repository
run: |
git clone "[email protected]:opencast/opencast.git" ~/oc
- name: upload translation source
run: |
set -o errexit
update() {
git checkout "$1"
crowdin --config .crowdin.yaml download -b "$2"
git clean -f
if git commit -a -m "Automatically update translation keys ($1)"; then
git push origin "$1"
fi
git clean -fdx
}
if [ -z "${CROWDIN_API_KEY}" ]; then
echo Skipping update without secret
else
cd ~/oc
update develop develop
for branch in $(git for-each-ref --count=3 --sort=-committerdate refs/remotes/origin/r/ --format='%(refname:short)'); do
update "${branch##origin/}" "${branch##*/}"
done
fi