Skip to content

Commit af70710

Browse files
authored
Fix release script (#459)
This switches to using the sparse index as reccomended by: https://crates.io/data-access#api Once merged, this should automatically release v0.14.12 (see #457). Signed-off-by: Joe Richey <joerichey@google.com>
1 parent f4d3dbb commit af70710

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

scripts/ci-release.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,20 @@
11
import json
22
import subprocess
33
import tomllib
4-
from urllib.request import urlopen
4+
import urllib.request
55

66
with open("Cargo.toml", "rb") as f:
77
cargo_toml = tomllib.load(f)
88
crate_version = cargo_toml["package"]["version"]
99
print("Detected crate version " + crate_version)
1010

11-
api_url = "https://crates.io/api/v1/crates/x86_64/" + crate_version
12-
version_data = json.loads(urlopen(api_url).read())
13-
14-
if "version" in version_data:
15-
version = version_data["version"]
16-
assert (version["crate"] == "x86_64")
17-
assert (version["num"] == crate_version)
18-
print("Version " + crate_version + " already exists on crates.io")
19-
11+
index_url = "https://index.crates.io/x8/6_/x86_64"
12+
for line in urllib.request.urlopen(index_url):
13+
version_info = json.loads(line)
14+
assert (version_info["name"] == "x86_64")
15+
if version_info["vers"] == crate_version:
16+
print("Version " + crate_version + " already exists on crates.io")
17+
break
2018
else:
2119
print("Could not find version " + crate_version +
2220
" on crates.io; creating a new release")

0 commit comments

Comments
 (0)