Skip to content

Commit 5f11d34

Browse files
authored
Ensure that translations are updated after every commit to lektor branch. (#649)
1 parent 625f0ec commit 5f11d34

File tree

3 files changed

+33
-7
lines changed

3 files changed

+33
-7
lines changed

.github/workflows/publish.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ jobs:
1010
runs-on: ubuntu-latest
1111
steps:
1212
- uses: actions/checkout@v1
13+
- name: Configure git
14+
run: |
15+
git config --local user.email "$(git log --pretty='%ae' -1)"
16+
git config --local user.name "brutusthebee[bot]"
1317
- name: Set up Python
1418
uses: actions/setup-python@v1
1519
with:
@@ -25,7 +29,28 @@ jobs:
2529
- name: Build site
2630
run: |
2731
lektor build --no-prune
32+
33+
- name: Translation update required?
34+
id: updated
35+
run: |
36+
if [[ $(git status --porcelain) ]]; then
37+
echo "updated=true" >> ${GITHUB_OUTPUT}
38+
else
39+
echo "updated=false" >> ${GITHUB_OUTPUT}
40+
fi
41+
42+
- name: Commit updated translations
43+
if: steps.updated.outputs.updated == 'true'
44+
env:
45+
GITHUB_TOKEN: ${{ github.token }}
46+
run: |
47+
# Commit the updated PO files.
48+
git add i18n
49+
git commit -m "Update translations to $(git rev-parse --short HEAD)."
50+
git push origin
51+
2852
- name: Publish site
53+
if: steps.updated.outputs.updated == 'false'
2954
env:
3055
LEKTOR_DEPLOY_USERNAME: brutusthebee
3156
LEKTOR_DEPLOY_PASSWORD: ${{ secrets.LEKTOR_DEPLOY_PASSWORD }}

.gitignore

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
*~
21
.DS_Store
3-
*.egg-info/
4-
*.pyc
5-
local/
6-
venv*/
7-
.vscode/
82
.envrc
93
.idea/
4+
.vscode/
5+
*.egg-info/
6+
*.pyc
7+
*~
108
contents+*.lr
119
i18n/_compiled
10+
local/
11+
output
12+
venv*/

BeeWare.lektorproject

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ locale = fa_IR
8383
lektor-github-repos = 0.1.1
8484
lektor-gravatar = 0.1.3
8585
lektor-markdown-admonition = 0.3.1
86-
git+https://github.com/beeware/lektor-i18n-plugin@v0.5.2 =
86+
git+https://github.com/beeware/lektor-i18n-plugin@v0.5.3 =
8787

8888
[servers.ghpages]
8989
target = ghpages://beeware/beeware.github.io?cname=beeware.org

0 commit comments

Comments
 (0)