Skip to content

Commit

Permalink
v0.1.0 (#1)
Browse files Browse the repository at this point in the history
* v0.1.0

* prosewrap: preserve

* fix gen hash

* add dax
  • Loading branch information
ryuapp authored Jan 29, 2025
1 parent 35fdcb6 commit b689bd9
Show file tree
Hide file tree
Showing 6 changed files with 172 additions and 5 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.zig-cache
zig-out
zig-out
dist
2 changes: 1 addition & 1 deletion build.zig.zon
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.{
.name = "rb",
.version = "0.0.0",
.version = "0.1.0",
.minimum_zig_version = "0.13.0",
.dependencies = .{
.clap = .{
Expand Down
14 changes: 11 additions & 3 deletions deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,16 @@
"test": "zig test src/main.zig",
"fmt": "deno fmt && zig fmt src/**/*.zig",
"build": "zig build -Dtarget=x86_64-windows-msvc -Doptimize=ReleaseSmall",
"release": "deno task build && powershell Compress-Archive -Path zig-out\\bin\\rb.exe -DestinationPath zig-out\\rb-x86_64-pc-windows-msvc.zip -Force",
"check:hash": "certutil -hashfile zig-out\\rb-x86_64-pc-windows-msvc.zip SHA256"
"release": "deno task build && deno run -A release.ts",
"check:hash": "certutil -hashfile dist/rb-x86_64-pc-windows-msvc.zip SHA256"
},
"exclude": ["README.md"]
"imports": {
"@david/dax": "jsr:@david/dax@^0.42.0",
"@std/crypto": "jsr:@std/crypto@^1.0.3",
"@std/encoding": "jsr:@std/encoding@^1.0.6",
"z2j": "npm:[email protected]"
},
"fmt": {
"proseWrap": "preserve"
}
}
93 changes: 93 additions & 0 deletions deno.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions rb.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"version": "0.1.0",
"homepage": "https://github.com/ryuapp/rb",
"license": "MIT",
"architecture": {
"64bit": {
"url": "https://github.com/ryuapp/rb/releases/download/v0.1.0/rb-x86_64-pc-windows-msvc.zip",
"hash": "22e9221e578f9a17027cc0f64338a0a661a185bb256511e54cee667a0e6dc11e"
}
},
"bin": "rb.exe",
"checkver": "github",
"autoupdate": {
"architecture": {
"64bit": {
"url": "https://github.com/ryuapp/rb/releases/download/v$version/rb-x86_64-pc-windows-msvc.zip"
}
}
}
}
45 changes: 45 additions & 0 deletions release.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import $ from "@david/dax";
import { crypto } from "@std/crypto";
import { encodeHex } from "@std/encoding/hex";
import zonToJson from "z2j";

function loadBuildZigZon() {
const zon = zonToJson(Deno.readTextFileSync("build.zig.zon"));
return JSON.parse(zon);
}

// zip the binary
await $`powershell Compress-Archive -Path zig-out/bin/rb.exe -DestinationPath dist/rb-x86_64-pc-windows-msvc.zip -Force`;

const buildZigZon = loadBuildZigZon();
const data = await Deno.readFile("dist/rb-x86_64-pc-windows-msvc.zip");
const hash = encodeHex(await crypto.subtle.digest("SHA-256", data));

const scoopTemplate = {
version: buildZigZon.version,
homepage: "https://github.com/ryuapp/rb",
license: "MIT",
architecture: {
"64bit": {
url:
`https://github.com/ryuapp/rb/releases/download/v${buildZigZon.version}/rb-x86_64-pc-windows-msvc.zip`,
hash: hash,
},
},
bin: "rb.exe",
checkver: "github",
autoupdate: {
architecture: {
"64bit": {
url:
"https://github.com/ryuapp/rb/releases/download/v$version/rb-x86_64-pc-windows-msvc.zip",
},
},
},
};

// update scoop config
Deno.writeFileSync(
"rb.json",
new TextEncoder().encode(JSON.stringify(scoopTemplate, null, 2) + "\n"),
);

0 comments on commit b689bd9

Please sign in to comment.