11name : Merge
2-
3- on :
2+ ' on ' :
43 push :
54 branches :
65 - master
7-
86jobs :
97 flatpak :
10- name : " Flatpak "
8+ name : flatpak
119 runs-on : ubuntu-latest
1210 container :
13- image : ghcr.io/flathub-infra/flatpak-github-actions:gnome-48
14- options : --privileged
11+ image : ' ghcr.io/flathub-infra/flatpak-github-actions:gnome-48'
12+ options : ' --privileged'
1513 steps :
1614 - uses : actions/checkout@v5
1715 - uses : flatpak/flatpak-github-actions/flatpak-builder@v6
1816 with :
1917 bundle : planify.Devel.flatpak
2018 manifest-path : build-aux/io.github.alainm23.planify.Devel.json
21- cache-key : flatpak-builder-${{ github.sha }}
22-
23- # gettext:
24- # name: Gettext
25- # runs-on: ubuntu-latest
26- # container:
27- # image: ghcr.io/elementary/flatpak-platform/runtime:8.2-x86_64
28- # options: --privileged
29-
30- # steps:
31- # - name: Install git, python3-git and jq
32- # run: |
33- # apt-get update
34- # apt-get install git jq python3-git -y libportal-dev libportal-gtk4-dev
35-
36- # - name: Clone repository
37- # uses: actions/checkout@v5
38- # with:
39- # token: ${{ secrets.GIT_USER_TOKEN }}
40-
41- # - name: Install Rust SDK extension
42- # run: |
43- # flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
44- # flatpak install -y org.freedesktop.Sdk.Extension.rust-stable//24.08
45- # flatpak install -y org.gnome.Sdk/x86_64/48
46- # flatpak install -y org.gnome.Platform/x86_64/48
47-
48- # - name: Configure Git
49- # run: |
50- # git config --global --add safe.directory "$GITHUB_WORKSPACE"
51- # - name: Update Translation Files
52- # uses: elementary/actions/gettext-flatpak@main
53- # with:
54- # manifest-path: "io.github.alainm23.planify.json"
55- # env:
56- # GIT_USER_NAME: "planifyBot"
57- # GIT_USER_EMAIL: "[email protected] " 19+ cache-key : ' flatpak-builder-${{ github.sha }}'
20+
21+ gettext :
22+ runs-on : ubuntu-latest
23+ steps :
24+ - uses : actions/checkout@v5
25+
26+ - name : Install gettext
27+ run : sudo apt-get update && sudo apt-get install -y gettext
28+
29+ - name : Pull latest changes
30+ run : |
31+ git config --local user.name "Planify Bot"
32+ git config --local user.email "[email protected] " 33+ git fetch origin master
34+ git rebase origin/master || true
35+
36+ - name : Update POTFILES and translations
37+ run : |
38+ # Regenerate POTFILES
39+ cat > po/POTFILES << 'EOF'
40+ # List of source files containing translatable strings.
41+ # Please keep this file sorted alphabetically.
42+ EOF
43+
44+ find core -name "*.vala" | sort >> po/POTFILES
45+ echo >> po/POTFILES
46+ find src -name "*.vala" | sort >> po/POTFILES
47+ echo >> po/POTFILES
48+ find quick-add -name "*.vala" | sort >> po/POTFILES
49+ echo >> po/POTFILES
50+ echo "data/resources/ui/shortcuts.ui" >> po/POTFILES
51+
52+ # Update translations preserving metadata
53+ python3 scripts/update_translations.py
54+
55+ - name : Check for real changes
56+ id : check_changes
57+ run : |
58+ # Exclude metadata-only changes
59+ if git diff --ignore-matching-lines='^"POT-Creation-Date:' \
60+ --ignore-matching-lines='^"PO-Revision-Date:' \
61+ --ignore-matching-lines='^"Report-Msgid-Bugs-To:' \
62+ --quiet po/; then
63+ echo "has_changes=false" >> $GITHUB_OUTPUT
64+ else
65+ echo "has_changes=true" >> $GITHUB_OUTPUT
66+ fi
67+
68+ - name : Resolve conflicts if any
69+ run : |
70+ if [ -f po/io.github.alainm23.planify.pot ]; then
71+ git add po/io.github.alainm23.planify.pot
72+ fi
73+ git rebase --continue || true
74+
75+ - name : Commit and push changes
76+ if : steps.check_changes.outputs.has_changes == 'true'
77+ run : |
78+ git add po/
79+ git diff --staged --quiet || git commit -m "Update translations"
80+ git push origin master
81+
82+ - name : Notify Weblate of changes
83+ if : steps.check_changes.outputs.has_changes == 'true'
84+ run : |
85+ curl -X POST "https://hosted.weblate.org/api/components/planner/io-github-alainm23-planify/repository/" \
86+ -H "Authorization: Token ${{ secrets.WEBLATE_TOKEN }}" \
87+ -H "Content-Type: application/json" \
88+ -d '{"operation": "pull"}'
0 commit comments