diff --git a/.github/workflows/doc.sh b/.github/workflows/doc.sh new file mode 100644 index 00000000..1393effd --- /dev/null +++ b/.github/workflows/doc.sh @@ -0,0 +1,5 @@ +mkdir doc +RUSTDOCFLAGS="--cfg docsrs" cargo doc --features use_tokio --no-deps +mv target/doc/ doc/use_tokio +RUSTDOCFLAGS="--cfg docsrs" cargo doc --features use_async-std --no-deps +mv target/doc/ doc/use_async-std diff --git a/.github/workflows/doc.yml b/.github/workflows/doc.yml new file mode 100644 index 00000000..d28597e3 --- /dev/null +++ b/.github/workflows/doc.yml @@ -0,0 +1,32 @@ +name: Doc + +on: + push: + branches: [ master ] + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Install Rust + uses: actions-rs/toolchain@v1 + with: + toolchain: nightly + profile: minimal + override: true + + - name: Generate docs + run: sh .github/workflows/doc.sh + + - name: Deploy + uses: peaceiris/actions-gh-pages@v3 + with: + # github_token: ${{ secrets.GITHUB_TOKEN }} + # user_name: 'github-actions[bot]' + # user_email: 'github-actions[bot]@users.noreply.github.com' + deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }} + publish_dir: ./doc + force_orphan: true + commit_message: ${{ github.event.head_commit.message }} diff --git a/.gitignore b/.gitignore index 69369904..9bdfb5b8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ /target **/*.rs.bk Cargo.lock +/doc diff --git a/src/create/mod.rs b/src/create/mod.rs index aaeab4ae..eef9b176 100644 --- a/src/create/mod.rs +++ b/src/create/mod.rs @@ -11,7 +11,6 @@ //! E.g. when using the features `use_tokio`, you will need to run all the //! API functions from inside the tokio runtime. #[cfg(feature = "use_tokio")] -#[cfg_attr(docsrs, doc(cfg(feature = "use_tokio")))] pub mod tokio; #[cfg(feature = "use_async-std")] diff --git a/src/lib.rs b/src/lib.rs index 2888275d..a1b0f8c8 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -22,7 +22,7 @@ //! //! I've not yet worked through the details of what-to-export, but I'm quite //! willing to consider what people need or want. -#![cfg_attr(docsrs, feature(doc_cfg))] +#![cfg_attr(docsrs, feature(doc_auto_cfg))] extern crate rmp; extern crate rmpv; #[macro_use] @@ -48,9 +48,8 @@ pub use crate::{ }; #[cfg(feature = "use_tokio")] -#[cfg_attr(docsrs, doc(cfg(feature = "use_tokio")))] pub mod compat { - //! A re-export of tokio-util's [`Compat`](tokio_util::compat::Compat) + //! A re-export of tokio-util's [`Compat`](tokio_util::compat::Compat) pub mod tokio { pub use tokio_util::compat::Compat; }