2022-03-15 23:00:49 +00:00
|
|
|
name: Deploy Docs
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- 'main'
|
2024-01-02 18:13:31 +00:00
|
|
|
# Allows running the action manually.
|
|
|
|
workflow_dispatch:
|
|
|
|
|
2022-03-15 23:00:49 +00:00
|
|
|
env:
|
|
|
|
CARGO_TERM_COLOR: always
|
|
|
|
RUSTDOCFLAGS: --html-in-header header.html
|
2024-04-22 22:41:45 +00:00
|
|
|
# If nightly is breaking CI, modify this variable to target a specific nightly version.
|
2024-03-01 16:01:25 +00:00
|
|
|
NIGHTLY_TOOLCHAIN: nightly
|
2022-03-15 23:00:49 +00:00
|
|
|
|
2024-01-02 18:13:31 +00:00
|
|
|
# Sets the permissions to allow deploying to Github pages.
|
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
pages: write
|
|
|
|
id-token: write
|
|
|
|
|
|
|
|
# Only allow one deployment to run at a time, however it will not cancel in-progress runs.
|
|
|
|
concurrency:
|
|
|
|
group: "pages"
|
|
|
|
cancel-in-progress: false
|
|
|
|
|
2022-03-15 23:00:49 +00:00
|
|
|
jobs:
|
|
|
|
build-and-deploy:
|
|
|
|
runs-on: ubuntu-latest
|
2024-05-08 14:15:21 +00:00
|
|
|
# Only run this job when on the main Bevy repository. Without this, it would also run on forks
|
|
|
|
# where developers work on the main branch but have not enabled Github Pages.
|
|
|
|
if: ${{ github.repository == 'bevyengine/bevy' }}
|
2024-01-02 18:13:31 +00:00
|
|
|
environment:
|
|
|
|
name: github-pages
|
|
|
|
url: ${{ steps.deployment.outputs.page_url }}
|
2022-03-15 23:00:49 +00:00
|
|
|
steps:
|
|
|
|
- name: Checkout
|
2023-09-13 19:26:25 +00:00
|
|
|
uses: actions/checkout@v4
|
2022-03-15 23:00:49 +00:00
|
|
|
|
2024-03-01 16:01:25 +00:00
|
|
|
- uses: dtolnay/rust-toolchain@master
|
|
|
|
with:
|
|
|
|
toolchain: ${{ env.NIGHTLY_TOOLCHAIN }}
|
2022-03-15 23:00:49 +00:00
|
|
|
|
2024-04-13 22:34:48 +00:00
|
|
|
- name: Install Linux dependencies
|
|
|
|
uses: ./.github/actions/install-linux-deps
|
|
|
|
with:
|
|
|
|
wayland: true
|
|
|
|
xkb: true
|
2022-03-16 02:08:25 +00:00
|
|
|
|
2022-03-15 23:00:49 +00:00
|
|
|
# This does the following:
|
|
|
|
# - Replaces the docs icon with one that clearly denotes it's not the released package on crates.io
|
|
|
|
# - Adds a meta tag that forces Google not to index any page on the site.
|
|
|
|
- name: Pre-docs-build
|
|
|
|
run: |
|
2022-03-15 23:52:44 +00:00
|
|
|
sed -i.bak "s/icon.png/icon-docs-dev.png/" src/lib.rs
|
2022-03-15 23:00:49 +00:00
|
|
|
echo "<meta name=\"robots\" content=\"noindex\">" > header.html
|
|
|
|
|
|
|
|
- name: Build docs
|
2024-03-23 02:22:52 +00:00
|
|
|
env:
|
|
|
|
# needs to be in sync with [package.metadata.docs.rs]
|
|
|
|
RUSTDOCFLAGS: -Zunstable-options --cfg=docsrs
|
2024-03-01 16:01:25 +00:00
|
|
|
run: cargo doc --all-features --no-deps -p bevy -Zunstable-options -Zrustdoc-scrape-examples
|
2022-03-15 23:00:49 +00:00
|
|
|
|
|
|
|
# This adds the following:
|
|
|
|
# - A top level redirect to the bevy crate documentation
|
|
|
|
# - A CNAME file for redirecting the docs domain to the API reference
|
|
|
|
# - A robots.txt file to forbid any crawling of the site (to defer to the docs.rs site on search engines).
|
|
|
|
- name: Finalize documentation
|
|
|
|
run: |
|
|
|
|
echo "<meta http-equiv=\"refresh\" content=\"0; url=bevy/index.html\">" > target/doc/index.html
|
|
|
|
echo "dev-docs.bevyengine.org" > target/doc/CNAME
|
2024-07-16 17:49:07 +00:00
|
|
|
echo $'User-Agent: *\nDisallow: /' > target/doc/robots.txt
|
2024-01-24 17:28:29 +00:00
|
|
|
rm target/doc/.lock
|
2022-03-15 23:00:49 +00:00
|
|
|
|
2024-01-02 18:13:31 +00:00
|
|
|
- name: Upload site artifact
|
2024-01-20 09:27:00 +00:00
|
|
|
uses: actions/upload-pages-artifact@v3
|
2022-03-15 23:00:49 +00:00
|
|
|
with:
|
2024-01-02 18:13:31 +00:00
|
|
|
path: target/doc
|
|
|
|
|
|
|
|
- name: Deploy to Github Pages
|
|
|
|
id: deployment
|
2024-01-20 09:27:00 +00:00
|
|
|
uses: actions/deploy-pages@v4
|