Skip to content

Consider default-members when resolving the binary to run (#477) #146

Consider default-members when resolving the binary to run (#477)

Consider default-members when resolving the binary to run (#477) #146

Workflow file for this run

name: Docs
on:
push:
branches: [main]
# Only run when the `mdbook` docs are modified. The docs will be built, but will not be published
# to Github Pages.
pull_request:
paths:
- docs
workflow_dispatch:
inputs:
publish-website:
description: Publish the built website to Github Pages
required: true
type: boolean
# Only allow one deployment to run at a time, however do not cancel runs in progress.
concurrency:
group: pages
cancel-in-progress: false
env:
# Only include the debug info necessary for backtraces (file names and line numbers). Any extra
# debug info provided by `debuginfo=1` or `debuginfo=2` require an interactive debugger like
# `lldb` or `gdb`.
RUSTFLAGS: -C debuginfo=line-tables-only
jobs:
extract-rust-version:
name: Extract Rust version
uses: ./.github/workflows/extract-rust-version.yml
build-docs:
name: Build docs
runs-on: ubuntu-latest
needs: extract-rust-version
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ needs.extract-rust-version.outputs.channel }}
components: ${{ needs.extract-rust-version.outputs.components }}
- name: Cache build artifacts
uses: Swatinem/rust-cache@v2
with:
save-if: ${{ github.ref == 'refs/heads/main' }}
- name: Install `mdbook`
uses: taiki-e/install-action@v2
with:
tool: mdbook
# We cannot use `cargo-binstall` for this because the precompiled binary uses too old of an
# `mdbook` version, and it does't recognize the Rust 2024 edition. The installed binary will
# be cached, however.
- name: Install `mdbook-linkcheck`
run: cargo install mdbook-linkcheck
- name: Build `mdbook` docs
run: mdbook build
working-directory: docs
- name: Build API docs
# This alias calls `cargo rustdoc` with additional arguments, as specified by
# `.cargo/config.toml`.
run: |
cargo doc --package bevy_cli --lib --no-deps
cargo doc-lints -Z unstable-options --enable-index-page
- name: Merge docs
run: |
# Sometimes Github Pages fails to bundle and publish `rustdoc` websites due to the weird
# permissions of this file. Remove it, just in case.
rm --force target/doc/.lock
# Move the outputs of `rustdoc` into the `api` folder.
mkdir -p docs/book/html/api
mv target/doc/* docs/book/html/api
- name: Upload pages artifact
uses: actions/upload-pages-artifact@v3
with:
path: docs/book/html
deploy:
name: Deploy docs
# Only deploy docs if they are pushed to the `main` branch or the workflow dispatch toggles
# `publish-website`.
if: ${{ (github.event_name == 'push' && github.ref == 'refs/heads/main') || (github.event_name == 'workflow_dispatch' && inputs.publish-website) }}
runs-on: ubuntu-latest
needs: build-docs
environment:
name: github-pages
url: ${{ steps.deploy.outputs.page_url }}
# These are the permissions required to deploy websites to Github Pages.
permissions:
pages: write
id-token: write
steps:
- name: Deploy to Github Pages
id: deploy
uses: actions/deploy-pages@v4