Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-add non-English ProGit downloads #1964

Merged
merged 45 commits into from
Mar 2, 2025

Conversation

dscho
Copy link
Member

@dscho dscho commented Mar 1, 2025

Changes

  • This re-adds the download links to the non-English versions of the ProGit book

Example:

Current Proposed
https://git-scm.com/book/zh/v2 https://dscho.github.io/git-scm.com/book/zh/v2
image image

Context

As reported in #1963, the download links for the non-English versions of the ProGit book were lost. The reason was that during the transition to the Hugo world, we switched from generating the ProGit HTML pages from dynamically-fetched Git objects (via Octokit) to using a local clone instead, and that local clone lacks the information which downloadable versions of the respective ProGit translation exists (if any).

This PR introduces changes so that the download links are once again discovered dynamically, without the need to switch away from using clones to generate the HTML pages.

This PR also needed to fix the update-book workflow so that it handles gracefully when forcing a complete re-generation might not result in any committable changes in some of the translations.

The actual book/ updates were performed by this manual update-book workflow run where I set force-rebuild to true.

This closes #1963

dscho and others added 30 commits March 1, 2025 19:43
We indent with spaces here, not using tabs.

Signed-off-by: Johannes Schindelin <[email protected]>
Some books have downloadable PDF/ebook versions. In the
`remote_genbook2` function, this information is discovered dynamically
by looking at the corresponding repository's latest release.

This functionality is useful even in the GitHub workflow that keeps
https://git-scm.com/book/ up to date, so let's refactor it into a
reusable function.

Signed-off-by: Johannes Schindelin <[email protected]>
There used to be convenient download links for some of the ProGit book
translations.

In the transition to a Hugo-generated site, these links were lost for
all except the original English version, where the downloads were
hard-coded.

The reason is that in the Hugo world, we want to avoid network-heavy
roundtrips that would be necessary when using the `remote_genbook2`
function, and we use `local_genbook2` instead, where the information
about what downloadable assets there are (if any) is simply not there.

Let's add a way to discover the downloadable assets, by using Octokit,
but still use the local clone for the rest of the generation. The way to
enable this is by providing a `GITHUB_API_TOKEN` environment variable.
If that environment variable is not set, no dynamic discovery will be
performed.

Signed-off-by: Johannes Schindelin <[email protected]>
This is needed whenever calling Octokit. So far, this has not been
necessary in the GitHub workflows, but in the next commit we will switch
to discover the ProGit downloads dynamically, which requires Octokit.

Signed-off-by: Johannes Schindelin <[email protected]>
…ions

In the transition to the Hugo world, these download links were lost.

By using the just-introduced feature where `script/update-book2.rb` can
work on a clone of the (potentially translated) ProGit book but also
discover dynamically in what format the book can be downloaded (if any),
we can add those back.

This closes git#1963.

Signed-off-by: Johannes Schindelin <[email protected]>
When forcing a full rebuild, it is possible that some translations do
not result in any change. Allow for that _specifically_ when
force-rebuilding, but not otherwise (where it would be a bug if there
was no change, as at least the head commit will be changed).

Signed-off-by: Johannes Schindelin <[email protected]>
Updated via the `update-book.yml` GitHub workflow.
Updated via the `update-book.yml` GitHub workflow.
Updated via the `update-book.yml` GitHub workflow.
Updated via the `update-book.yml` GitHub workflow.
Updated via the `update-book.yml` GitHub workflow.
Updated via the `update-book.yml` GitHub workflow.
Updated via the `update-book.yml` GitHub workflow.
Updated via the `update-book.yml` GitHub workflow.
Updated via the `update-book.yml` GitHub workflow.
Updated via the `update-book.yml` GitHub workflow.
Updated via the `update-book.yml` GitHub workflow.
Updated via the `update-book.yml` GitHub workflow.
Updated via the `update-book.yml` GitHub workflow.
Updated via the `update-book.yml` GitHub workflow.
Updated via the `update-book.yml` GitHub workflow.
Updated via the `update-book.yml` GitHub workflow.
Updated via the `update-book.yml` GitHub workflow.
Updated via the `update-book.yml` GitHub workflow.
Updated via the `update-book.yml` GitHub workflow.
Updated via the `update-book.yml` GitHub workflow.
dscho added 15 commits March 1, 2025 19:19
@dscho
Copy link
Member Author

dscho commented Mar 2, 2025

I'll just go ahead and merge before there will be any merge conflicts.

@dscho dscho merged commit 1fa25a8 into git:gh-pages Mar 2, 2025
1 check passed
@dscho dscho deleted the fix-non-English-progit-downloads branch March 2, 2025 17:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Non-english pages no longer have the download option
1 participant