mirror of
https://github.com/bevyengine/bevy
synced 2024-11-22 20:53:53 +00:00
dd7f800b25
# Objective Eliminate unnecessary Actions CI builds on forks, such as: - Daily builds, which are a waste of compute on forks, even if they succeed (although the Android build fails) - Administrative builds that attempt to deploy something In both the cases above, forks get CI failures that need to be ignored. It looks like this: <img width="1178" alt="image" src="https://github.com/bevyengine/bevy/assets/5838512/6365059a-1170-4bba-9c60-3e252ae7779f"> <img width="1186" alt="image" src="https://github.com/bevyengine/bevy/assets/5838512/ab824a0b-5202-42f7-a24f-95c5cd53376c"> ## Solution - [Only run some jobs when they are in the `bevyengine/bevy` repo.](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#example-only-run-job-for-specific-repository) - Leave the rest of the workflows alone (you still get a full set of CI for pull requests, for example) ---
55 lines
1.9 KiB
YAML
55 lines
1.9 KiB
YAML
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@v4
|
|
|
|
- name: Install Rust
|
|
uses: dtolnay/rust-toolchain@stable
|
|
|
|
- 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
|
|
|
|
# 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.bak "s/icon.png/icon-docs-dev.png/" src/lib.rs
|
|
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
|
|
if: github.repository == 'bevyengine/bevy'
|
|
uses: JamesIves/github-pages-deploy-action@v4
|
|
with:
|
|
branch: gh-pages
|
|
folder: target/doc
|
|
single-commit: true
|
|
force: true
|