Skip to content

ci: build from the lockfile, and prove the MSRV we print (#14) #15

ci: build from the lockfile, and prove the MSRV we print (#14)

ci: build from the lockfile, and prove the MSRV we print (#14) #15

Workflow file for this run

name: Docs
# Publishes https://rbx-forge.github.io/rbx-cli/ from `docs/`.
#
# The site is a rendering of that directory, not a copy of it: mdBook reads
# `docs/` in place (see `book.toml`), this workflow is the only thing that ever
# turns it into HTML, and nothing rendered is committed. So there is no second
# copy of any page to keep in sync, and no way for the site to describe a
# release the repository does not.
#
# One-time repository setting this depends on: Settings > Pages > Source must
# be "GitHub Actions". With the default "Deploy from a branch" the deploy step
# fails with a "Pages site not configured" error, and no amount of workflow
# permissions fixes it.
on:
push:
branches: [main]
# Build (without deploying) on PRs that touch the book. `create-missing` is
# off in book.toml, so a SUMMARY.md entry pointing at a file that does not
# exist is a build failure rather than an empty page nobody notices. Path
# filtered, because a Rust-only PR has no reason to rent a runner for this.
pull_request:
branches: [main]
paths:
- "docs/**"
- "book.toml"
- ".github/workflows/docs.yml"
workflow_dispatch:
# GITHUB_TOKEN starts read-only. `pages: write` is the deployment itself;
# `id-token: write` is how actions/deploy-pages proves to the Pages service
# that the artifact came from this run rather than from anywhere else.
permissions:
contents: read
pages: write
id-token: write
# One deployment at a time, and never cancel one in flight: a half-published
# artifact is a broken site. The opposite call from ci.yml, where cancelling a
# superseded test run costs nothing.
concurrency:
group: pages
cancel-in-progress: false
env:
# Pinned, not floating. mdBook is a build tool for this repository the same
# way the toolchain is, and a minor release changing how a page renders is
# not something a docs push should find out about. Bump deliberately, after
# running `mdbook build` locally on the new version.
MDBOOK_VERSION: 0.5.4
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
# Downloads the prebuilt mdBook release binary and caches it. `cargo
# install mdbook` would compile it from source on every run, which is
# minutes of runner time to render markdown that has not changed shape.
- uses: taiki-e/install-action@82cd3e7658a6f96c86c0234aeeda1748937cb0a1 # v2.85.13
with:
tool: mdbook@${{ env.MDBOOK_VERSION }}
- run: mdbook build
# The schemas ride along, served at
# https://rbx-forge.github.io/rbx-cli/schemas/<name>.schema.json
#
# Not decoration. The editor associations in README.md used to be written
# as relative paths — `schema.path = "schemas/rbxplace.schema.json"` —
# which only resolves if you have *this* repository checked out. The
# people the schemas exist for installed `rbx` through Rokit and have no
# `schemas/` directory anywhere, so the documented instructions did not
# work for the audience they were written for.
#
# Copied rather than symlinked, and copied *after* `mdbook build`, which
# writes `book/` from scratch and would take a pre-existing directory
# with it.
#
# This tracks `main`, which is right for an editor pointed at the tool
# you are developing against and wrong for a SchemaStore catalog entry —
# that is a public promise about a URL and wants a tag. See TODO.md.
- name: Publish the schemas alongside the book
run: cp -r schemas book/schemas
# Skipped on pull requests: a PR build exists to prove the book still
# builds, and must not be able to publish anything, least of all from a
# fork whose GITHUB_TOKEN is read-only anyway.
- if: github.event_name != 'pull_request'
uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5
with:
# Matches `[build] build-dir` in book.toml.
path: book
deploy:
name: Deploy
if: github.event_name != 'pull_request'
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- id: deployment
uses: actions/deploy-pages@cd2ce8fcbc39b97be8ca5fce6e763baed58fa128 # v5