Skip to content

Commit 1f96163

Browse files
committed
Sync src/ with date in PO file when publishing
This will freeze translation in place: they will keep using the same English Markdown source files as the starting point until a new POT file is merged into the translation. We still update all the files around the Markdown files: this allows us to fix things in the theme, for example. Part of google/mdbook-i18n-helpers#16. The logic here should eventually be moved to somewhere in mdbook-i18n-helpers, most likely to the renderer that @sakex is building in google/mdbook-i18n-helpers#84.
1 parent a9183eb commit 1f96163

File tree

1 file changed

+21
-15
lines changed

1 file changed

+21
-15
lines changed

.github/workflows/publish.yml

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
name: Publish
22

33
on:
4-
push:
5-
branches:
6-
- main
7-
workflow_dispatch:
4+
pull_request:
5+
# push:
6+
# branches:
7+
# - main
8+
# workflow_dispatch:
89

910
permissions:
1011
contents: read
@@ -47,6 +48,11 @@ jobs:
4748
run: |
4849
for po_lang in ${{ env.LANGUAGES }}; do
4950
echo "::group::Building $po_lang translation"
51+
POT_CREATION_DATE=$(grep --max-count 1 '^"POT-Creation-Date:' $PO_FILE | sed -E 's/".*: (.*)\\n"/\1/')
52+
if [[ $POT_CREATION_DATE == "" ]]; then
53+
POT_CREATION_DATE=now
54+
fi
55+
git checkout "main@{$POT_CREATION_DATE}" src
5056
MDBOOK_BOOK__LANGUAGE=$po_lang \
5157
MDBOOK_OUTPUT__HTML__SITE_URL=/comprehensive-rust/$po_lang/ \
5258
mdbook build -d book/$po_lang
@@ -55,14 +61,14 @@ jobs:
5561
echo "::endgroup::"
5662
done
5763
58-
- name: Setup Pages
59-
uses: actions/configure-pages@v2
60-
61-
- name: Upload artifact
62-
uses: actions/upload-pages-artifact@v1
63-
with:
64-
path: book/html
65-
66-
- name: Deploy to GitHub Pages
67-
id: deployment
68-
uses: actions/deploy-pages@v1
64+
# - name: Setup Pages
65+
# uses: actions/configure-pages@v2
66+
#
67+
# - name: Upload artifact
68+
# uses: actions/upload-pages-artifact@v1
69+
# with:
70+
# path: book/html
71+
#
72+
# - name: Deploy to GitHub Pages
73+
# id: deployment
74+
# uses: actions/deploy-pages@v1

0 commit comments

Comments
 (0)