1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2024-12-16 14:53:28 +02:00
comprehensive-rust/.github/workflows/publish.yml

83 lines
2.5 KiB
YAML
Raw Normal View History

name: Publish
on:
push:
branches:
- main
workflow_dispatch:
permissions:
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: bn da de es fa fr it ja ko pt-BR zh-CN zh-TW
jobs:
publish:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
# We need the full history below.
fetch-depth: 0
- name: Setup Rust cache
uses: ./.github/workflows/setup-rust-cache
- name: Install mdbook
uses: ./.github/workflows/install-mdbook
- name: Build course in English
run: mdbook build -d book
2023-04-05 13:02:52 +02:00
- name: Zip exercise templates
run: cd book/exerciser && zip --recurse-paths ../html/comprehensive-rust-exercises.zip comprehensive-rust-exercises/
2023-04-05 13:02:52 +02:00
- name: Build all translations
run: |
for po_lang in ${{ env.LANGUAGES }}; do
POT_CREATION_DATE=$(grep --max-count 1 '^"POT-Creation-Date:' po/$po_lang.po | sed -E 's/".*: (.*)\\n"/\1/')
if [[ $POT_CREATION_DATE == "" ]]; then
POT_CREATION_DATE=now
fi
echo "::group::Building $po_lang translation as of $POT_CREATION_DATE"
rm -r src/
git restore --source "$(git rev-list -n 1 --before "$POT_CREATION_DATE" @)" src/
# Set language and adjust site URL. Clear the redirects
# since they are in sync with the source files, not the
# translation.
MDBOOK_BOOK__LANGUAGE=$po_lang \
MDBOOK_OUTPUT__HTML__SITE_URL=/comprehensive-rust/$po_lang/ \
MDBOOK_OUTPUT__HTML__REDIRECT='{}' \
mdbook build -d book/$po_lang
(cd book/$po_lang/exerciser && zip --recurse-paths ../html/comprehensive-rust-exercises.zip comprehensive-rust-exercises/)
2023-04-05 13:02:52 +02:00
mv book/$po_lang/html book/html/$po_lang
echo "::endgroup::"
done
- name: Setup Pages
build(deps): bump actions/configure-pages from 2 to 4 (#1620) Bumps [actions/configure-pages](https://github.com/actions/configure-pages) from 2 to 4. <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/actions/configure-pages/releases">actions/configure-pages's releases</a>.</em></p> <blockquote> <h2>v4.0.0</h2> <h1>Changelog</h1> <ul> <li>Use a centralized <code>.node-version</code> file <a href="https://github.com/JamesMGreene"><code>@​JamesMGreene</code></a> (<a href="https://redirect.github.com/actions/configure-pages/issues/117">#117</a>)</li> <li>Update action to node20 <a href="https://github.com/takost"><code>@​takost</code></a> (<a href="https://redirect.github.com/actions/configure-pages/issues/108">#108</a>)</li> </ul> <p>See details of <a href="https://github.com/actions/configure-pages/compare/v3.0.7...v4.0.0">all code changes</a> since previous release.</p> <h2>v3.0.7</h2> <h1>Changelog</h1> <ul> <li>Update Actions workflows to use Node 20.x <a href="https://github.com/JamesMGreene"><code>@​JamesMGreene</code></a> (<a href="https://redirect.github.com/actions/configure-pages/issues/116">#116</a>)</li> <li>Bump eslint-plugin-github from 4.7.0 to 4.10.1 <a href="https://github.com/dependabot"><code>@​dependabot</code></a> (<a href="https://redirect.github.com/actions/configure-pages/issues/114">#114</a>)</li> <li>Bump word-wrap from 1.2.3 to 1.2.5 <a href="https://github.com/dependabot"><code>@​dependabot</code></a> (<a href="https://redirect.github.com/actions/configure-pages/issues/113">#113</a>)</li> <li>Bump jest from 29.5.0 to 29.7.0 <a href="https://github.com/dependabot"><code>@​dependabot</code></a> (<a href="https://redirect.github.com/actions/configure-pages/issues/112">#112</a>)</li> <li>Bump <code>@​babel/traverse</code> from 7.21.3 to 7.23.5 <a href="https://github.com/dependabot"><code>@​dependabot</code></a> (<a href="https://redirect.github.com/actions/configure-pages/issues/110">#110</a>)</li> <li>Bump espree from 9.5.2 to 9.6.1 <a href="https://github.com/dependabot"><code>@​dependabot</code></a> (<a href="https://redirect.github.com/actions/configure-pages/issues/111">#111</a>)</li> <li>Bump eslint from 8.38.0 to 8.40.0 <a href="https://github.com/dependabot"><code>@​dependabot</code></a> (<a href="https://redirect.github.com/actions/configure-pages/issues/93">#93</a>)</li> </ul> <p>See details of <a href="https://github.com/actions/configure-pages/compare/v3.0.6...v3.0.7">all code changes</a> since previous release.</p> <h2>v3.0.6</h2> <h1>Changelog</h1> <ul> <li>Bump eslint from 8.36.0 to 8.38.0 <a href="https://github.com/dependabot"><code>@​dependabot</code></a> (<a href="https://redirect.github.com/actions/configure-pages/issues/89">#89</a>)</li> <li>Bump eslint-plugin-github from 4.6.1 to 4.7.0 <a href="https://github.com/dependabot"><code>@​dependabot</code></a> (<a href="https://redirect.github.com/actions/configure-pages/issues/86">#86</a>)</li> <li>Bump eslint-config-prettier from 8.7.0 to 8.8.0 <a href="https://github.com/dependabot"><code>@​dependabot</code></a> (<a href="https://redirect.github.com/actions/configure-pages/issues/85">#85</a>)</li> <li>Bump prettier from 2.8.6 to 2.8.7 <a href="https://github.com/dependabot"><code>@​dependabot</code></a> (<a href="https://redirect.github.com/actions/configure-pages/issues/84">#84</a>)</li> <li>Make &quot;Get Pages failed&quot; error message more helpful <a href="https://github.com/WofWca"><code>@​WofWca</code></a> (<a href="https://redirect.github.com/actions/configure-pages/issues/83">#83</a>)</li> <li>Bump prettier from 2.8.4 to 2.8.6 <a href="https://github.com/dependabot"><code>@​dependabot</code></a> (<a href="https://redirect.github.com/actions/configure-pages/issues/81">#81</a>)</li> <li>Add a CodeQL security scanning workflow <a href="https://github.com/JamesMGreene"><code>@​JamesMGreene</code></a> (<a href="https://redirect.github.com/actions/configure-pages/issues/68">#68</a>)</li> </ul> <p>See details of <a href="https://github.com/actions/configure-pages/compare/v3.0.5...v3.0.6">all code changes</a> since previous release.</p> <h2>v3.0.5</h2> <h1>Changelog</h1> <ul> <li>Bump jest from 29.4.3 to 29.5.0 <a href="https://github.com/dependabot"><code>@​dependabot</code></a> (<a href="https://redirect.github.com/actions/configure-pages/issues/77">#77</a>)</li> <li>Bump eslint from 8.35.0 to 8.36.0 <a href="https://github.com/dependabot"><code>@​dependabot</code></a> (<a href="https://redirect.github.com/actions/configure-pages/issues/76">#76</a>)</li> <li>Bump espree from 9.4.1 to 9.5.0 <a href="https://github.com/dependabot"><code>@​dependabot</code></a> (<a href="https://redirect.github.com/actions/configure-pages/issues/78">#78</a>)</li> <li>Bump eslint-config-prettier from 8.6.0 to 8.7.0 <a href="https://github.com/dependabot"><code>@​dependabot</code></a> (<a href="https://redirect.github.com/actions/configure-pages/issues/75">#75</a>)</li> <li>Bump eslint from 8.34.0 to 8.35.0 <a href="https://github.com/dependabot"><code>@​dependabot</code></a> (<a href="https://redirect.github.com/actions/configure-pages/issues/73">#73</a>)</li> <li>Bump jest from 29.4.1 to 29.4.3 <a href="https://github.com/dependabot"><code>@​dependabot</code></a> (<a href="https://redirect.github.com/actions/configure-pages/issues/72">#72</a>)</li> <li>Bump eslint-plugin-github from 4.6.0 to 4.6.1 <a href="https://github.com/dependabot"><code>@​dependabot</code></a> (<a href="https://redirect.github.com/actions/configure-pages/issues/71">#71</a>)</li> <li>Amend token coverage for enablement in Action metadata file <a href="https://github.com/JamesMGreene"><code>@​JamesMGreene</code></a> (<a href="https://redirect.github.com/actions/configure-pages/issues/51">#51</a>)</li> </ul> <p>See details of <a href="https://github.com/actions/configure-pages/compare/v3.0.4...v3.0.5">all code changes</a> since previous release.</p> <h2>v3.0.4</h2> <h1>Changelog</h1> <!-- raw HTML omitted --> </blockquote> <p>... (truncated)</p> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/actions/configure-pages/commit/1f0c5cde4bc74cd7e1254d0cb4de8d49e9068c7d"><code>1f0c5cd</code></a> Merge pull request <a href="https://redirect.github.com/actions/configure-pages/issues/117">#117</a> from actions/use-node-version-file</li> <li><a href="https://github.com/actions/configure-pages/commit/591bb0deb9c3f137206bbbabf9b07b6161afc6ba"><code>591bb0d</code></a> Merge branch 'main' into use-node-version-file</li> <li><a href="https://github.com/actions/configure-pages/commit/1465f012e6e7718cdf7bc61874e613e1e67ed84f"><code>1465f01</code></a> Merge pull request <a href="https://redirect.github.com/actions/configure-pages/issues/108">#108</a> from takost/update-to-node-20</li> <li><a href="https://github.com/actions/configure-pages/commit/f2fc55313325af8b5ee6da799ed072a114df7416"><code>f2fc553</code></a> Merge branch 'main' into update-to-node-20</li> <li><a href="https://github.com/actions/configure-pages/commit/373694e352893db5ef78de6f321e8d55c860f7b6"><code>373694e</code></a> Use a centralized .node-version file</li> <li><a href="https://github.com/actions/configure-pages/commit/b8130d9ab958b325bbde9786d62f2c97a9885a0e"><code>b8130d9</code></a> Merge pull request <a href="https://redirect.github.com/actions/configure-pages/issues/116">#116</a> from actions/node-20-workflows</li> <li><a href="https://github.com/actions/configure-pages/commit/ffbbfa5ad0b3f1a4367b816468d0d7f596f85363"><code>ffbbfa5</code></a> Update Actions workflows to use Node 20.x</li> <li><a href="https://github.com/actions/configure-pages/commit/18b91e40967b3cd820494bddfc6cec68be92afb3"><code>18b91e4</code></a> Merge pull request <a href="https://redirect.github.com/actions/configure-pages/issues/114">#114</a> from actions/dependabot/npm_and_yarn/eslint-plugin-gi...</li> <li><a href="https://github.com/actions/configure-pages/commit/35974f9c62a3cc9ea9804e1c0c3a64522035bf9b"><code>35974f9</code></a> Bump eslint-plugin-github from 4.7.0 to 4.10.1</li> <li><a href="https://github.com/actions/configure-pages/commit/17db653bf9c90f0d6813bc91de765c948f0531c0"><code>17db653</code></a> Merge pull request <a href="https://redirect.github.com/actions/configure-pages/issues/113">#113</a> from actions/dependabot/npm_and_yarn/word-wrap-1.2.5</li> <li>Additional commits viewable in <a href="https://github.com/actions/configure-pages/compare/v2...v4">compare view</a></li> </ul> </details> <br /> [![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=actions/configure-pages&package-manager=github_actions&previous-version=2&new-version=4)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) </details> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-01 23:40:05 +02:00
uses: actions/configure-pages@v4
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
2023-04-03 17:18:32 +02:00
path: book/html
- name: Deploy to GitHub Pages
id: deployment
build(deps): bump actions/deploy-pages from 1 to 4 (#1629) Bumps [actions/deploy-pages](https://github.com/actions/deploy-pages) from 1 to 4. <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/actions/deploy-pages/releases">actions/deploy-pages's releases</a>.</em></p> <blockquote> <h2>v4.0.0</h2> <h1>Changelog</h1> <ul> <li>Deploy pages using artifact IDs <a href="https://github.com/konradpabjan"><code>@​konradpabjan</code></a> (<a href="https://redirect.github.com/actions/deploy-pages/issues/251">#251</a>)</li> <li>This version requires the permission <code>actions: read</code> in the workflows which use it.</li> </ul> <hr /> <p>ℹ️ This version of <code>actions/deploy-pages</code> is <strong>ONLY</strong> compatible with artifacts uploaded by either:</p> <ul> <li><a href="https://github.com/actions/upload-pages-artifact/releases/tag/v3.0.0"><code>actions/upload-pages-artifact@v3</code></a> or newer</li> <li><a href="https://github.com/actions/upload-artifact/releases/tag/v4.0.0"><code>actions/upload-artifact@v4</code></a> or newer.</li> </ul> <p>See details of <a href="https://github.com/actions/deploy-pages/compare/v3.0.1...v4.0.0">all code changes</a> since previous release.</p> <p>:warning: For use with products other than GitHub.com, such as GitHub Enterprise Server, please consult the <a href="https://github.com/actions/deploy-pages/#compatibilty">compatibility table</a>.</p> <h2>v3.0.1</h2> <h1>Changelog</h1> <ul> <li>Bump eslint from 8.54.0 to 8.55.0 <a href="https://github.com/dependabot"><code>@​dependabot</code></a> (<a href="https://redirect.github.com/actions/deploy-pages/issues/266">#266</a>)</li> <li>Bump nock from 13.3.8 to 13.4.0 <a href="https://github.com/dependabot"><code>@​dependabot</code></a> (<a href="https://redirect.github.com/actions/deploy-pages/issues/267">#267</a>)</li> <li>Bump eslint-config-prettier from 9.0.0 to 9.1.0 <a href="https://github.com/dependabot"><code>@​dependabot</code></a> (<a href="https://redirect.github.com/actions/deploy-pages/issues/268">#268</a>)</li> <li>Bump <code>@​actions/core</code> from 1.10.0 to 1.10.1 <a href="https://github.com/dependabot"><code>@​dependabot</code></a> (<a href="https://redirect.github.com/actions/deploy-pages/issues/269">#269</a>)</li> <li>Bump <code>@​actions/github</code> from 5.1.1 to 6.0.0 <a href="https://github.com/dependabot"><code>@​dependabot</code></a> (<a href="https://redirect.github.com/actions/deploy-pages/issues/261">#261</a>)</li> <li>Update compatibility table for v3 <a href="https://github.com/JamesMGreene"><code>@​JamesMGreene</code></a> (<a href="https://redirect.github.com/actions/deploy-pages/issues/270">#270</a>)</li> </ul> <h2>🧰 Maintenance</h2> <ul> <li>chore/docs: update version, fix typos <a href="https://github.com/kbdharun"><code>@​kbdharun</code></a> (<a href="https://redirect.github.com/actions/deploy-pages/issues/272">#272</a>)</li> </ul> <hr /> <p>See details of <a href="https://github.com/actions/deploy-pages/compare/v3.0.0...v3.0.1">all code changes</a> since previous release.</p> <p>:warning: For use with products other than GitHub.com, such as GitHub Enterprise Server, please consult the <a href="https://github.com/actions/deploy-pages/#compatibilty">compatibility table</a>.</p> <h2>v3.0.0</h2> <h1>Changelog</h1> <ul> <li>Update action to node20 <a href="https://github.com/takost"><code>@​takost</code></a> (<a href="https://redirect.github.com/actions/deploy-pages/issues/256">#256</a>)</li> </ul> <hr /> <p>See details of <a href="https://github.com/actions/deploy-pages/compare/v2.0.5...v3.0.0">all code changes</a> since previous release.</p> <p>:warning: For use with products other than GitHub.com, such as GitHub Enterprise Server, please consult the <a href="https://github.com/actions/deploy-pages/#compatibilty">compatibility table</a>.</p> <h2>v2.0.5</h2> <h1>Changelog</h1> <!-- raw HTML omitted --> </blockquote> <p>... (truncated)</p> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/actions/deploy-pages/commit/7a9bd943aa5e5175aeb8502edcc6c1c02d398e10"><code>7a9bd94</code></a> Merge pull request <a href="https://redirect.github.com/actions/deploy-pages/issues/290">#290</a> from actions/dependabot/npm_and_yarn/undici-6.2.1</li> <li><a href="https://github.com/actions/deploy-pages/commit/eee8a27158326d4a4993574decb74691422aa9ff"><code>eee8a27</code></a> Update distributables after Dependabot 🤖</li> <li><a href="https://github.com/actions/deploy-pages/commit/b6e5c8516028359d6b81db642652a6634db91767"><code>b6e5c85</code></a> Bump undici from 6.0.1 to 6.2.1</li> <li><a href="https://github.com/actions/deploy-pages/commit/b8d2528df3fc21f73e431c0648ff7e80808433e0"><code>b8d2528</code></a> Merge pull request <a href="https://redirect.github.com/actions/deploy-pages/issues/282">#282</a> from actions/dependabot/github_actions/github/codeql-...</li> <li><a href="https://github.com/actions/deploy-pages/commit/53d1eac7fd4d43bdb78c7492d45ce17598a8fbf6"><code>53d1eac</code></a> Bump github/codeql-action from 2 to 3</li> <li><a href="https://github.com/actions/deploy-pages/commit/3f0ef9d75df3fc372f78051e41dfa694bb50f83f"><code>3f0ef9d</code></a> Merge pull request <a href="https://redirect.github.com/actions/deploy-pages/issues/281">#281</a> from actions/dependabot/github_actions/actions/upload...</li> <li><a href="https://github.com/actions/deploy-pages/commit/82751044df20afbd0ae563fb79e45eb19524ed36"><code>8275104</code></a> Bump actions/upload-artifact from 3 to 4</li> <li><a href="https://github.com/actions/deploy-pages/commit/9be9d731c91469d80c7cee3e565a1b54220def07"><code>9be9d73</code></a> Merge pull request <a href="https://redirect.github.com/actions/deploy-pages/issues/280">#280</a> from actions/dependabot/npm_and_yarn/eslint-8.56.0</li> <li><a href="https://github.com/actions/deploy-pages/commit/d8afefafec56df80907efefd0d5fc75007540533"><code>d8afefa</code></a> Bump eslint from 8.55.0 to 8.56.0</li> <li><a href="https://github.com/actions/deploy-pages/commit/304d0b77f8ce8509118d3d01565a9ac8dc244104"><code>304d0b7</code></a> Merge pull request <a href="https://redirect.github.com/actions/deploy-pages/issues/277">#277</a> from actions/dependabot/github_actions/actions/publis...</li> <li>Additional commits viewable in <a href="https://github.com/actions/deploy-pages/compare/v1...v4">compare view</a></li> </ul> </details> <br /> [![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=actions/deploy-pages&package-manager=github_actions&previous-version=1&new-version=4)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) </details> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-01 23:53:30 +02:00
uses: actions/deploy-pages@v4