-
Notifications
You must be signed in to change notification settings - Fork 90
57 lines (51 loc) · 1.79 KB
/
weblate-sync-pot.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
name: Weblate - *.pot synchronization
on:
schedule:
# Run this every morning
- cron: '45 2 * * *'
workflow_dispatch:
jobs:
pot-upload:
name: Upload *.pot files to dnf5-l10n repository
# do not run the cron job on forks
if: (github.event_name == 'schedule' && github.repository_owner == 'rpm-software-management') || (github.event_name != 'schedule')
runs-on: ubuntu-latest
container:
image: ghcr.io/rpm-software-management/dnf-ci-host
options: --user root
timeout-minutes: 10
steps:
- name: Clone source repository
uses: actions/checkout@v4
with:
path: src
fetch-depth: 1
- name: Generate fresh *.pot files
run: |
cd src
cmake -S . -B build
cmake --build build --target gettext-potfiles
- name: Clone weblate repository
uses: actions/checkout@v4
with:
path: l10n
repository: ${{ github.repository }}-l10n
ssh-key: ${{ secrets.L10N_SSH_KEY }}
- name: Commit .pot to weblate repo
run: |
git config --global user.name "GitHub Workflow"
git config --global user.email "[email protected]"
pushd src
for f in $(find * -type f -name "*.pot"); do
potfile=$(basename $f)
component=${potfile%.*}
mkdir -p ../l10n/${component}
cp ${f} ../l10n/${component}/${potfile}
echo ${f%/*} > ../l10n/${component}/PATH
done
popd
git -C l10n add "*"
# If only creation dates were changed do nothing
if git -C l10n diff --staged --ignore-matching-lines='"POT-Creation-Date:' --exit-code; then exit 0; fi
git -C l10n commit -m "Update source files"
git -C l10n push