name: GitHub Pages
on:
  push:
    branches:
      - master

jobs:
  docs:
    name: Generate master API documentation
    runs-on: ubuntu-latest
    env:
      RUSTDOCFLAGS: --cfg=nightly
    steps:
      - name: Checkout
        uses: actions/checkout@v6
      - name: Install nightly toolchain
        uses: dtolnay/rust-toolchain@stable
        with:
          toolchain: nightly
          components: rustfmt
      - name: Test
        run: cargo test --doc --all-features
      - name: Generate
        run: cargo doc --all --all-features
      - name: Publish
        uses: peaceiris/actions-gh-pages@v4
        with:
          deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }}
          force_orphan: true
          publish_branch: gh-pages
          publish_dir: ./target/doc
