From b244b926f2b99abce0773922c6a06f48e059f97e Mon Sep 17 00:00:00 2001 From: flip1995 Date: Sun, 17 Apr 2022 21:18:10 +0200 Subject: [PATCH] Deploy Clippy book through CI/CD --- .github/deploy.sh | 5 ++++- .github/workflows/deploy.yml | 9 +++++++++ CONTRIBUTING.md | 3 +-- util/versions.py | 2 +- 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/.github/deploy.sh b/.github/deploy.sh index 5a59f94ec918..8a9972e487f0 100644 --- a/.github/deploy.sh +++ b/.github/deploy.sh @@ -3,7 +3,7 @@ set -ex echo "Removing the current docs for master" -rm -rf out/master/ || exit 0 +rm -rf out/master/ out/book/ || exit 0 echo "Making the docs for master" mkdir out/master/ @@ -29,6 +29,9 @@ cp util/gh-pages/versions.html out/index.html echo "Making the versions.json file" python3 ./util/versions.py out +# Copying the book +mv book/book out + # Now let's go have some fun with the cloned repo cd out git config user.name "GHA CI" diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 71d71d10359e..c5a9d7d32872 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -29,6 +29,12 @@ jobs: ref: ${{ env.TARGET_BRANCH }} path: 'out' + - name: Install mdbook + run: | + mkdir mdbook + curl -Lf https://github.com/rust-lang/mdBook/releases/download/v0.4.18/mdbook-v0.4.18-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=./mdbook + echo `pwd`/mdbook >> $GITHUB_PATH + # Run - name: Set tag name if: startswith(github.ref, 'refs/tags/') @@ -57,6 +63,9 @@ jobs: - name: cargo collect-metadata run: cargo collect-metadata + - name: Build book + run: mdbook build book + - name: Deploy run: | eval "$(ssh-agent -s)" diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e81e7ceedcb5..899dc907b782 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -33,8 +33,7 @@ All contributors are expected to follow the [Rust Code of Conduct]. If you're new to Clippy and don't know where to start the [Clippy book] includes a developer guide and is a good place to start your journey. - -[Clippy book]: book/src +[Clippy book]: https://rust-lang.github.io/rust-clippy/book/index.html ## High level approach diff --git a/util/versions.py b/util/versions.py index 0cfa007d1b27..3fe65d9588c3 100755 --- a/util/versions.py +++ b/util/versions.py @@ -31,7 +31,7 @@ def main(): outdir = sys.argv[1] versions = [ - dir for dir in os.listdir(outdir) if not dir.startswith(".") and os.path.isdir(os.path.join(outdir, dir)) + dir for dir in os.listdir(outdir) if not dir.startswith(".") and dir != "book" and os.path.isdir(os.path.join(outdir, dir)) ] versions.sort(key=key)