name: Document
on: [push, pull_request]
jobs:
  all:
    runs-on: ubuntu-latest
    concurrency:
      group: ${{ github.workflow }}-${{ github.ref }}
    steps:
    - uses: hecrj/setup-rust-action@v2
      with:
        rust-version: nightly-2026-02-20
    - uses: actions/checkout@v2
    - name: Generate documentation
      run: |
        RUSTDOCFLAGS="--cfg docsrs" \
          cargo doc --no-deps --all-features \
          -p futures-core \
          -p plushie-iced-beacon \
          -p plushie-iced-core \
          -p plushie-iced-debug \
          -p plushie-iced-devtools \
          -p plushie-iced-futures \
          -p plushie-iced-graphics \
          -p plushie-iced-highlighter \
          -p plushie-iced-renderer \
          -p plushie-iced-runtime \
          -p plushie-iced-tiny-skia \
          -p plushie-iced-wgpu \
          -p plushie-iced-widget \
          -p plushie-iced-winit \
          -p plushie-iced-test \
          -p plushie-iced
    - name: Copy redirect file as index.html
      run: cp docs/redirect.html target/doc/index.html
    - name: Publish documentation
      if: github.ref == 'refs/heads/master'
      uses: peaceiris/actions-gh-pages@v3
      with:
        deploy_key: ${{ secrets.DOCS_DEPLOY_KEY }}
        publish_dir: ./target/doc
