Skip to content

Commit b76ad1a

Browse files
authored
Enable Weblate translation workflow. (#13)
1 parent be580e7 commit b76ad1a

File tree

1 file changed

+51
-52
lines changed

1 file changed

+51
-52
lines changed

.github/workflows/translate.yml

Lines changed: 51 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -49,58 +49,57 @@ jobs:
4949
git config --local user.email "$(git log --pretty='%ae' -1)"
5050
git config --local user.name "brutusthebee[bot]"
5151
52-
# Temporary disabled until we're fully registered with Weblate.
53-
# - name: Regenerate PO files
54-
# env:
55-
# DEEPL_API_KEY: ${{ secrets.DEEPL_API_KEY }}
56-
# run: |
57-
# tox -e docs-translate
58-
59-
# - name: Configure Weblate
60-
# env:
61-
# WEBLATE_API_TOKEN: ${{ secrets.WEBLATE_API_TOKEN }}
62-
# run: |
63-
# cat <<EOF > ~/.weblate
64-
# [weblate]
65-
# url = https://hosted.weblate.org/api/
66-
# key = $WEBLATE_API_TOKEN
67-
# translation = beeware/tutorial
68-
# EOF
69-
70-
# - name: Lock Weblate and Sync
71-
# run: wlc lock
72-
# - name: Commit Weblate changes
73-
# run: wlc commit
74-
# - name: Push Weblate changes
75-
# run: wlc push
76-
# - name: Pull translation updates pushed by Weblate
77-
# run: git pull origin
78-
79-
# - name: Update Needed?
80-
# id: updated
81-
# run: |
82-
# if [[ $(git status --porcelain) ]]; then
83-
# echo "updated=true" >> ${GITHUB_OUTPUT}
84-
# else
85-
# echo "updated=false" >> ${GITHUB_OUTPUT}
86-
# fi
87-
88-
# - name: Commit updated translations
89-
# if: steps.updated.outputs.updated == 'true'
90-
# env:
91-
# GITHUB_TOKEN: ${{ github.token }}
92-
# run: |
93-
# # Commit the updated PO files.
94-
# git add docs/locales
95-
# git commit -m "Update translations to $(git rev-parse --short HEAD)."
96-
# git push origin
97-
98-
# - name: Ensure Weblate has current updates
99-
# if: steps.updated.outputs.updated == 'true'
100-
# run: wlc pull
101-
102-
# - name: Unlock Weblate
103-
# run: wlc unlock
52+
- name: Configure Weblate
53+
env:
54+
WEBLATE_API_TOKEN: ${{ secrets.WEBLATE_API_TOKEN }}
55+
run: |
56+
cat <<EOF > ~/.weblate
57+
[weblate]
58+
url = https://hosted.weblate.org/api/
59+
key = $WEBLATE_API_TOKEN
60+
translation = beeware/tutorial
61+
EOF
62+
63+
- name: Lock Weblate and Sync
64+
run: wlc lock
65+
- name: Commit Weblate changes
66+
run: wlc commit
67+
- name: Push Weblate changes
68+
run: wlc push
69+
- name: Pull translation updates pushed by Weblate
70+
run: git pull origin
71+
72+
- name: Regenerate PO files
73+
env:
74+
DEEPL_API_KEY: ${{ secrets.DEEPL_API_KEY }}
75+
run: |
76+
tox -e docs-translate
77+
78+
- name: Update Needed?
79+
id: updated
80+
run: |
81+
if [[ $(git status --porcelain) ]]; then
82+
echo "updated=true" >> ${GITHUB_OUTPUT}
83+
else
84+
echo "updated=false" >> ${GITHUB_OUTPUT}
85+
fi
86+
87+
- name: Commit updated translations
88+
if: steps.updated.outputs.updated == 'true'
89+
env:
90+
GITHUB_TOKEN: ${{ github.token }}
91+
run: |
92+
# Commit the updated PO files.
93+
git add docs/locales
94+
git commit -m "Update translations to $(git rev-parse --short HEAD)."
95+
git push origin
96+
97+
- name: Ensure Weblate has current updates
98+
if: steps.updated.outputs.updated == 'true'
99+
run: wlc pull
100+
101+
- name: Unlock Weblate
102+
run: wlc unlock
104103

105104
# # This step is only needed if you're trying to diagnose test failures that
106105
# # only occur in CI, and can't be reproduced locally. When it runs, it will

0 commit comments

Comments
 (0)