Skip to content

Commit b689bd9

Browse files
authored
v0.1.0 (#1)
* v0.1.0 * prosewrap: preserve * fix gen hash * add dax
1 parent 35fdcb6 commit b689bd9

File tree

6 files changed

+172
-5
lines changed

6 files changed

+172
-5
lines changed

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
.zig-cache
2-
zig-out
2+
zig-out
3+
dist

build.zig.zon

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
.{
22
.name = "rb",
3-
.version = "0.0.0",
3+
.version = "0.1.0",
44
.minimum_zig_version = "0.13.0",
55
.dependencies = .{
66
.clap = .{

deno.json

+11-3
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,16 @@
44
"test": "zig test src/main.zig",
55
"fmt": "deno fmt && zig fmt src/**/*.zig",
66
"build": "zig build -Dtarget=x86_64-windows-msvc -Doptimize=ReleaseSmall",
7-
"release": "deno task build && powershell Compress-Archive -Path zig-out\\bin\\rb.exe -DestinationPath zig-out\\rb-x86_64-pc-windows-msvc.zip -Force",
8-
"check:hash": "certutil -hashfile zig-out\\rb-x86_64-pc-windows-msvc.zip SHA256"
7+
"release": "deno task build && deno run -A release.ts",
8+
"check:hash": "certutil -hashfile dist/rb-x86_64-pc-windows-msvc.zip SHA256"
99
},
10-
"exclude": ["README.md"]
10+
"imports": {
11+
"@david/dax": "jsr:@david/dax@^0.42.0",
12+
"@std/crypto": "jsr:@std/crypto@^1.0.3",
13+
"@std/encoding": "jsr:@std/encoding@^1.0.6",
14+
"z2j": "npm:[email protected]"
15+
},
16+
"fmt": {
17+
"proseWrap": "preserve"
18+
}
1119
}

deno.lock

+93
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rb.json

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"version": "0.1.0",
3+
"homepage": "https://github.com/ryuapp/rb",
4+
"license": "MIT",
5+
"architecture": {
6+
"64bit": {
7+
"url": "https://github.com/ryuapp/rb/releases/download/v0.1.0/rb-x86_64-pc-windows-msvc.zip",
8+
"hash": "22e9221e578f9a17027cc0f64338a0a661a185bb256511e54cee667a0e6dc11e"
9+
}
10+
},
11+
"bin": "rb.exe",
12+
"checkver": "github",
13+
"autoupdate": {
14+
"architecture": {
15+
"64bit": {
16+
"url": "https://github.com/ryuapp/rb/releases/download/v$version/rb-x86_64-pc-windows-msvc.zip"
17+
}
18+
}
19+
}
20+
}

release.ts

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import $ from "@david/dax";
2+
import { crypto } from "@std/crypto";
3+
import { encodeHex } from "@std/encoding/hex";
4+
import zonToJson from "z2j";
5+
6+
function loadBuildZigZon() {
7+
const zon = zonToJson(Deno.readTextFileSync("build.zig.zon"));
8+
return JSON.parse(zon);
9+
}
10+
11+
// zip the binary
12+
await $`powershell Compress-Archive -Path zig-out/bin/rb.exe -DestinationPath dist/rb-x86_64-pc-windows-msvc.zip -Force`;
13+
14+
const buildZigZon = loadBuildZigZon();
15+
const data = await Deno.readFile("dist/rb-x86_64-pc-windows-msvc.zip");
16+
const hash = encodeHex(await crypto.subtle.digest("SHA-256", data));
17+
18+
const scoopTemplate = {
19+
version: buildZigZon.version,
20+
homepage: "https://github.com/ryuapp/rb",
21+
license: "MIT",
22+
architecture: {
23+
"64bit": {
24+
url:
25+
`https://github.com/ryuapp/rb/releases/download/v${buildZigZon.version}/rb-x86_64-pc-windows-msvc.zip`,
26+
hash: hash,
27+
},
28+
},
29+
bin: "rb.exe",
30+
checkver: "github",
31+
autoupdate: {
32+
architecture: {
33+
"64bit": {
34+
url:
35+
"https://github.com/ryuapp/rb/releases/download/v$version/rb-x86_64-pc-windows-msvc.zip",
36+
},
37+
},
38+
},
39+
};
40+
41+
// update scoop config
42+
Deno.writeFileSync(
43+
"rb.json",
44+
new TextEncoder().encode(JSON.stringify(scoopTemplate, null, 2) + "\n"),
45+
);

0 commit comments

Comments
 (0)