-
Notifications
You must be signed in to change notification settings - Fork 7
93 lines (86 loc) · 2.92 KB
/
pot-file-update.yaml
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
name: Automate pot file creation
on:
schedule:
- cron: 0 0 * * *
workflow_dispatch:
jobs:
update-pot-file:
strategy:
# only one job at once otherwise one job will push and second job will get conflict on remote
max-parallel: 1
# do not stop on the first failed branch
fail-fast: false
# update this matrix to support new Anaconda branches
matrix:
branch: [ master, f41, rhel-9, rhel-10 ]
include:
- branch: master
anaconda-branch: master
container-tag: master
- branch: f41
anaconda-branch: fedora-41
container-tag: fedora-41
- branch: rhel-9
anaconda-branch: rhel-9
container-tag: rhel-9
- branch: rhel-10
anaconda-branch: rhel-10
container-tag: rhel-10
runs-on: ubuntu-latest
steps:
- name: Checkout anaconda ${{ matrix.anaconda-branch }}
uses: actions/checkout@v4
with:
path: anaconda
repository: rhinstaller/anaconda
ref: ${{ matrix.anaconda-branch }}
- name: Create pot file
run: |
podman run --rm -v ./anaconda:/anaconda:Z --workdir /anaconda quay.io/rhinstaller/anaconda-ci:${{ matrix.container-tag }} sh -c " \
./autogen.sh; \
./configure; \
make; \
make pot-update-check"
- name: Checkout anaconda-l10n
uses: actions/checkout@v4
with:
path: anaconda-l10n
ref: master
- name: Push new potfile
run: |
set -x
cp -v anaconda/po/anaconda.pot anaconda-l10n/${{ matrix.branch }}
cd anaconda-l10n
git config user.name github-actions
git config user.email [email protected]
git add .
# store the diff for better debugging of the workflow
git diff --cached > ../pot-changes.log
# test if the potfile needs update
# If there is any change except line with POT-Creation-Date we should push new version
if git diff -I 'POT-Creation-Date:' --cached --quiet; then
echo "The pot file did not change."
exit 0
fi
git commit -m "update ${{ matrix.branch }} pot-file"
# do a 5 push retries in case weblate just pushed to the repository
# push from weblate could happen easily because webhook updates the translations
RETRIES=5
DELAY=2
COUNT=0
while [ $COUNT -lt $RETRIES ]; do
git pull --rebase
git push
if [ $? -eq 0 ]; then
exit 0
fi
let COUNT=$COUNT+1
sleep $DELAY
done
# retries were not successful
exit 1
- name: Upload diff output
uses: actions/upload-artifact@v4
with:
name: 'diff-output-${{ matrix.branch }}.log'
path: ./pot-changes.log