55 lines
1.4 KiB
YAML
55 lines
1.4 KiB
YAML
name: gh-pages
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
pull_request:
|
|
release:
|
|
types: [published]
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
|
|
cancel-in-progress: true
|
|
|
|
env:
|
|
CARGO_TERM_COLOR: always
|
|
|
|
jobs:
|
|
guide-build:
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
tag_name: ${{ steps.prepare_tag.outputs.tag_name }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: dtolnay/rust-toolchain@nightly
|
|
|
|
- name: Setup mdBook
|
|
uses: taiki-e/install-action@v2
|
|
with:
|
|
tool: mdbook,lychee
|
|
|
|
- name: Prepare tag
|
|
id: prepare_tag
|
|
run: |
|
|
TAG_NAME="${GITHUB_REF##*/}"
|
|
echo "::set-output name=tag_name::${TAG_NAME}"
|
|
|
|
# This builds the book in target/guide/.
|
|
- name: Build the guide
|
|
run: |
|
|
python -m pip install --upgrade pip && pip install nox
|
|
nox -s check-guide
|
|
env:
|
|
PYO3_VERSION_TAG: ${{ steps.prepare_tag.outputs.tag_name }}
|
|
|
|
- name: Deploy docs and the guide
|
|
if: ${{ github.event_name == 'release' }}
|
|
uses: peaceiris/actions-gh-pages@v4
|
|
with:
|
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
publish_dir: ./target/guide/
|
|
destination_dir: ${{ steps.prepare_tag.outputs.tag_name }}
|
|
full_commit_message: "Upload documentation for ${{ steps.prepare_tag.outputs.tag_name }}"
|