Add installer

This commit is contained in:
plyght 2025-02-10 13:13:59 -05:00
parent 1891d1763c
commit 21abd8f8f1
4 changed files with 48 additions and 3 deletions

BIN
.DS_Store vendored Normal file

Binary file not shown.

View file

@ -2,11 +2,14 @@ const std = @import("std");
const zine = @import("zine"); const zine = @import("zine");
pub fn build(b: *std.Build) !void { pub fn build(b: *std.Build) !void {
zine.website(b, .{ _ = zine.website(b, .{
.title = "Flow Editor", .title = "flow editor",
.host_url = "https://flow-editor.github.io", .host_url = "https://flow-editor.dev",
.content_dir_path = "content", .content_dir_path = "content",
.layouts_dir_path = "layouts", .layouts_dir_path = "layouts",
.assets_dir_path = "assets", .assets_dir_path = "assets",
}); });
const install_step = b.addInstallFile(b.path("install"), "install");
b.getInstallStep().dependOn(&install_step.step);
} }

42
install Normal file
View file

@ -0,0 +1,42 @@
#!/bin/sh
set -e
REPO="neurocyte/flow"
INSTALL_DIR="/usr/local/bin"
# detect os and architecture
OS="$(uname -s | tr '[:upper:]' '[:lower:]')"
if [ "$OS" = "darwin" ]; then
OS="macos"
fi
ARCH="$(uname -m)"
case "$ARCH" in
x86_64) ARCH="x86_64" ;;
arm64) ARCH="aarch64" ;;
esac
# get latest version tag from github releases api
VERSION=$(curl -s "https://api.github.com/repos/$REPO/releases/latest" | grep '"tag_name":' | cut -d'"' -f4)
[ -z "$VERSION" ] && { echo "failed to fetch latest version"; exit 1; }
# construct download url
FILENAME="flow-$VERSION-$OS-$ARCH"
EXT="tar.gz"
[ "$OS" = "windows" ] && EXT="zip"
URL="https://github.com/$REPO/releases/download/$VERSION/$FILENAME.$EXT"
echo "downloading flow $VERSION..."
curl -L "$URL" -o "/tmp/$FILENAME.$EXT"
echo "installing flow..."
if [ "$EXT" = "tar.gz" ]; then
tar -xzf "/tmp/$FILENAME.$EXT" -C "$INSTALL_DIR"
else
unzip -o "/tmp/$FILENAME.$EXT" -d "$INSTALL_DIR"
fi
chmod +x "$INSTALL_DIR/flow"
rm "/tmp/$FILENAME.$EXT"
echo "flow installed successfully!"

BIN
layouts/.DS_Store vendored Normal file

Binary file not shown.