Skip to content

Commit

Permalink
Sync src/ with date in PO file when publishing
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
mgeisler committed Sep 24, 2023
1 parent a9183eb commit ab650c0
Showing 1 changed file with 28 additions and 22 deletions.
50 changes: 28 additions & 22 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
name: Publish

on:
push:
branches:
- main
workflow_dispatch:
pull_request:
# push:
# branches:
# - main
# workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write
#permissions:
# contents: read
# pages: write
# id-token: write

# Allow one concurrent deployment
concurrency:
Expand All @@ -23,9 +24,9 @@ env:

jobs:
publish:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
# environment:
# name: github-pages
# url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -47,6 +48,11 @@ jobs:
run: |
for po_lang in ${{ env.LANGUAGES }}; do
echo "::group::Building $po_lang translation"
POT_CREATION_DATE=$(grep --max-count 1 '^"POT-Creation-Date:' $PO_FILE | sed -E 's/".*: (.*)\\n"/\1/')
if [[ $POT_CREATION_DATE == "" ]]; then
POT_CREATION_DATE=now
fi
git checkout "main@{$POT_CREATION_DATE}" src
MDBOOK_BOOK__LANGUAGE=$po_lang \
MDBOOK_OUTPUT__HTML__SITE_URL=/comprehensive-rust/$po_lang/ \
mdbook build -d book/$po_lang
Expand All @@ -55,14 +61,14 @@ jobs:
echo "::endgroup::"
done
- name: Setup Pages
uses: actions/configure-pages@v2

- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: book/html

- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
# - name: Setup Pages
# uses: actions/configure-pages@v2
#
# - name: Upload artifact
# uses: actions/upload-pages-artifact@v1
# with:
# path: book/html
#
# - name: Deploy to GitHub Pages
# id: deployment
# uses: actions/deploy-pages@v1

0 comments on commit ab650c0

Please sign in to comment.