From 52ff081f4296e4563a7a0e0d984b58663d3f0fe8 Mon Sep 17 00:00:00 2001 From: Casper Meijn Date: Mon, 27 May 2024 20:28:13 +0200 Subject: [PATCH] ci: Ensure both README are the same and prost version is correct (#1078) * ci: Ensure both README are the same and prost version is correct Fixes #1053 * docs: Update prost version in README * build: Fix prepare-release.sh for README --- .github/workflows/ci.yml | 13 +++++++++++++ README.md | 4 ++-- prepare-release.sh | 4 ++-- prost/README.md | 4 ++-- 4 files changed, 19 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fa25252c5..e6905ea42 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,6 +27,7 @@ jobs: - minimal-versions - kani - no-std + - check-readme steps: - run: exit 0 @@ -202,3 +203,15 @@ jobs: # prost's default features to compile. - name: prost-build check run: cargo check --manifest-path prost-build/Cargo.toml + + check-readme: + name: Check README + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Verify that both READMEs are identical + run: diff README.md prost/README.md + + - name: Verify that Prost version is up to date in README + working-directory: prost + run: grep -q "$(sed '/^version = /!d' Cargo.toml | head -n1)" README.md diff --git a/README.md b/README.md index 13f7259ff..9d3ae6144 100644 --- a/README.md +++ b/README.md @@ -380,9 +380,9 @@ the `std` features in `prost` and `prost-types`: ```ignore [dependencies] -prost = { version = "0.6", default-features = false, features = ["prost-derive"] } +prost = { version = "0.12.6", default-features = false, features = ["prost-derive"] } # Only necessary if using Protobuf well-known types: -prost-types = { version = "0.6", default-features = false } +prost-types = { version = "0.12.6", default-features = false } ``` Additionally, configure `prost-build` to output `BTreeMap`s instead of `HashMap`s diff --git a/prepare-release.sh b/prepare-release.sh index f4b774251..bd1ee9fdb 100755 --- a/prepare-release.sh +++ b/prepare-release.sh @@ -14,13 +14,13 @@ fi DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" VERSION="$1" -MINOR="$( echo ${VERSION} | cut -d\. -f1-2 )" VERSION_MATCHER="([a-z0-9\\.-]+)" PROST_CRATE_MATCHER="(prost|prost-[a-z]+)" # Update the README.md. -sed -i -E "s/${PROST_CRATE_MATCHER} = \"${VERSION_MATCHER}\"/\1 = \"${MINOR}\"/" "$DIR/README.md" +sed -i -E "s/version = \"${VERSION_MATCHER}\"/version = \"${VERSION}\"/" "$DIR/README.md" +sed -i -E "s/version = \"${VERSION_MATCHER}\"/version = \"${VERSION}\"/" "$DIR/prost/README.md" # Update html_root_url attributes. sed -i -E "s~html_root_url = \"https://docs\.rs/${PROST_CRATE_MATCHER}/$VERSION_MATCHER\"~html_root_url = \"https://docs.rs/\1/${VERSION}\"~" \ diff --git a/prost/README.md b/prost/README.md index 13f7259ff..9d3ae6144 100644 --- a/prost/README.md +++ b/prost/README.md @@ -380,9 +380,9 @@ the `std` features in `prost` and `prost-types`: ```ignore [dependencies] -prost = { version = "0.6", default-features = false, features = ["prost-derive"] } +prost = { version = "0.12.6", default-features = false, features = ["prost-derive"] } # Only necessary if using Protobuf well-known types: -prost-types = { version = "0.6", default-features = false } +prost-types = { version = "0.12.6", default-features = false } ``` Additionally, configure `prost-build` to output `BTreeMap`s instead of `HashMap`s