Update rpminspect.pot template #269
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Update rpminspect.pot template | |
| on: | |
| schedule: | |
| - cron: 0 0 * * * | |
| jobs: | |
| update-pot-file: | |
| # Use containers on their ubuntu latest image | |
| runs-on: ubuntu-latest | |
| # Set up the matrix of distributions to test | |
| strategy: | |
| # only one job at once otherwise one job will push and | |
| # second job will get conflict on remote | |
| max-parallel: 1 | |
| matrix: | |
| container: ["ubuntu:latest"] | |
| container: | |
| image: ${{ matrix.container }} | |
| steps: | |
| - name: Checkout rpminspect | |
| uses: actions/checkout@v4 | |
| with: | |
| path: rpminspect | |
| repository: rpminspect/rpminspect | |
| ref: main | |
| - name: Install build requirements for rpminspect | |
| run: | | |
| apt-get update | |
| apt-get upgrade -y | |
| apt-get install -y git make | |
| make -C rpminspect instreqs | |
| - name: Create pot file | |
| run: | | |
| make -C rpminspect update-pot | |
| - name: Checkout rpminspect-l10n | |
| uses: actions/checkout@v4 | |
| with: | |
| path: rpminspect-l10n | |
| ref: main | |
| - name: Push new rpminspect.pot | |
| run: | | |
| cp -v rpminspect/po/rpminspect.pot rpminspect-l10n | |
| cd rpminspect-l10n | |
| git config user.name github-actions | |
| git config user.email [email protected] | |
| git add . | |
| # test if the rpminspect.pot file needs updating | |
| if ! git diff -I 'POT-Creation-Date:' --cached --quiet ; then | |
| echo "The rpminspect.pot file did not change." | |
| exit 0 | |
| else | |
| git diff --cached | |
| fi | |
| git commit -m "Update ${{ matrix.branch }} rpminspect.pot file" | |
| # try to push, retry 5 times | |
| # push from weblate could happen easily because webhook updates the translation | |
| RETRIES=5 | |
| DELAY=2 | |
| COUNT=0 | |
| while [ $COUNT -lt $RETRIES ]; do | |
| git pull --rebase | |
| git push | |
| if [ $? -eq 0 ]; then | |
| exit 0 | |
| fi | |
| COUNT=$(($COUNT + 1)) | |
| sleep $DELAY | |
| done | |
| # retries failed | |
| exit 1 |