-
Notifications
You must be signed in to change notification settings - Fork 0
65 lines (65 loc) · 2.18 KB
/
Copy pathupdate.yml
File metadata and controls
65 lines (65 loc) · 2.18 KB
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
name: "Update translations"
on:
workflow_dispatch:
schedule:
- cron: '38 2 * * *'
permissions:
contents: read
jobs:
update:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- run: git clone --depth=1 --branch snapshot https://github.com/folio-org/platform-complete build
- run: cp build/yarn.lock .
- uses: actions/setup-node@v6
with:
node-version: '22'
cache: 'yarn'
- name: Build translations
run: |
cd build
yarn config set @folio:registry https://repository.folio.org/repository/npm-folio/
CXXFLAGS="-std=c++17" yarn install
NODE_ENV=production yarn build output
- name: Merge translations
run: |
cd platform-complete
for oldfile in *.json ; do
newfile=$(echo $oldfile | sed -E 's#(.+).json#\1-*.json#')
newfile=$(echo ../build/output/translations/$newfile)
if [ ! -e "$newfile" ] ; then
echo "Skipping, not found: $newfile"
continue
fi
jq -s --sort-keys '.[0] * .[1]' $oldfile $newfile > /tmp/new.json
FILESIZE=$(stat -c%s /tmp/new.json)
if [ "$FILESIZE" -lt "1000000" ] ; then
echo "Skipping $LANG, file size must be >= 1000000 but it is $FILESIZE"
continue
fi
mv /tmp/new.json $oldfile
done
cd ..
mkdir upload
mv platform-complete upload
- uses: actions/upload-artifact@v6
with:
name: platform-complete
path: upload/
retention-days: 1
commit:
needs: [update]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v6
- run: rm -r platform-complete/
- uses: actions/download-artifact@v7
- name: Commit updates
run: |
git config --local user.name 'folio-translations repository bot'
git config --local user.email 'folio-translations@users.noreply.github.com'
git add platform-complete/
(git commit -m "Update translations" && git push) || true # ignore failure caused by unchanged files