Skip to content

Commit 9041e36

Browse files
committed
Allow special version names that don't match Cargo.toml
This permits names that start with `TEST-` or end with `-DO-NOT-USE`, printing a different "OK" message for them. The check comes after the comparison to the version in `Cargo.toml`, which is still always looked up, for three reasons: - Although it would be very weird and probably a bad idea to put a `-DO-NOT-USE` version in `Cargo.toml`, if it were ever done accidentally or on purpose, the message indicating a match to `Cargo.toml` should still be written. - Having code paths that are only exercised for actual releases and rarely or never in testing is likely to lead to bugs. - For looking it up and reporting it initially: this information is potentially valuable even when deliberately not used. This commit also makes two other changes in that same script step: - A custom message is now printed if the version is rejected only because it didn't have the "v" prefix (which this project's version tags and GitHub release names are using). - Stylistic adjustment, mostly to match the quoting style used throughout the workflow.
1 parent 15ca680 commit 9041e36

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

.github/workflows/release.yml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,22 @@ jobs:
4040
- name: Validate version against Cargo.toml
4141
run: |
4242
manifest_version="$(yq -r .package.version Cargo.toml)"
43-
echo "version to give the release: $VERSION"
43+
echo "version to name the release: $VERSION"
4444
echo "version Cargo.toml suggests: v$manifest_version"
4545
4646
case "$VERSION" in
47-
"v$manifest_version")
48-
echo "OK: Version to give the relase agrees with top-level Cargo.toml."
47+
"v$manifest_version" )
48+
echo 'OK: Version to name the relase agrees with top-level Cargo.toml.'
4949
;;
50-
*)
51-
echo "STOPPING: Version to give the release seems mistaken."
50+
TEST-* | *-DO-NOT-USE )
51+
echo 'OK: Version to name the release is strange but marked as such.'
52+
;;
53+
"$manifest_version" )
54+
echo 'STOPPING: Version to name the release is missing the leading "v".'
55+
exit 1
56+
;;
57+
* )
58+
echo 'STOPPING: Version to name the release seems mistaken.'
5259
exit 1
5360
;;
5461
esac

0 commit comments

Comments
 (0)