Automate pot file creation #1521
Workflow file for this run
This file contains 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: 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 |