Repository navigation
88 lines (78 loc) · 2.95 KB
/
Copy pathmerge.yml
File metadata and controls
88 lines (78 loc) · 2.95 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
name: Merge
'on':
push:
branches:
- master
jobs:
flatpak:
name: flatpak
runs-on: ubuntu-latest
container:
image: 'ghcr.io/flathub-infra/flatpak-github-actions:gnome-48'
options: '--privileged'
steps:
- uses: actions/checkout@v5
- uses: flatpak/flatpak-github-actions/flatpak-builder@v6
with:
bundle: planify.Devel.flatpak
manifest-path: build-aux/io.github.alainm23.planify.Devel.json
cache-key: 'flatpak-builder-${{ github.sha }}'
gettext:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Install gettext
run: sudo apt-get update && sudo apt-get install -y gettext
- name: Pull latest changes
run: |
git config --local user.name "Planify Bot"
git config --local user.email "actions@github.com"
git fetch origin master
git rebase origin/master || true
- name: Update POTFILES and translations
run: |
# Regenerate POTFILES
cat > po/POTFILES << 'EOF'
# List of source files containing translatable strings.
# Please keep this file sorted alphabetically.
EOF
find core -name "*.vala" | sort >> po/POTFILES
echo >> po/POTFILES
find src -name "*.vala" | sort >> po/POTFILES
echo >> po/POTFILES
find quick-add -name "*.vala" | sort >> po/POTFILES
echo >> po/POTFILES
echo "data/resources/ui/shortcuts.ui" >> po/POTFILES
# Update translations preserving metadata
python3 scripts/update_translations.py
- name: Check for real changes
id: check_changes
run: |
# Exclude metadata-only changes
if git diff --ignore-matching-lines='^"POT-Creation-Date:' \
--ignore-matching-lines='^"PO-Revision-Date:' \
--ignore-matching-lines='^"Report-Msgid-Bugs-To:' \
--quiet po/; then
echo "has_changes=false" >> $GITHUB_OUTPUT
else
echo "has_changes=true" >> $GITHUB_OUTPUT
fi
- name: Resolve conflicts if any
run: |
if [ -f po/io.github.alainm23.planify.pot ]; then
git add po/io.github.alainm23.planify.pot
fi
git rebase --continue || true
- name: Commit and push changes
if: steps.check_changes.outputs.has_changes == 'true'
run: |
git add po/
git diff --staged --quiet || git commit -m "Update translations"
git push origin master
- name: Notify Weblate of changes
if: steps.check_changes.outputs.has_changes == 'true'
run: |
curl -X POST "https://hosted.weblate.org/api/components/planner/io-github-alainm23-planify/repository/" \
-H "Authorization: Token ${{ secrets.WEBLATE_TOKEN }}" \
-H "Content-Type: application/json" \
-d '{"operation": "pull"}'