mirror of
https://github.com/rustls/rustls.git
synced 2026-10-29 02:07:14 +08:00
This will shortly be replaced with an API that can share more code with the high-level API.
98 lines
2.6 KiB
YAML
98 lines
2.6 KiB
YAML
name: documentation
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
pull_request:
|
|
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@v6
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- name: Install rust toolchain
|
|
uses: dtolnay/rust-toolchain@nightly
|
|
|
|
- name: Install zola
|
|
uses: taiki-e/install-action@v2
|
|
with:
|
|
tool: zola@0.19.1
|
|
|
|
- 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 brotli,hashbrown,log,zlib --no-deps --package rustls
|
|
env:
|
|
RUSTDOCFLAGS: -Dwarnings --cfg=rustls_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@v5
|
|
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/* target/website/
|
|
mv target/website/rustls target/website/docs
|
|
|
|
- name: Package and upload artifact
|
|
uses: actions/upload-pages-artifact@v4
|
|
with:
|
|
path: ./target/website/
|
|
|
|
deploy:
|
|
name: Deploy
|
|
runs-on: ubuntu-latest
|
|
if: github.repository == 'rustls/rustls' && github.ref == 'refs/heads/main'
|
|
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
|