Skip to content

Commit 494d4f1

Browse files
authored
🐛 fix: windows bin error (#11)
1 parent 11ceec3 commit 494d4f1

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

.github/workflows/release.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ jobs:
1818
- {"runner": "windows-latest", "os": "win", "target": "x86_64"}
1919
- {"runner": "windows-latest", "os": "win", "target": "arm64"}
2020
- {"runner": "windows-latest", "os": "win", "target": "i386"}
21-
- {"runner": "macos-latest", "os": "mac", "target": "x86_64"}
22-
- {"runner": "macos-latest", "os": "mac", "target": "arm64"}
21+
- {"runner": "macos-latest", "os": "macos", "target": "x86_64"}
22+
- {"runner": "macos-latest", "os": "macos", "target": "arm64"}
2323
steps:
2424
- name: Checkout
2525
uses: actions/checkout@v4
@@ -62,8 +62,8 @@ jobs:
6262
- {"runner": "windows-latest", "os": "win", "target": "x86_64"}
6363
- {"runner": "windows-latest", "os": "win", "target": "arm64"}
6464
- {"runner": "windows-latest", "os": "win", "target": "i386"}
65-
- {"runner": "macos-latest", "os": "mac", "target": "x86_64"}
66-
- {"runner": "macos-latest", "os": "mac", "target": "arm64"}
65+
- {"runner": "macos-latest", "os": "macos", "target": "x86_64"}
66+
- {"runner": "macos-latest", "os": "macos", "target": "arm64"}
6767
steps:
6868
- name: Retrieve release distributions
6969
uses: actions/download-artifact@v4
@@ -94,8 +94,8 @@ jobs:
9494
- {"runner": "windows-latest", "os": "win", "target": "x86_64"}
9595
- {"runner": "windows-latest", "os": "win", "target": "arm64"}
9696
- {"runner": "windows-latest", "os": "win", "target": "i386"}
97-
- {"runner": "macos-latest", "os": "mac", "target": "x86_64"}
98-
- {"runner": "macos-latest", "os": "mac", "target": "arm64"}
97+
- {"runner": "macos-latest", "os": "macos", "target": "x86_64"}
98+
- {"runner": "macos-latest", "os": "macos", "target": "arm64"}
9999
steps:
100100
- uses: actions/download-artifact@v4
101101
with:

hatch_build.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,15 @@ def initialize(self, version: str, build_data: dict[str, Any]) -> None:
5454

5555
# 解压缩文件
5656
with tarfile.open(tar_gz_file, "r:gz") as tar:
57-
assert self.BIN_NAME in tar.getnames()
58-
tar.extract(self.BIN_NAME, path=self.temp_dir)
57+
if target_os_info == "win":
58+
# Windows 上的文件名是 yamlfmt.exe
59+
assert f"{self.BIN_NAME}.exe" in tar.getnames()
60+
tar.extract(f"{self.BIN_NAME}.exe", path=self.temp_dir)
61+
# 重命名为 yamlfmt
62+
(self.temp_dir / f"{self.BIN_NAME}.exe").rename(self.temp_dir / self.BIN_NAME)
63+
else:
64+
assert self.BIN_NAME in tar.getnames()
65+
tar.extract(self.BIN_NAME, path=self.temp_dir)
5966

6067
# TODO: 加一个 sum 校验
6168
bin_path = self.temp_dir / self.BIN_NAME

0 commit comments

Comments
 (0)