Merge pull request #1103 from carmenbianca/release-5.0.2 #136
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
# SPDX-FileCopyrightText: 2023 Carmen Bianca BAKKER <[email protected]> | |
# SPDX-FileCopyrightText: 2024 Free Software Foundation Europe e.V. <https://fsfe.org> | |
# | |
# SPDX-License-Identifier: GPL-3.0-or-later | |
name: Update .pot file | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- "src/reuse/**.py" | |
jobs: | |
create-pot: | |
runs-on: ubuntu-24.04 | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 1 | |
# The main branch is protected. fsfe-system has been granted an | |
# exception to the branch protection, so we'll use that account's | |
# token to push to the main branch. | |
token: ${{ secrets.FSFE_SYSTEM_TOKEN }} | |
- name: Install poetry, gettext, and wlc | |
run: sudo apt-get install -y python3-poetry gettext wlc | |
# We mostly install reuse to install the click dependency. | |
- name: Install reuse | |
run: poetry install --no-interaction --only main | |
- name: Lock Weblate | |
run: | | |
wlc --url https://hosted.weblate.org/api/ --key ${{secrets.WEBLATE_KEY }} lock fsfe/reuse-tool | |
- name: Push changes from Weblate to upstream repository | |
run: | | |
wlc --url https://hosted.weblate.org/api/ --key ${{secrets.WEBLATE_KEY }} push fsfe/reuse-tool | |
- name: Pull Weblate translations | |
run: git pull origin main | |
- name: Create .pot file | |
run: poetry run make create-pot | |
# Normally, POT-Creation-Date changes in two locations. Check if the diff | |
# includes more than just those two lines. | |
- name: Check if sufficient lines were changed | |
id: diff | |
run: | |
echo "changed=$(git diff -U0 po/reuse.pot | grep '^[+|-][^+|-]' | grep | |
-Ev '^[+-]("POT-Creation-Date|#:)' | wc -l)" >> $GITHUB_OUTPUT | |
- name: Commit and push updated reuse.pot | |
if: ${{ steps.diff.outputs.changed != '0' }} | |
run: | | |
git config --global user.name "fsfe-system" | |
git config --global user.email "<>" | |
git add po/reuse.pot po/*.po | |
git commit -m "Update reuse.pot" | |
git push origin main | |
- name: Unlock Weblate | |
run: | | |
wlc --url https://hosted.weblate.org/api/ --key ${{ secrets.WEBLATE_KEY }} pull fsfe/reuse-tool | |
wlc --url https://hosted.weblate.org/api/ --key ${{ secrets.WEBLATE_KEY }} unlock fsfe/reuse-tool |