Skip to content

Commit 397aa40

Browse files
committed
release.sh: Fix docs.rs links in README.md and run semver-checks.
1 parent 05c7a1f commit 397aa40

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

release.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ check-changes () {
3131
}
3232
}
3333

34+
crate-names () {
35+
cargo metadata --format-version 1 --no-deps | jq -r '.packages[].name'
36+
}
37+
3438
auto-pr () {
3539
pr_url=$((gh pr view --json url,closed 2>/dev/null || true) \
3640
| jq -r 'select(.closed | not) | .url')
@@ -101,8 +105,23 @@ awk-in-place Cargo.toml '
101105
}
102106
{ print }'
103107
108+
# Fix docs.rs links in README, if present
109+
for name in $(crate-names) ; do
110+
awk-in-place README.md '{
111+
sub(/https:\/\/docs\.rs\/'"$name"'\/[0-9]+.[0-9]+.[0-9]+\//, \
112+
"https://docs.rs/'"$name"'/'$version'/")
113+
print
114+
}'
115+
done
116+
104117
cargo check --quiet
105118
119+
# Do semver checks only if there is a version on crates.io to compare to.
120+
# FIXME: can’t tell if crates.io search failed for another reason.
121+
if (cd / && cargo info "$(crate-names | head -1)" &>/dev/null) ; then
122+
cargo semver-checks || { echo ; confirm 'Release anyway?' ; }
123+
fi
124+
106125
awk-in-place CHANGELOG.md '
107126
/^## / && !done {
108127
$0 = "## Release '$version' ('$(date +%Y-%m-%d)')"

0 commit comments

Comments
 (0)