Skip to content

Commit

Permalink
ci: Ensure both README are the same and prost version is correct (#1078)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
caspermeijn committed May 27, 2024
1 parent 4cbf941 commit 52ff081
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 6 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ jobs:
- minimal-versions
- kani
- no-std
- check-readme
steps:
- run: exit 0

Expand Down Expand Up @@ -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
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions prepare-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}\"~" \
Expand Down
4 changes: 2 additions & 2 deletions prost/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 52ff081

Please sign in to comment.