Merge pull request #865 from osgeoweblate/weblate-osgeolive-index #53
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: Update Locale | |
# This action runs: | |
# - When this file changes | |
# - When changes on documentation (doc) | |
# - When is triggered manually | |
on: | |
workflow_dispatch: | |
push: | |
permissions: | |
contents: read | |
jobs: | |
update-locale: | |
permissions: | |
contents: write # for Git to git push | |
name: Update Locale | |
runs-on: ubuntu-22.04 | |
strategy: | |
fail-fast: false | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 1 | |
- name: Install apt packages | |
run: | | |
sudo apt-get install cmake cpanminus | |
sudo cpanm Text::SimpleTable::AutoWidth | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.x' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install -r ./requirements.txt | |
- name: Extract branch name and commit hash | |
run: | | |
branch=${GITHUB_REF#refs/heads/} | |
git_hash=$(git rev-parse --short "$GITHUB_SHA") | |
echo "GIT_HASH=$git_hash" >> $GITHUB_ENV | |
- name: Initialize mandatory git config | |
run: | | |
git config user.name "github-actions[bot]" | |
git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
- name: Update locale | |
run: | | |
mkdir build | |
bash .github/scripts/update_locale.sh | |
# Add the files, commit and push | |
git diff --staged --quiet || git commit -m "Locale update: for commit ${{ env.GIT_HASH }}" | |
git restore . # Remove the unstaged changes before rebasing | |
git push |