2022-03-15 23:00:49 +00:00
|
|
|
name: Deploy Docs
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- 'main'
|
|
|
|
|
|
|
|
env:
|
|
|
|
CARGO_TERM_COLOR: always
|
|
|
|
RUSTDOCFLAGS: --html-in-header header.html
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
build-and-deploy:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
2023-09-13 19:26:25 +00:00
|
|
|
uses: actions/checkout@v4
|
2022-03-15 23:00:49 +00:00
|
|
|
|
|
|
|
- name: Install Rust
|
2022-10-31 17:36:23 +00:00
|
|
|
uses: dtolnay/rust-toolchain@stable
|
2022-03-15 23:00:49 +00:00
|
|
|
|
2022-03-16 02:08:25 +00:00
|
|
|
- name: Install alsa and udev
|
|
|
|
run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev libwayland-dev libxkbcommon-dev
|
|
|
|
|
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
|
|
|
|
run: cargo doc --all-features --no-deps -p bevy
|
|
|
|
|
|
|
|
# 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).
|
|
|
|
# - A .nojekyll file to disable Jekyll GitHub Pages builds.
|
|
|
|
- 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
|
|
|
|
echo "User-Agent: *\nDisallow: /" > target/doc/robots.txt
|
|
|
|
touch target/doc/.nojekyll
|
|
|
|
|
|
|
|
- name: Deploy
|
2023-09-20 18:22:34 +00:00
|
|
|
if: github.repository == 'bevyengine/bevy'
|
2022-05-02 18:45:02 +00:00
|
|
|
uses: JamesIves/github-pages-deploy-action@v4
|
2022-03-15 23:00:49 +00:00
|
|
|
with:
|
|
|
|
branch: gh-pages
|
|
|
|
folder: target/doc
|
2022-06-29 15:44:34 +00:00
|
|
|
single-commit: true
|
|
|
|
force: true
|