diff --git a/packages/seaweedfs/brioche.lock b/packages/seaweedfs/brioche.lock new file mode 100644 index 0000000..b588ce1 --- /dev/null +++ b/packages/seaweedfs/brioche.lock @@ -0,0 +1,8 @@ +{ + "dependencies": {}, + "git_refs": { + "https://github.com/seaweedfs/seaweedfs.git": { + "3.82": "ca4dca14d8b92bc193477f1b97d95fb440f21b43" + } + } +} diff --git a/packages/seaweedfs/project.bri b/packages/seaweedfs/project.bri new file mode 100644 index 0000000..dcbd07b --- /dev/null +++ b/packages/seaweedfs/project.bri @@ -0,0 +1,51 @@ +import * as std from "std"; +import { goBuild } from "go"; +import { gitCheckout } from "git"; +import nushell from "nushell"; + +export const project = { + name: "seaweedfs", + version: "3.82", +}; + +const source = gitCheckout( + Brioche.gitRef({ + repository: "https://github.com/seaweedfs/seaweedfs.git", + ref: project.version, + }), +); + +export default function seaweedfs(): std.Recipe { + return goBuild({ + source, + path: "./weed", + runnable: "bin/weed", + }); +} + +export async function test() { + const recipe = std.runBash` + weed version | tee "$BRIOCHE_OUTPUT" + `.dependencies(seaweedfs()); + + const result = await recipe.toFile().read(); + std.assert(result.includes(` ${project.version} `)); + + return recipe; +} + +export async function autoUpdate() { + const src = std.file(std.indoc` + let version = http get https://api.github.com/repos/seaweedfs/seaweedfs/releases/latest + | get tag_name + + $env.project | from json | update version $version | to json + `); + + return std.withRunnable(std.directory(), { + command: "nu", + args: [src], + env: { project: JSON.stringify(project) }, + dependencies: [nushell()], + }); +}