Skip to content

Commit b593239

Browse files
committed
Upgrade Next section to distrib v0.3.0-beta
1 parent 4f5f0da commit b593239

3 files changed

Lines changed: 51 additions & 1 deletion

File tree

109 KB
Binary file not shown.

next/getting-started/hello-webgpu.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Hello WebGPU <span class="bullet">🟢</span>
44
```{lit-setup}
55
:tangle-root: 001 - Hello WebGPU - Next
66
:parent: 000 - Project setup - Next
7-
:fetch-files: ../../data/webgpu-distribution-v0.3.0-alpha.zip
7+
:fetch-files: ../../data/webgpu-distribution-v0.3.0-beta.zip
88
```
99

1010
*Resulting code:* [`step001-next`](https://github.com/eliemichel/LearnWebGPU-Code/tree/step001-next)
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
"""
2+
Usage:
3+
1. Update the VERSION_NAME below
4+
2. Download all artefacts from the CI run that you want to release
5+
3. Run this script from the directory where artefact zips were downloaded
6+
4. Release zips are in out/
7+
"""
8+
9+
import os
10+
import re
11+
from zipfile import ZipFile, ZipInfo
12+
import tarfile
13+
14+
VERSION_NAME = "7187"
15+
16+
release_filename_re = re.compile(r"Dawn-([^-]*)-(.*)-(Debug|Release)\.zip")
17+
18+
def main():
19+
for filename in os.listdir():
20+
if match := release_filename_re.match(filename):
21+
osname, arch = {
22+
"macos-13": ("macos", "x64"),
23+
"macos-latest": ("macos", "aarch64"),
24+
"ubuntu-latest": ("linux", "x64"),
25+
"windows-latest": ("windows", "x64"),
26+
}[match.groups()[1]]
27+
config = match.groups()[2]
28+
os.makedirs("out", exist_ok=True)
29+
destination = f"out/Dawn-{VERSION_NAME}-{osname}-{arch}-{config}.zip"
30+
print(f"Packaging '{destination}'...")
31+
processZip(filename, destination)
32+
33+
def processZip(filename, destination):
34+
with ZipFile(filename, 'r') as zf_in:
35+
[ tar_filename ] = zf_in.namelist()
36+
with zf_in.open(tar_filename) as tff:
37+
tf = tarfile.open(fileobj=tff)
38+
with ZipFile(destination, 'w') as zf_out:
39+
copyTarToZip(tf, zf_out)
40+
41+
def copyTarToZip(source_tar, destination_zip):
42+
for member in source_tar:
43+
if not member.isfile():
44+
continue
45+
zinfo = ZipInfo(filename=member.name.split("/", 1)[1])
46+
data = source_tar.extractfile(member).read()
47+
destination_zip.writestr(zinfo, data)
48+
49+
if __name__ == "__main__":
50+
main()

0 commit comments

Comments
 (0)