From 18e5da14c30be5f6b80039cb17b8df61f9caeb49 Mon Sep 17 00:00:00 2001 From: d34dscene Date: Thu, 13 Nov 2025 01:12:37 +0100 Subject: [PATCH] adjust archive --- .github/workflows/release.yaml | 6 ++++++ .goreleaser.yaml | 18 +++++++++++------- install.sh | 25 ++++++++----------------- 3 files changed, 25 insertions(+), 24 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 5781e2b..8c68912 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -33,6 +33,9 @@ jobs: with: go-version-file: "go.mod" + - name: Install Task + uses: go-task/setup-task@v1 + - name: Install UPX run: | sudo apt-get update @@ -46,6 +49,9 @@ jobs: with: upload-release-assets: false + - name: Install Ko + uses: ko-build/setup-ko@v0.9 + - name: Build frontend & lint run: | task build:web diff --git a/.goreleaser.yaml b/.goreleaser.yaml index d306508..8a746e0 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -23,8 +23,8 @@ builds: - -X github.com/mizuchilabs/mantrae/pkg/build.Date={{.Date}} goos: - linux - # - darwin - # - windows + - darwin + - windows goarch: - amd64 - arm64 @@ -69,6 +69,14 @@ kos: - linux/amd64 - linux/arm64 +sboms: + - cmd: syft + documents: + - "{{ .Binary }}_{{ .Os }}_{{ .Arch }}.sbom.json" + args: ["$artifact", "--output", "cyclonedx-json=$document"] + artifacts: binary + disable: false + upx: - enabled: true lzma: true @@ -84,11 +92,7 @@ release: mode: keep-existing archives: - - files: - - LICENSE - name_template: >- - {{ .Binary }}_{{ .Os }}_{{ .Arch }} - {{- if .Arm }}v{{ .Arm }}{{ end }} + - formats: ["binary"] snapshot: version_template: "{{ incpatch .Version }}-next" diff --git a/install.sh b/install.sh index 6877bb6..263aa23 100755 --- a/install.sh +++ b/install.sh @@ -12,7 +12,7 @@ binary="mantrae" # Downloads the latest release and moves it into ~/.local/bin main() { case "${1:-}" in - agent) binary="mantrae-agent" ;; + agent) binary="mantrae_agent" ;; uninstall) uninstall "${2:-}" exit 0 @@ -25,20 +25,21 @@ main() { latest=$(curl -fsSL "${REPO_API}/latest" | grep -o '"tag_name":.*' | cut -d '"' -f 4) case "$platform" in - Darwin) platform="macos" ;; + Darwin) platform="darwin" ;; Linux) platform="linux" ;; + MINGW* | MSYS* | CYGWIN*) platform="windows" ;; *) echo "Unsupported platform: $platform" && exit 1 ;; esac case "$arch" in arm64* | aarch64*) arch="arm64" ;; x86_64* | amd64*) arch="amd64" ;; - i?86*) arch="386" ;; *) echo "Unsupported architecture: $arch" && exit 1 ;; esac - # The filename matches goreleaser pattern: binary_platform_arch.tar.gz - filename="${binary}_${platform}_${arch}.tar.gz" + # The filename matches goreleaser binary format: binary_platform_arch + filename="${binary}_${platform}_${arch}" + [ "$platform" = "windows" ] && filename="${filename}.exe" url="${REPO}/${latest}/${filename}" echo "Downloading $filename from $url" @@ -50,17 +51,7 @@ main() { exit 1 fi - echo "Extracting archive..." - tar -xzf "$tempdir/$filename" -C "$tempdir" - - # Expect the extracted binary to have the same name - if [ ! -f "$tempdir/$binary" ]; then - echo "Error: $binary not found inside archive" - rm -rf "$tempdir" - exit 1 - fi - - install_binary "$tempdir/$binary" "$binary" + install_binary "$tempdir/$filename" "$binary" rm -rf "$tempdir" post_install "$binary" } @@ -103,7 +94,7 @@ uninstall() { case "$target" in mantrae | agent) binary="mantrae" - [ "$target" = "agent" ] && binary="mantrae-agent" + [ "$target" = "agent" ] && binary="mantrae_agent" bin_path="$HOME/.local/bin/$binary" if [ -f "$bin_path" ]; then echo "Removing $binary..."