fix repetition syntax in 06_repetition readme #19
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy | |
on: | |
push: | |
branches: | |
- main | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
i18n-helpers: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup Rust cache | |
uses: ./.github/workflows/setup-rust-cache | |
- name: Install Gettext | |
run: sudo apt install gettext | |
- name: Install mdbook | |
uses: ./.github/workflows/install-mdbook | |
- name: Generate po/messages.pot | |
run: mdbook build -d po | |
working-directory: ./book | |
env: | |
MDBOOK_OUTPUT: '{"xgettext": {"pot-file": "messages.pot"}}' | |
- name: Test messages.pot | |
working-directory: ./book | |
run: msgfmt --statistics -o /dev/null po/messages.pot | |
- name: Expand includes without translation | |
working-directory: ./book | |
run: mdbook build -d expanded | |
env: | |
MDBOOK_OUTPUT: '{"markdown": {}}' | |
- name: Expand includes with no-op translation | |
working-directory: ./book | |
run: mdbook build -d no-op | |
env: | |
MDBOOK_OUTPUT: '{"markdown": {}}' | |
MDBOOK_PREPROCESSOR__GETTEXT__PO_FILE: po/messages.pot | |
- name: Compare no translation to no-op translation | |
working-directory: ./book | |
run: diff --color=always --unified --recursive expanded no-op | |
find-translations: | |
runs-on: ubuntu-latest | |
outputs: | |
languages: ${{ steps.find-translations.outputs.languages }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Find translations | |
working-directory: ./book | |
id: find-translations | |
shell: python | |
run: | | |
import os, json, pathlib | |
languages = [p.stem for p in pathlib.Path("po").iterdir() if p.suffix == ".po"] | |
github_output = open(os.environ["GITHUB_OUTPUT"], "a") | |
github_output.write("languages=") | |
json.dump(sorted(languages), github_output) | |
translations: | |
runs-on: ubuntu-latest | |
needs: | |
- find-translations | |
defaults: | |
run: | |
working-directory: ./book/ | |
strategy: | |
matrix: | |
language: ${{ fromJSON(needs.find-translations.outputs.languages) }} | |
env: | |
MDBOOK_BOOK__LANGUAGE: ${{ matrix.language }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup Rust cache | |
uses: ./.github/workflows/setup-rust-cache | |
- name: Install Gettext | |
run: sudo apt install gettext | |
- name: Install mdbook | |
uses: ./.github/workflows/install-mdbook | |
- name: Test ${{ matrix.language }} translation | |
run: msgfmt --statistics -o /dev/null po/${{ matrix.language }}.po | |
- name: Build course with ${{ matrix.language }} translation | |
run: mdbook build | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: macrokata-${{ matrix.language }} | |
path: book/book/ |