Many Actions complain that an old Node20 code is used. Update the actions to use newer versions. https://github.blog/changelog/2025-09-19-deprecation-of-node-20-on-github-actions-runners/
276 lines
9.7 KiB
YAML
276 lines
9.7 KiB
YAML
name: Weblate Update POT
|
|
|
|
permissions:
|
|
# this action uploads the updated POT files to the agama-weblate repository
|
|
contents: write
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
# run on every change in master, the action actually checks if there is
|
|
# any change in the translations, if there is no change it does not upload
|
|
# the files to Weblate so it should be OK to run it quite often
|
|
- master
|
|
|
|
paths:
|
|
# run only if any file which can contain translatable strings is modified,
|
|
# changing documentation, unit tests, configuration files, etc... cannot
|
|
# change translations so do not run it in that case
|
|
|
|
# any change in the web Typescript files
|
|
- web/**.ts
|
|
- web/**.tsx
|
|
# except tests
|
|
- "!web/**.test.*"
|
|
|
|
# any change in the Ruby service files
|
|
- service/**.rb
|
|
# except tests
|
|
- "!service/test/**"
|
|
|
|
# any change in the Rust server files, the unit tests are embedded so we
|
|
# cannot skip it when only tests are updated
|
|
- rust/**.rs
|
|
|
|
# any change in the product files
|
|
- products.d/**.yaml
|
|
- products.d/**.yml
|
|
|
|
# allow running manually
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
update-pot:
|
|
# do not run in forks
|
|
if: ${{ !github.event.repository.fork }}
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
container:
|
|
image: registry.opensuse.org/opensuse/tumbleweed:latest
|
|
|
|
steps:
|
|
- name: Configure and refresh repositories
|
|
# disable unused repositories to have a faster refresh
|
|
run: zypper modifyrepo -d repo-non-oss repo-openh264 repo-update && zypper ref
|
|
|
|
- name: Install Default Ruby
|
|
run: zypper --non-interactive install --no-recommends ruby
|
|
|
|
- name: Install tools
|
|
run: |
|
|
RUBY_VERSION=$(ruby -e "puts RbConfig::CONFIG['ruby_version']")
|
|
zypper --non-interactive install --no-recommends diffutils git gettext-tools npm-default "rubygem(ruby:$RUBY_VERSION:yast-rake)" "rubygem(ruby:$RUBY_VERSION:gettext)" yast2-devtools which
|
|
|
|
- name: Checkout Agama sources
|
|
uses: actions/checkout@v6
|
|
with:
|
|
path: agama
|
|
|
|
- name: Checkout Weblate sources
|
|
uses: actions/checkout@v6
|
|
with:
|
|
path: agama-weblate
|
|
repository: ${{ github.repository_owner }}/agama-weblate
|
|
token: ${{ secrets.GH_TOKEN }}
|
|
|
|
- name: Configure Git user and email
|
|
run: |
|
|
git config --global user.name "YaST Bot"
|
|
git config --global user.email "yast-devel@opensuse.org"
|
|
|
|
- name: (web) Generate POT file
|
|
run: |
|
|
cd agama/web
|
|
./build_pot
|
|
msgfmt --statistics agama.pot
|
|
|
|
- name: (web) Validate the generated POT file
|
|
run: msgfmt --check-format agama/web/agama.pot
|
|
|
|
- name: (web) Update POT file
|
|
run: |
|
|
mkdir -p agama-weblate/web
|
|
cp agama/web/agama.pot agama-weblate/web/agama.pot
|
|
|
|
# any change besides the timestamp in the POT file?
|
|
- name: (web) Check POT changes
|
|
id: check_web_changes
|
|
run: |
|
|
git -C agama-weblate diff --ignore-matching-lines="POT-Creation-Date:" web/agama.pot > pot.diff
|
|
|
|
if [ -s pot.diff ]; then
|
|
echo "POT file updated"
|
|
echo "pot_updated=true" >> $GITHUB_OUTPUT
|
|
else
|
|
echo "POT file unchanged"
|
|
echo "pot_updated=false" >> $GITHUB_OUTPUT
|
|
# reset any possible changes so they are not accidentally committed later
|
|
git -C agama-weblate reset --hard
|
|
fi
|
|
|
|
- name: (web) Push updated POT file
|
|
# run only when the POT file has been updated
|
|
if: steps.check_web_changes.outputs.pot_updated == 'true'
|
|
run: |
|
|
cd agama-weblate
|
|
git add web/agama.pot
|
|
git commit -m "Update web POT file"$'\n\n'"Agama commit: $GITHUB_SHA"
|
|
git push
|
|
|
|
- name: (web) Merge new POT to PO translations
|
|
# run only when the POT file has been updated
|
|
if: steps.check_web_changes.outputs.pot_updated == 'true'
|
|
run: |
|
|
cd agama-weblate/web
|
|
find . -name "*.po" -exec msgmerge -U "{}" agama.pot \;
|
|
git commit -a -m "Merge new POT file to web translations"$'\n\n'"Agama commit: $GITHUB_SHA"
|
|
git push
|
|
|
|
- name: Install NPM packages
|
|
run: |
|
|
cd agama/.github/workflows/product_translations
|
|
npm ci
|
|
|
|
- name: (products) Generate POT file
|
|
run: |
|
|
cd agama/products.d
|
|
../.github/workflows/product_translations/products_pot *.yaml > products.pot
|
|
msgfmt --statistics products.pot
|
|
|
|
- name: (products) Validate the generated POT file
|
|
run: msgfmt --check-format agama/products.d/products.pot
|
|
|
|
- name: (products) Update POT file
|
|
run: |
|
|
mkdir -p agama-weblate/products
|
|
cp agama/products.d/products.pot agama-weblate/products/products.pot
|
|
|
|
# any change besides the timestamp in the POT file?
|
|
- name: (products) Check POT changes
|
|
id: check_product_changes
|
|
run: |
|
|
git -C agama-weblate diff --ignore-matching-lines="POT-Creation-Date:" products/products.pot > pot.diff
|
|
|
|
if [ -s pot.diff ]; then
|
|
echo "POT file updated"
|
|
echo "pot_updated=true" >> $GITHUB_OUTPUT
|
|
else
|
|
echo "POT file unchanged"
|
|
echo "pot_updated=false" >> $GITHUB_OUTPUT
|
|
git -C agama-weblate reset --hard
|
|
fi
|
|
|
|
- name: (products) Push updated POT file
|
|
# run only when the POT file has been updated
|
|
if: steps.check_product_changes.outputs.pot_updated == 'true'
|
|
run: |
|
|
cd agama-weblate
|
|
git add products/products.pot
|
|
git commit -m "Update products POT file"$'\n\n'"Agama commit: $GITHUB_SHA"
|
|
git push
|
|
|
|
- name: (products) Merge new POT to PO translations
|
|
# run only when the POT file has been updated
|
|
if: steps.check_product_changes.outputs.pot_updated == 'true'
|
|
run: |
|
|
cd agama-weblate/products
|
|
find . -name "*.po" -exec msgmerge -U '{}' products.pot \;
|
|
git commit -a -m "Merge new POT file to product translations"$'\n\n'"Agama commit: $GITHUB_SHA"
|
|
git push
|
|
|
|
- name: (service) Generate POT file
|
|
run: |
|
|
cd agama
|
|
rake pot
|
|
msgfmt --statistics agama.pot
|
|
|
|
- name: (service) Validate the generated service POT file
|
|
run: msgfmt --check-format agama/agama.pot
|
|
|
|
- name: (service) Update POT file
|
|
run: |
|
|
mkdir -p agama-weblate/service
|
|
cp agama/agama.pot agama-weblate/service/agama.pot
|
|
|
|
# any change besides the timestamp in the POT file?
|
|
- name: (service) Check POT changes
|
|
id: check_service_changes
|
|
run: |
|
|
git -C agama-weblate diff --ignore-matching-lines="POT-Creation-Date:" --ignore-matching-lines="PO-Revision-Date:" service/agama.pot > pot.diff
|
|
|
|
if [ -s pot.diff ]; then
|
|
echo "POT file updated"
|
|
echo "pot_updated=true" >> $GITHUB_OUTPUT
|
|
else
|
|
echo "POT file unchanged"
|
|
echo "pot_updated=false" >> $GITHUB_OUTPUT
|
|
# reset any possible changes so they are not accidentally committed later
|
|
git -C agama-weblate reset --hard
|
|
fi
|
|
|
|
- name: (service) Push updated POT file
|
|
# run only when the POT file has been updated
|
|
if: steps.check_service_changes.outputs.pot_updated == 'true'
|
|
run: |
|
|
cd agama-weblate
|
|
git add service/agama.pot
|
|
git commit -m "Update service POT file"$'\n\n'"Agama commit: $GITHUB_SHA"
|
|
git push
|
|
|
|
- name: (service) Merge service POT to PO translations
|
|
# run only when the POT file has been updated
|
|
if: steps.check_service_changes.outputs.pot_updated == 'true'
|
|
run: |
|
|
cd agama-weblate/service
|
|
find . -name "*.po" -exec msgmerge -U "{}" agama.pot \;
|
|
git commit -a -m "Merge new POT file to service translations"$'\n\n'"Agama commit: $GITHUB_SHA"
|
|
git push
|
|
|
|
- name: (rust) Generate POT file
|
|
run: |
|
|
cd agama/rust
|
|
./build_pot
|
|
msgfmt --statistics agama.pot
|
|
|
|
- name: (rust) Validate the generated POT file
|
|
run: msgfmt --check-format agama/rust/agama.pot
|
|
|
|
- name: (rust) Update POT file
|
|
run: |
|
|
mkdir -p agama-weblate/rust
|
|
cp agama/rust/agama.pot agama-weblate/rust/agama.pot
|
|
|
|
# any change besides the timestamp in the POT file?
|
|
- name: (rust) Check POT changes
|
|
id: check_rust_changes
|
|
run: |
|
|
git -C agama-weblate diff --ignore-matching-lines="POT-Creation-Date:" rust/agama.pot > pot.diff
|
|
|
|
if [ -s pot.diff ]; then
|
|
echo "POT file updated"
|
|
echo "pot_updated=true" >> $GITHUB_OUTPUT
|
|
else
|
|
echo "POT file unchanged"
|
|
echo "pot_updated=false" >> $GITHUB_OUTPUT
|
|
# reset any possible changes so they are not accidentally committed later
|
|
git -C agama-weblate reset --hard
|
|
fi
|
|
|
|
- name: (rust) Push updated POT file
|
|
# run only when the POT file has been updated
|
|
if: steps.check_rust_changes.outputs.pot_updated == 'true'
|
|
run: |
|
|
cd agama-weblate
|
|
git add rust/agama.pot
|
|
git commit -m "Update rust POT file"$'\n\n'"Agama commit: $GITHUB_SHA"
|
|
git push
|
|
|
|
- name: (rust) Merge new POT to PO translations
|
|
# run only when the POT file has been updated
|
|
if: steps.check_rust_changes.outputs.pot_updated == 'true'
|
|
run: |
|
|
cd agama-weblate/rust
|
|
find . -name "*.po" -exec msgmerge -U "{}" agama.pot \;
|
|
git commit -a -m "Merge new POT file to rust translations"$'\n\n'"Agama commit: $GITHUB_SHA"
|
|
git push
|