Skip to content

Commit 855c176

Browse files
committed
add script to prevent point releases with same number as existing ones
1 parent 74fbbef commit 855c176

File tree

3 files changed

+43
-0
lines changed

3 files changed

+43
-0
lines changed

.github/workflows/ci.yml

+9
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,9 @@ jobs:
128128
- name: ensure backported commits are in upstream branches
129129
run: src/ci/scripts/verify-backported-commits.sh
130130
if: success() && !env.SKIP_JOB
131+
- name: ensure the stable version number is correct
132+
run: src/ci/scripts/verify-stable-version-number.sh
133+
if: success() && !env.SKIP_JOB
131134
- name: run the build
132135
run: src/ci/scripts/run-build-from-ci.sh
133136
env:
@@ -502,6 +505,9 @@ jobs:
502505
- name: ensure backported commits are in upstream branches
503506
run: src/ci/scripts/verify-backported-commits.sh
504507
if: success() && !env.SKIP_JOB
508+
- name: ensure the stable version number is correct
509+
run: src/ci/scripts/verify-stable-version-number.sh
510+
if: success() && !env.SKIP_JOB
505511
- name: run the build
506512
run: src/ci/scripts/run-build-from-ci.sh
507513
env:
@@ -612,6 +618,9 @@ jobs:
612618
- name: ensure backported commits are in upstream branches
613619
run: src/ci/scripts/verify-backported-commits.sh
614620
if: success() && !env.SKIP_JOB
621+
- name: ensure the stable version number is correct
622+
run: src/ci/scripts/verify-stable-version-number.sh
623+
if: success() && !env.SKIP_JOB
615624
- name: run the build
616625
run: src/ci/scripts/run-build-from-ci.sh
617626
env:

src/ci/github-actions/ci.yml

+4
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,10 @@ x--expand-yaml-anchors--remove:
206206
run: src/ci/scripts/verify-backported-commits.sh
207207
<<: *step
208208

209+
- name: ensure the stable version number is correct
210+
run: src/ci/scripts/verify-stable-version-number.sh
211+
<<: *step
212+
209213
- name: run the build
210214
run: src/ci/scripts/run-build-from-ci.sh
211215
env:
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
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

0 commit comments

Comments
 (0)