Skip to content

Commit 22066fa

Browse files
authored
Merge pull request #421 from rust-osdev/release_action
Don't use third-party Python libraries in release workflow
2 parents d2c6dce + 20eff17 commit 22066fa

File tree

3 files changed

+13
-12
lines changed

3 files changed

+13
-12
lines changed

.github/workflows/release.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ jobs:
1919

2020
steps:
2121
- name: "Checkout Repository"
22-
uses: actions/checkout@v1
22+
uses: actions/checkout@v3
2323

24-
- name: "Install Python Libraries"
25-
run: python -m pip install --user -r requirements.txt
26-
working-directory: "scripts"
24+
# TODO: Remove when Python 3.11 is the default on the Gihtub Actions image
25+
- name: "Install Python 3.11"
26+
run: sudo apt-get -y install python3.11
2727

2828
- name: "Run release script"
29-
run: "python3 scripts/ci-release.py"
29+
run: "python3.11 scripts/ci-release.py"
3030
env:
3131
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
3232
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

scripts/ci-release.py

+8-6
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
1-
import toml
2-
import requests
1+
import json
32
import subprocess
3+
import tomllib
4+
from urllib.request import urlopen
45

5-
cargo_toml = toml.load("Cargo.toml")
6+
with open("Cargo.toml", "rb") as f:
7+
cargo_toml = tomllib.load(f)
68
crate_version = cargo_toml["package"]["version"]
79
print("Detected crate version " + crate_version)
810

911
api_url = "https://crates.io/api/v1/crates/x86_64/" + crate_version
10-
released_version = requests.get(api_url).json()
12+
version_data = json.loads(urlopen(api_url).read())
1113

12-
if "version" in released_version:
13-
version = released_version["version"]
14+
if "version" in version_data:
15+
version = version_data["version"]
1416
assert (version["crate"] == "x86_64")
1517
assert (version["num"] == crate_version)
1618
print("Version " + crate_version + " already exists on crates.io")

scripts/requirements.txt

-1
This file was deleted.

0 commit comments

Comments
 (0)