Skip to content

Commit 37fc28f

Browse files
Merge pull request #137 from kevinbackhouse/fmt
auto-format
2 parents f9d808c + e0b8b07 commit 37fc28f

File tree

24 files changed

+935
-866
lines changed

24 files changed

+935
-866
lines changed

release_tools/copy_files.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import sys
77
import subprocess
88

9+
910
def read_file_list(list_path):
1011
"""
1112
Reads a file containing file paths, ignoring empty lines and lines starting with '#'.
@@ -15,6 +16,7 @@ def read_file_list(list_path):
1516
lines = [line.strip() for line in f]
1617
return [line for line in lines if line and not line.startswith("#")]
1718

19+
1820
def copy_files(file_list, dest_dir):
1921
"""
2022
Copy files listed in file_list to dest_dir, preserving their relative paths.
@@ -29,6 +31,7 @@ def copy_files(file_list, dest_dir):
2931
shutil.copy2(abs_src, abs_dest)
3032
print(f"Copied {abs_src} -> {abs_dest}")
3133

34+
3235
def ensure_git_repo(dest_dir):
3336
"""
3437
Initializes a git repository in dest_dir if it's not already a git repo.
@@ -56,6 +59,7 @@ def ensure_git_repo(dest_dir):
5659
print(f"Failed to ensure 'main' branch in {dest_dir}: {e}")
5760
sys.exit(1)
5861

62+
5963
def git_add_files(file_list, dest_dir):
6064
"""
6165
Runs 'git add' on each file in file_list within dest_dir.
@@ -72,6 +76,7 @@ def git_add_files(file_list, dest_dir):
7276
finally:
7377
os.chdir(cwd)
7478

79+
7580
if __name__ == "__main__":
7681
if len(sys.argv) != 3:
7782
print("Usage: python copy_files.py <file_list.txt> <dest_dir>")

release_tools/publish_docker.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,31 +6,34 @@
66
import subprocess
77
import sys
88

9+
910
def get_image_digest(image_name, tag):
1011
result = subprocess.run(
1112
["docker", "buildx", "imagetools", "inspect", f"{image_name}:{tag}"],
12-
stdout=subprocess.PIPE, check=True, text=True
13+
stdout=subprocess.PIPE,
14+
check=True,
15+
text=True,
1316
)
1417
for line in result.stdout.splitlines():
1518
if line.strip().startswith("Digest:"):
1619
return line.strip().split(":", 1)[1].strip()
1720
return None
1821

22+
1923
def build_and_push_image(dest_dir, image_name, tag):
2024
# Build
21-
subprocess.run([
22-
"docker", "buildx", "build", "--platform", "linux/amd64", "-t", f"{image_name}:{tag}", dest_dir
23-
], check=True)
25+
subprocess.run(
26+
["docker", "buildx", "build", "--platform", "linux/amd64", "-t", f"{image_name}:{tag}", dest_dir], check=True
27+
)
2428
# Push
25-
subprocess.run([
26-
"docker", "push", f"{image_name}:{tag}"
27-
], check=True)
29+
subprocess.run(["docker", "push", f"{image_name}:{tag}"], check=True)
2830
print(f"Pushed {image_name}:{tag}")
2931
digest = get_image_digest(image_name, tag)
3032
print(f"Image digest: {digest}")
3133
with open("/tmp/digest.txt", "w") as f:
3234
f.write(digest)
3335

36+
3437
if __name__ == "__main__":
3538
if len(sys.argv) != 3:
3639
print("Usage: python build_and_publish_docker.py <ghcr_username/repo> <tag>")

0 commit comments

Comments
 (0)