add: goreleaser

This commit is contained in:
2026-02-06 14:31:36 +08:00
parent 6ec897468f
commit 2a0f2901b4
17 changed files with 162 additions and 103 deletions

View File

@@ -21,7 +21,7 @@ tasks:
# 1. Cross-compiling from non-Linux, OR
# 2. No C compiler is available, OR
# 3. Target architecture differs from host architecture (cross-arch compilation)
- task: '{{if and (eq OS "linux") (eq .HAS_CC "true") (eq .TARGET_ARCH ARCH)}}build:native{{else}}build:docker{{end}}'
- task: '{{if and (eq OS "linux") (eq .HAS_CC "true") (eq .TARGET_ARCH ARCH)}}{{else}}build:docker{{end}}'
vars:
ARCH: "{{.ARCH}}"
DEV: "{{.DEV}}"
@@ -51,7 +51,9 @@ tasks:
cmds:
- go build {{.BUILD_FLAGS}} -o {{.OUTPUT}}
vars:
BUILD_FLAGS: '{{if eq .DEV "true"}}-buildvcs=false -gcflags=all="-l"{{else}}-tags production -trimpath -buildvcs=false -ldflags="-w -s"{{end}}'
VERSION:
sh: git describe --tags --always
BUILD_FLAGS: '{{if eq .DEV "true"}}-buildvcs=false -gcflags=all="-l"{{else}}-tags production -trimpath -buildvcs=false -ldflags="-w -s -X mesh-drop/internal/config.Version={{.VERSION}}"{{end}}'
DEFAULT_OUTPUT: "{{.BIN_DIR}}/{{.APP_NAME}}"
OUTPUT: "{{ .OUTPUT | default .DEFAULT_OUTPUT }}"
env:
@@ -59,16 +61,6 @@ tasks:
CGO_ENABLED: 1
GOARCH: "{{.ARCH | default ARCH}}"
build:prod:
summary: Builds the application natively on Linux
deps:
- task: build
cmds:
- upx --best --lzma {{.OUTPUT}}
vars:
DEFAULT_OUTPUT: "{{.BIN_DIR}}/{{.APP_NAME}}"
OUTPUT: "{{ .OUTPUT | default .DEFAULT_OUTPUT }}"
build:docker:
summary: Builds for Linux using Docker (for non-Linux hosts or when no C compiler available)
internal: true
@@ -181,13 +173,14 @@ tasks:
dir: build
cmds:
- mkdir -p {{.ROOT_DIR}}/build/linux/appimage
- wails3 generate .desktop -name "{{.APP_NAME}}" -exec "{{.EXEC}}" -icon "{{.ICON}}" -outputfile "{{.ROOT_DIR}}/build/linux/{{.APP_NAME}}.desktop" -categories "{{.CATEGORIES}}"
- wails3 generate .desktop -name "{{.APP_NAME}}" -exec "{{.EXEC}}" -icon "{{.ICON}}" -outputfile "{{.ROOT_DIR}}/build/linux/{{.APP_NAME}}.desktop" -categories "{{.CATEGORIES}}" -keywords "{{.KEYWORDS}}"
vars:
APP_NAME: "{{.APP_NAME}}"
EXEC: "{{.APP_NAME}}"
ICON: "{{.APP_NAME}}"
CATEGORIES: "Development;"
CATEGORIES: '{{.CATEGORIES | default .ENV.CATEGORIES | default "GTK;Utility"}}'
OUTPUTFILE: "{{.ROOT_DIR}}/build/linux/{{.APP_NAME}}.desktop"
KEYWORDS: '{{.KEYWORDS | default .ENV.KEYWORDS | default "utility"}}'
run:
cmds: