From 8eaa5039fe3fcbad001539562fe8ccd66c3bfe68 Mon Sep 17 00:00:00 2001 From: zjp Date: Thu, 24 Mar 2022 13:36:23 +0800 Subject: [PATCH 1/4] deploy docs on github pages --- .github/workflows/doc.sh | 7 +++++++ .github/workflows/doc.yml | 33 +++++++++++++++++++++++++++++++++ .gitignore | 1 + 3 files changed, 41 insertions(+) create mode 100644 .github/workflows/doc.sh create mode 100644 .github/workflows/doc.yml diff --git a/.github/workflows/doc.sh b/.github/workflows/doc.sh new file mode 100644 index 00000000..f6efd691 --- /dev/null +++ b/.github/workflows/doc.sh @@ -0,0 +1,7 @@ +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 +RUSTDOCFLAGS="--cfg docsrs" cargo doc --features use_neovim_lib --no-deps +mv target/doc/ doc/use_neovim_lib diff --git a/.github/workflows/doc.yml b/.github/workflows/doc.yml new file mode 100644 index 00000000..6bd090a9 --- /dev/null +++ b/.github/workflows/doc.yml @@ -0,0 +1,33 @@ +name: Doc-Deploy + +on: + push: + branches: [ master ] + pull_request: + 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 }} + publish_dir: ./doc + force_orphan: true + user_name: 'github-actions[bot]' + user_email: 'github-actions[bot]@users.noreply.github.com' + 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 From 0253cf48a6f0aaa31541a680422ee84817f240fd Mon Sep 17 00:00:00 2001 From: zjp Date: Sat, 26 Mar 2022 23:15:58 +0800 Subject: [PATCH 2/4] Use #![doc_auto_cfg] to simplify documenting features See: https://github.com/KillTheMule/nvim-rs/pull/40#issuecomment-1079697582 --- .github/workflows/doc.sh | 2 -- src/create/mod.rs | 1 - src/lib.rs | 5 ++--- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/.github/workflows/doc.sh b/.github/workflows/doc.sh index f6efd691..1393effd 100644 --- a/.github/workflows/doc.sh +++ b/.github/workflows/doc.sh @@ -3,5 +3,3 @@ 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 -RUSTDOCFLAGS="--cfg docsrs" cargo doc --features use_neovim_lib --no-deps -mv target/doc/ doc/use_neovim_lib 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; } From 4f06753401735763b1c7b688845026dae5502fd3 Mon Sep 17 00:00:00 2001 From: zjp Date: Sun, 27 Mar 2022 19:39:31 +0800 Subject: [PATCH 3/4] use deploy_key for doc deployment --- .github/workflows/doc.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/doc.yml b/.github/workflows/doc.yml index 6bd090a9..44deb262 100644 --- a/.github/workflows/doc.yml +++ b/.github/workflows/doc.yml @@ -1,4 +1,4 @@ -name: Doc-Deploy +name: Doc on: push: @@ -25,9 +25,10 @@ jobs: - name: Deploy uses: peaceiris/actions-gh-pages@v3 with: - github_token: ${{ secrets.GITHUB_TOKEN }} + # 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 - user_name: 'github-actions[bot]' - user_email: 'github-actions[bot]@users.noreply.github.com' commit_message: ${{ github.event.head_commit.message }} From 0b4d1131c9d5462570e30c4e69df544a25506749 Mon Sep 17 00:00:00 2001 From: zjp Date: Sat, 2 Apr 2022 00:32:20 +0800 Subject: [PATCH 4/4] make doc deployment not run on pull-request --- .github/workflows/doc.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/doc.yml b/.github/workflows/doc.yml index 44deb262..d28597e3 100644 --- a/.github/workflows/doc.yml +++ b/.github/workflows/doc.yml @@ -3,8 +3,6 @@ name: Doc on: push: branches: [ master ] - pull_request: - branches: [ master ] jobs: deploy: