Skip to content

Commit

Permalink
Publish dev-docs with Github Pages artifacts (2nd attempt) (#10892)
Browse files Browse the repository at this point in the history
Supersedes #10888.

# Objective

Closes #10821

## Solution

- Replaced
[JamesIves/github-pages-deploy-action](https://github.com/JamesIves/github-pages-deploy-action)
with
[actions/upload-pages-artifact](https://github.com/actions/upload-pages-artifact)
and [actions/deploy-pages](https://github.com/actions/deploy-pages).

## Notes

- I made this workflow possible to run through dispatch
(`workflow_dispatch`), in case something goes wrong.
- I restricted the permissions to just the things Github Pages needs.
- I made it so that only one deployments can happen at a time, the other
deployment requests will be queued up and the latest one will be run.
  • Loading branch information
BD103 authored Jan 2, 2024
1 parent ab10e85 commit 1a2a184
Showing 1 changed file with 24 additions and 9 deletions.
33 changes: 24 additions & 9 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,30 @@ on:
branches:
- 'main'

# Allows running the action manually.
workflow_dispatch:

env:
CARGO_TERM_COLOR: always
RUSTDOCFLAGS: --html-in-header header.html

# 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

jobs:
build-and-deploy:
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -37,19 +54,17 @@ jobs:
# - 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
- name: Upload site artifact
uses: actions/upload-pages-artifact@v1
with:
branch: gh-pages
folder: target/doc
single-commit: true
force: true
path: target/doc

- name: Deploy to Github Pages
id: deployment
uses: actions/deploy-pages@v2

0 comments on commit 1a2a184

Please sign in to comment.