-
Notifications
You must be signed in to change notification settings - Fork 23
45 lines (43 loc) · 2.13 KB
/
en-updates-to-translation-repo.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
name: Push EN changes to translation-files branch
on:
# run automatically when EN _i18n files are touched in live website- see https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet
push:
branches:
- 'master'
paths:
- _i18n/en.yml
- _i18n/en/**
# allow to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
update-files:
name: Update PO files
runs-on: ubuntu-latest
steps:
- name: Get repository
uses: actions/checkout@v3
- name: Install mdpo
run: pip install mdpo
- name: Create folder for files to be copied
run: mkdir _i18n/translation-files
- name: Create/update YAML file with short texts
# translated files are not copied because translation is done in Weblate - any manual translation edits will be lost
run: cp _i18n/en.yml _i18n/translation-files
- name: Create/update POT file of Contribute section
# see https://mdpo.readthedocs.io
run: md2po _i18n/en/contribute/*.md --po-filepath _i18n/translation-files/site-contribute.pot --save --quiet
- name: Create/update POT file of Documentation section
run: md2po _i18n/en/documentation/*.md _i18n/en/documentation/*/*.md --po-filepath _i18n/translation-files/site-documentation.pot --save --quiet
- name: Create/update POT file of other website pages
run: md2po _i18n/en/general/*.md --po-filepath _i18n/translation-files/site-general.pot --save --quiet
- name: Push to translation-files branch
# see https://github.com/s0/git-publish-subdir-action
uses: s0/git-publish-subdir-action@v2
env:
REPO: self
BRANCH: translation-files
FOLDER: _i18n/translation-files # assets in this folder will be pushed
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # GitHub automatically adds this
MESSAGE: "Update POT files @ {long-sha}🚀"
SKIP_EMPTY_COMMITS: true
CLEAR_GLOBS_FILE: ".github/workflows/clear-translation-target-files.txt" # delete items in target branch as listed in this file