diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 0000000000..e471a81330 --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,53 @@ +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 + uses: actions/checkout@v2.3.1 + + - name: Install Rust + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + override: true + + # 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: | + sed -i "s/icon.png/icon-docs-dev.png" src/lib.rs + echo "" > 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 "" > 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 + uses: JamesIves/github-pages-deploy-action@4.1.7 + with: + branch: gh-pages + folder: target/doc