virt-manager/.github/workflows/ci.yml
Pino Toscano 971dbaead0 ci: extract messages periodically
Switch the updates of the translation catalog from after every push to
every 2 days at 6am UTC.

Considering that the update-translation-pot will commit the catalog only
if changed, and that there are usually not that many changes upstream,
it is simpler to update the translation catalog only every couple of
days.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Pino Toscano <ptoscano@redhat.com>
2020-07-14 11:58:41 -04:00

58 lines
1.7 KiB
YAML

name: CI
on:
schedule:
# every two days at 6:00 UTC
- cron: '0 6 */2 * *'
jobs:
# This job will run ./setup.py extract_messages on top of git master
# and force push that to the 'translations' branch. That branch will
# always have an up to date .pot file for use in weblate
update-translation-pot:
# Only run this if on the main 'virt-manager/virt-manager' repo, not forks
if: "contains(github.repository, 'virt-manager/virt-manager')"
runs-on: ubuntu-latest
container:
image: fedora:latest
steps:
- name: Install deps
run: |
dnf install -y python3-setuptools gettext git diffutils
- uses: actions/checkout@v2
with:
# This fetches full git history. We need that for proper
# branch updating
fetch-depth: 0
- name: Extract messages and push to translations branch
run: |
git config --global user.email "actions@github.com"
git config --global user.name "Github Actions"
git fetch --all
git rebase remotes/origin/translations
cp po/virt-manager.pot old.pot
./setup.py extract_messages
ec=0
diff -q -I 'POT-Creation-Date' old.pot po/virt-manager.pot || ec=$?
case "${ec}" in
0) ;;
1)
git commit po/virt-manager.pot \
--message "Refresh translation .pot template"
remote_repo="https://${GITHUB_ACTOR}:${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git"
git push "${remote_repo}" HEAD:translations
;;
*)
echo "diff failed with exit status ${ec}" >&2
exit 1
;;
esac