67 lines
2.1 KiB
YAML
67 lines
2.1 KiB
YAML
name: Weblate - *.pot synchronization
|
|
on:
|
|
schedule:
|
|
# Run this every morning
|
|
- cron: '45 2 * * *'
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
pot-upload:
|
|
name: Upload *.pot files to dnf5-l10n repository
|
|
# do not run the cron job on forks
|
|
if: (github.event_name == 'schedule' && github.repository_owner == 'rpm-software-management') || (github.event_name != 'schedule')
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
image: ghcr.io/rpm-software-management/dnf-ci-host
|
|
options: --user root
|
|
timeout-minutes: 10
|
|
steps:
|
|
- uses: actions/create-github-app-token@v1
|
|
id: app-token
|
|
with:
|
|
app-id: ${{ vars.RSM_CI_APP_ID }}
|
|
private-key: ${{ secrets.RSM_CI_APP_PRIVATE_KEY }}
|
|
permissions:
|
|
contents: "write"
|
|
repositories: "rpm-software-management/dnf5-l10n"
|
|
|
|
- name: Clone source repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
path: src
|
|
fetch-depth: 1
|
|
|
|
- name: Generate fresh *.pot files
|
|
run: |
|
|
cd src
|
|
cmake -S . -B build
|
|
cmake --build build --target gettext-potfiles
|
|
|
|
- name: Clone weblate repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
path: l10n
|
|
repository: ${{ github.repository }}-l10n
|
|
token: ${{ steps.app-token.outputs.token }}
|
|
|
|
- name: Commit .pot to weblate repo
|
|
run: |
|
|
git config --global user.name "GitHub Workflow"
|
|
git config --global user.email "github-actions@github.com"
|
|
pushd src
|
|
for f in $(find * -type f -name "*.pot"); do
|
|
potfile=$(basename $f)
|
|
component=${potfile%.*}
|
|
mkdir -p ../l10n/${component}
|
|
cp ${f} ../l10n/${component}/${potfile}
|
|
echo ${f%/*} > ../l10n/${component}/PATH
|
|
done
|
|
popd
|
|
git -C l10n add "*"
|
|
|
|
# If only creation dates were changed do nothing
|
|
if git -C l10n diff --staged --ignore-matching-lines='"POT-Creation-Date:' --exit-code; then exit 0; fi
|
|
|
|
git -C l10n commit -m "Update source files"
|
|
git -C l10n push
|