adjust archive

This commit is contained in:
d34dscene
2025-11-13 01:12:37 +01:00
parent 28ec27a6d2
commit 18e5da14c3
3 changed files with 25 additions and 24 deletions

View File

@@ -33,6 +33,9 @@ jobs:
with: with:
go-version-file: "go.mod" go-version-file: "go.mod"
- name: Install Task
uses: go-task/setup-task@v1
- name: Install UPX - name: Install UPX
run: | run: |
sudo apt-get update sudo apt-get update
@@ -46,6 +49,9 @@ jobs:
with: with:
upload-release-assets: false upload-release-assets: false
- name: Install Ko
uses: ko-build/setup-ko@v0.9
- name: Build frontend & lint - name: Build frontend & lint
run: | run: |
task build:web task build:web

View File

@@ -23,8 +23,8 @@ builds:
- -X github.com/mizuchilabs/mantrae/pkg/build.Date={{.Date}} - -X github.com/mizuchilabs/mantrae/pkg/build.Date={{.Date}}
goos: goos:
- linux - linux
# - darwin - darwin
# - windows - windows
goarch: goarch:
- amd64 - amd64
- arm64 - arm64
@@ -69,6 +69,14 @@ kos:
- linux/amd64 - linux/amd64
- linux/arm64 - linux/arm64
sboms:
- cmd: syft
documents:
- "{{ .Binary }}_{{ .Os }}_{{ .Arch }}.sbom.json"
args: ["$artifact", "--output", "cyclonedx-json=$document"]
artifacts: binary
disable: false
upx: upx:
- enabled: true - enabled: true
lzma: true lzma: true
@@ -84,11 +92,7 @@ release:
mode: keep-existing mode: keep-existing
archives: archives:
- files: - formats: ["binary"]
- LICENSE
name_template: >-
{{ .Binary }}_{{ .Os }}_{{ .Arch }}
{{- if .Arm }}v{{ .Arm }}{{ end }}
snapshot: snapshot:
version_template: "{{ incpatch .Version }}-next" version_template: "{{ incpatch .Version }}-next"

View File

@@ -12,7 +12,7 @@ binary="mantrae"
# Downloads the latest release and moves it into ~/.local/bin # Downloads the latest release and moves it into ~/.local/bin
main() { main() {
case "${1:-}" in case "${1:-}" in
agent) binary="mantrae-agent" ;; agent) binary="mantrae_agent" ;;
uninstall) uninstall)
uninstall "${2:-}" uninstall "${2:-}"
exit 0 exit 0
@@ -25,20 +25,21 @@ main() {
latest=$(curl -fsSL "${REPO_API}/latest" | grep -o '"tag_name":.*' | cut -d '"' -f 4) latest=$(curl -fsSL "${REPO_API}/latest" | grep -o '"tag_name":.*' | cut -d '"' -f 4)
case "$platform" in case "$platform" in
Darwin) platform="macos" ;; Darwin) platform="darwin" ;;
Linux) platform="linux" ;; Linux) platform="linux" ;;
MINGW* | MSYS* | CYGWIN*) platform="windows" ;;
*) echo "Unsupported platform: $platform" && exit 1 ;; *) echo "Unsupported platform: $platform" && exit 1 ;;
esac esac
case "$arch" in case "$arch" in
arm64* | aarch64*) arch="arm64" ;; arm64* | aarch64*) arch="arm64" ;;
x86_64* | amd64*) arch="amd64" ;; x86_64* | amd64*) arch="amd64" ;;
i?86*) arch="386" ;;
*) echo "Unsupported architecture: $arch" && exit 1 ;; *) echo "Unsupported architecture: $arch" && exit 1 ;;
esac esac
# The filename matches goreleaser pattern: binary_platform_arch.tar.gz # The filename matches goreleaser binary format: binary_platform_arch
filename="${binary}_${platform}_${arch}.tar.gz" filename="${binary}_${platform}_${arch}"
[ "$platform" = "windows" ] && filename="${filename}.exe"
url="${REPO}/${latest}/${filename}" url="${REPO}/${latest}/${filename}"
echo "Downloading $filename from $url" echo "Downloading $filename from $url"
@@ -50,17 +51,7 @@ main() {
exit 1 exit 1
fi fi
echo "Extracting archive..." install_binary "$tempdir/$filename" "$binary"
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"
rm -rf "$tempdir" rm -rf "$tempdir"
post_install "$binary" post_install "$binary"
} }
@@ -103,7 +94,7 @@ uninstall() {
case "$target" in case "$target" in
mantrae | agent) mantrae | agent)
binary="mantrae" binary="mantrae"
[ "$target" = "agent" ] && binary="mantrae-agent" [ "$target" = "agent" ] && binary="mantrae_agent"
bin_path="$HOME/.local/bin/$binary" bin_path="$HOME/.local/bin/$binary"
if [ -f "$bin_path" ]; then if [ -f "$bin_path" ]; then
echo "Removing $binary..." echo "Removing $binary..."