]> git.lizzy.rs Git - rust.git/blob - src/ci/scripts/verify-stable-version-number.sh
Rollup merge of #107790 - tharunsuresh-code:snap_curl, r=jyn514
[rust.git] / src / ci / scripts / verify-stable-version-number.sh
1 #!/bin/bash
2 # On the stable channel, check whether we're trying to build artifacts with the
3 # same version number of a release that's already been published, and fail the
4 # build if that's the case.
5 #
6 # It's a mistake whenever that happens: the release process won't start if it
7 # detects a duplicate version number, and the artifacts would have to be
8 # rebuilt anyway.
9
10 set -euo pipefail
11 IFS=$'\n\t'
12
13 if [[ "$(cat src/ci/channel)" != "stable" ]]; then
14     echo "This script only works on the stable channel. Skipping the check."
15     exit 0
16 fi
17
18 version="$(cat src/version)"
19 url="https://static.rust-lang.org/dist/channel-rust-${version}.toml"
20
21 if curl --silent --fail "${url}" >/dev/null; then
22     echo "The version number ${version} matches an existing release."
23     echo
24     echo "If you're trying to prepare a point release, remember to change the"
25     echo "version number in the src/version file."
26     exit 1
27 else
28     echo "The version number ${version} does not match any released version!"
29     exit 0
30 fi