Skip to content
Draft
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
dcd361d
ci: parallelize the mdbook build <language> process
michael-kerscher Jun 3, 2025
8a4d79d
test the publish process without actually publishing by removing perm…
michael-kerscher Jun 3, 2025
1921543
install parallel (with moreutils)
michael-kerscher Jun 3, 2025
121cca3
use gnu parallel that is already installed
michael-kerscher Jun 3, 2025
436f84b
english translation needs to be moved to correct directory
michael-kerscher Jun 3, 2025
eb4ecca
Revert "english translation needs to be moved to correct directory"
michael-kerscher Jun 6, 2025
7120c33
Revert "use gnu parallel that is already installed"
michael-kerscher Jun 6, 2025
bee9ae1
Revert "install parallel (with moreutils)"
michael-kerscher Jun 6, 2025
b2de3cc
Revert "ci: parallelize the mdbook build <language> process"
michael-kerscher Jun 6, 2025
a512b67
ci: Use a job matrix for translations and combine the artifacts in th…
michael-kerscher Jun 6, 2025
968b7dd
install i18n-report (via install-mdbook step) in publish job
michael-kerscher Jun 10, 2025
33f148f
satisfy our pushy dprint
michael-kerscher Jun 10, 2025
758505a
add checkout action
michael-kerscher Jun 10, 2025
7b84b06
install gettext for msgmerge
michael-kerscher Jun 12, 2025
4525929
make YAML more simple
michael-kerscher Sep 4, 2025
33bd1a8
Upload the already built i18n-report binary and download it in later …
michael-kerscher Sep 4, 2025
4392e6b
pre-build tools in a separate compile build-tools step
michael-kerscher Sep 4, 2025
bef01c4
use a better description
michael-kerscher Sep 4, 2025
23b9247
hardcode home directory for the runner. Directory was taken from rust…
michael-kerscher Sep 4, 2025
7c50b36
fix permission issues (binaries have not been executable due to zippi…
michael-kerscher Sep 4, 2025
0eabe54
install mdbook-pandoc dependencies in create-translation
michael-kerscher Sep 4, 2025
35ebe18
evaluate install-action github action
michael-kerscher Sep 5, 2025
49da39b
Remove rust binary precompilation step.
michael-kerscher Sep 19, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
111 changes: 81 additions & 30 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,43 @@ name: Publish
# See also TRANSLATIONS.md.

on:
pull_request:
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this needs to be removed before merging

push:
branches:
- main
workflow_dispatch:

permissions:
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this needs to be re-added before merging

contents: read
pages: write
id-token: write

# Allow one concurrent deployment
concurrency:
group: pages
cancel-in-progress: true

env:
CARGO_TERM_COLOR: always
# Update the language picker in index.hbs to link new languages.
LANGUAGES: ar bn da de el es fa fr id it ja ko pl pt-BR ro ru tr uk vi zh-CN zh-TW

jobs:
publish:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
create-translation:
strategy:
matrix:
language:
- "en"
- "ar"
- "bn"
- "da"
- "de"
- "el"
- "es"
- "fa"
- "fr"
- "id"
- "it"
- "ja"
- "ko"
- "pl"
- "pt-BR"
- "ro"
- "ru"
- "tr"
- "uk"
- "vi"
- "zh-CN"
- "zh-TW"
Comment on lines +20 to +42
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fine (and easy to sort!), but just in case you hadn't thought of it,

language: ["en", "ar", ...]`

would be equivalent.

runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -50,14 +62,46 @@ jobs:
uses: ./.github/workflows/install-mdbook

- name: Build course in English
if: matrix.language == 'en'
run: .github/workflows/build.sh en book

- name: Build all translations
- name: Build ${{ matrix.language }} translation
if: matrix.language != 'en'
run: |
for po_lang in ${{ env.LANGUAGES }}; do
.github/workflows/build.sh $po_lang book/$po_lang
mv book/$po_lang/html book/html/$po_lang
done
.github/workflows/build.sh ${{ matrix.language }} book/${{ matrix.language }}
mkdir book/html
mv book/${{ matrix.language }}/html book/html/${{ matrix.language }}

- name: Upload translation
uses: actions/upload-artifact@v4
with:
name: comprehensive-rust-${{ matrix.language }}
path: book/

publish:
runs-on: ubuntu-latest
needs: create-translation
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Update Rust
run: rustup update

- name: Install Gettext
run: |
sudo apt update
sudo apt install gettext
Comment on lines +92 to +94
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should now use the new apt-get-install action 🎉


- name: Install mdbook
uses: ./.github/workflows/install-mdbook

- name: Download all translations
uses: actions/download-artifact@v4
with:
path: book/
pattern: comprehensive-rust-*
merge-multiple: true

- name: Build translation report
run: i18n-report report book/html/translation-report.html po/*.po
Expand All @@ -69,14 +113,21 @@ jobs:
for file in synced-po/*.po; do msgmerge --update $file synced-po/messages.pot ; done
i18n-report report book/html/synced-translation-report.html synced-po/*.po

- name: Setup Pages
uses: actions/configure-pages@v5

- name: Upload artifact
uses: actions/upload-pages-artifact@v4
# TODO: remove this before merging into main. This is just for verification of the build result while developing this workflow.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a comment here so we don't forget.

- name: Upload all translations (for verification)
uses: actions/upload-artifact@v4
with:
path: book/html

- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
name: comprehensive-rust-all
path: book/
# TODO: uncomment the following lines before merging into main. This is removed for development purposes.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another comment to ensure we don't forget.

# - name: Setup Pages
# uses: actions/configure-pages@v5

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

# - name: Deploy to GitHub Pages
# id: deployment
# uses: actions/deploy-pages@v4
Loading