documentation #95
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: documentation | |
permissions: | |
contents: read | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
schedule: | |
- cron: '0 18 * * *' | |
jobs: | |
generate: | |
name: Generate pre-release documentation | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
- name: Install rust toolchain | |
uses: dtolnay/rust-toolchain@nightly | |
- name: Install zola | |
uses: taiki-e/install-action@v2 | |
with: | |
tool: [email protected] | |
- name: Generate version information | |
run: | | |
echo >tag.html \ | |
"<script>var version = document.querySelector(\"span.version\");" \ | |
"version.innerHTML += \"<br>(pre-release docs from <tt>$GITHUB_REF</tt>)\";" \ | |
"version.title = \"commit $GITHUB_SHA\";" \ | |
"</script>" | |
- name: cargo doc | |
# keep features in sync with Cargo.toml `[package.metadata.docs.rs]` section | |
run: cargo doc --locked --features read_buf,ring --no-deps --package rustls | |
env: | |
RUSTDOCFLAGS: -Dwarnings --cfg=docsrs --html-after-content tag.html | |
- name: Generate other pages | |
run: | | |
cd website && zola build --output-dir ../target/website/ | |
- name: Restore lychee cache | |
uses: actions/cache@v4 | |
with: | |
path: .lycheecache | |
key: cache-lychee-${{ github.sha }} | |
restore-keys: cache-lychee- | |
- name: Check links | |
uses: lycheeverse/lychee-action@v2 | |
with: | |
args: > | |
--accept 200..=204,403,429,500 | |
--cache | |
--max-cache-age 1d | |
--exclude-path 'website/content/' | |
'**/*.md' | |
'target/doc/**/*.html' | |
fail: true | |
- name: Massage rustdoc output | |
run: | | |
# lockfile causes deployment step to go wrong, due to permissions | |
rm -f target/doc/.lock | |
# move the result into website root | |
mv target/doc/rustls target/website/docs | |
- name: Package and upload artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: ./target/website/ | |
deploy: | |
name: Deploy | |
runs-on: ubuntu-latest | |
if: github.repository == 'rustls/rustls' | |
needs: generate | |
permissions: | |
pages: write | |
id-token: write | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |