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

3
.gitignore vendored
View File

@@ -3,4 +3,5 @@ bin
frontend/dist frontend/dist
frontend/node_modules frontend/node_modules
build/linux/appimage/build build/linux/appimage/build
build/windows/nsis/MicrosoftEdgeWebview2Setup.exe build/windows/nsis/MicrosoftEdgeWebview2Setup.exe
dist

98
.goreleaser.yaml Normal file
View File

@@ -0,0 +1,98 @@
version: 2
project_name: mesh-drop
before:
hooks:
- go mod tidy
- wails3 generate bindings -ts
- sh -c 'cd frontend && npm run build'
- wails3 generate .desktop -name "{{.ProjectName}}" -exec "{{.ProjectName}}" -icon "{{.ProjectName}}.png" -outputfile "goreleaser/{{.ProjectName}}.desktop" -categories "Network;FileTransfer;" -keywords "mesh,transfer,file,network,drop"
builds:
- id: linux-amd64
binary: mesh-drop
goos:
- linux
goarch:
- amd64
env:
- CGO_ENABLED=1
flags:
- -tags
- production
- -trimpath
ldflags:
- -s -w -X mesh-drop/internal/config.Version={{ .Version }}
- id: windows-amd64
binary: mesh-drop
goos:
- windows
goarch:
- amd64
env:
- CGO_ENABLED=1
flags:
- -tags
- production
- -trimpath
ldflags:
- -s -w -H windowsgui -X mesh-drop/internal/config.Version={{ .Version }}
hooks:
pre:
- "wails3 generate icons -input goreleaser/icon.png -windowsfilename goreleaser/icon.ico"
- "wails3 generate syso -arch amd64 -icon goreleaser/icon.ico -manifest goreleaser/wails.exe.manifest -info goreleaser/info.json -out goreleaser/wails_windows_amd64.syso"
post: "rm -f goreleaser/wails_windows_amd64.syso"
archives:
- formats: ["tar.gz"]
format_overrides:
- goos: windows
formats: ["zip"]
nfpms:
- id: default
package_name: mesh-drop
vendor: "nite"
homepage: "https://www.nite07.com"
maintainer: "Nite <nite@nite07.com>"
description: "A mesh-drop application"
license: "MIT"
formats:
- deb
- rpm
- archlinux
contents:
- src: "goreleaser/icon.png"
dst: "/usr/share/icons/hicolor/128x128/apps/mesh-drop.png"
- src: "build/linux/mesh-drop.desktop"
dst: "/usr/share/applications/mesh-drop.desktop"
dependencies:
- libgtk-3-0
- libwebkit2gtk-4.1-0
overrides:
rpm:
dependencies:
- gtk3
- webkit2gtk4.1
archlinux:
dependencies:
- gtk3
- webkit2gtk-4.1
checksum:
name_template: "checksums.txt"
snapshot:
version_template: "{{ .Tag }}-{{ .ShortCommit }}"
changelog:
sort: asc
filters:
exclude:
- "^docs:"
- "^test:"

View File

@@ -1,4 +0,0 @@
#!/bin/bash
go-task linux:build
go-task windows:build
go-task linux:create:aur

View File

@@ -1,9 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="100%" height="100%" viewBox="0 0 583 533" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;">
<g transform="matrix(1,0,0,1,-246,-251)">
<g id="Ebene1">
<path d="M246,251L265,784L401,784L506,450L507,450L505,784L641,784L829,251L682,251L596,567L595,567L596,251L478,251L378,568L391,251L246,251Z"/>
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 698 B

View File

@@ -1,51 +0,0 @@
{
"fill" : {
"automatic-gradient" : "extended-gray:1.00000,1.00000"
},
"groups" : [
{
"layers" : [
{
"fill-specializations" : [
{
"appearance" : "dark",
"value" : {
"solid" : "srgb:0.92143,0.92145,0.92144,1.00000"
}
},
{
"appearance" : "tinted",
"value" : {
"solid" : "srgb:0.83742,0.83744,0.83743,1.00000"
}
}
],
"image-name" : "wails_icon_vector.svg",
"name" : "wails_icon_vector",
"position" : {
"scale" : 1.25,
"translation-in-points" : [
36.890625,
4.96875
]
}
}
],
"shadow" : {
"kind" : "neutral",
"opacity" : 0.5
},
"specular" : true,
"translucency" : {
"enabled" : true,
"value" : 0.5
}
}
],
"supported-platforms" : {
"circles" : [
"watchOS"
],
"squares" : "shared"
}
}

View File

@@ -21,7 +21,7 @@ tasks:
# 1. Cross-compiling from non-Linux, OR # 1. Cross-compiling from non-Linux, OR
# 2. No C compiler is available, OR # 2. No C compiler is available, OR
# 3. Target architecture differs from host architecture (cross-arch compilation) # 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: vars:
ARCH: "{{.ARCH}}" ARCH: "{{.ARCH}}"
DEV: "{{.DEV}}" DEV: "{{.DEV}}"
@@ -51,7 +51,9 @@ tasks:
cmds: cmds:
- go build {{.BUILD_FLAGS}} -o {{.OUTPUT}} - go build {{.BUILD_FLAGS}} -o {{.OUTPUT}}
vars: 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}}" DEFAULT_OUTPUT: "{{.BIN_DIR}}/{{.APP_NAME}}"
OUTPUT: "{{ .OUTPUT | default .DEFAULT_OUTPUT }}" OUTPUT: "{{ .OUTPUT | default .DEFAULT_OUTPUT }}"
env: env:
@@ -59,16 +61,6 @@ tasks:
CGO_ENABLED: 1 CGO_ENABLED: 1
GOARCH: "{{.ARCH | default ARCH}}" 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: build:docker:
summary: Builds for Linux using Docker (for non-Linux hosts or when no C compiler available) summary: Builds for Linux using Docker (for non-Linux hosts or when no C compiler available)
internal: true internal: true
@@ -181,13 +173,14 @@ tasks:
dir: build dir: build
cmds: cmds:
- mkdir -p {{.ROOT_DIR}}/build/linux/appimage - 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: vars:
APP_NAME: "{{.APP_NAME}}" APP_NAME: "{{.APP_NAME}}"
EXEC: "{{.APP_NAME}}" EXEC: "{{.APP_NAME}}"
ICON: "{{.APP_NAME}}" ICON: "{{.APP_NAME}}"
CATEGORIES: "Development;" CATEGORIES: '{{.CATEGORIES | default .ENV.CATEGORIES | default "GTK;Utility"}}'
OUTPUTFILE: "{{.ROOT_DIR}}/build/linux/{{.APP_NAME}}.desktop" OUTPUTFILE: "{{.ROOT_DIR}}/build/linux/{{.APP_NAME}}.desktop"
KEYWORDS: '{{.KEYWORDS | default .ENV.KEYWORDS | default "utility"}}'
run: run:
cmds: cmds:

BIN
build/linux/appimage/mesh-drop Executable file

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

View File

@@ -1,13 +0,0 @@
[Desktop Entry]
Version=1.0
Name=MeshDrop
Comment=A mesh-drop application
# The Exec line includes %u to pass the URL to the application
Exec=/usr/local/bin/mesh-drop %u
Terminal=false
Type=Application
Icon=mesh-drop
Categories=Utility;
StartupWMClass=mesh-drop

View File

@@ -3,8 +3,8 @@ Type=Application
Name=mesh-drop Name=mesh-drop
Exec=mesh-drop Exec=mesh-drop
Icon=mesh-drop Icon=mesh-drop
Categories=Development; Categories=GTK;FileTransfer;Utility;
Terminal=false Terminal=false
Keywords=wails Keywords=file transfer
Version=1.0 Version=1.0
StartupNotify=false StartupNotify=false

View File

@@ -46,20 +46,17 @@ tasks:
platforms: [windows] platforms: [windows]
- cmd: rm -f *.syso - cmd: rm -f *.syso
platforms: [linux, darwin] platforms: [linux, darwin]
- cmd: upx -t "{{.BIN_DIR}}/{{.APP_NAME}}.exe" || upx "{{.BIN_DIR}}/{{.APP_NAME}}.exe"
platforms: [linux]
vars: vars:
BUILD_FLAGS: '{{if eq .DEV "true"}}-buildvcs=false -gcflags=all="-l"{{else}}-tags production -trimpath -buildvcs=false -ldflags="-w -s -H windowsgui"{{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 -H windowsgui -X mesh-drop/internal/config.Version={{.VERSION}}"{{end}}'
env: env:
GOOS: windows GOOS: windows
CGO_ENABLED: '{{.CGO_ENABLED | default "0"}}' CGO_ENABLED: '{{.CGO_ENABLED | default "0"}}'
GOARCH: "{{.ARCH | default ARCH}}" GOARCH: "{{.ARCH | default ARCH}}"
build:prod:
summary: Builds the application for Windows
deps:
- task: build
cmds:
- upx --best --lzma "{{.BIN_DIR}}/{{.APP_NAME}}.exe"
build:docker: build:docker:
summary: Cross-compiles for Windows using Docker with Zig (for CGO builds on non-Windows) summary: Cross-compiles for Windows using Docker with Zig (for CGO builds on non-Windows)
internal: true internal: true

BIN
goreleaser/icon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

BIN
goreleaser/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

15
goreleaser/info.json Normal file
View File

@@ -0,0 +1,15 @@
{
"fixed": {
"file_version": "0.1.0"
},
"info": {
"0000": {
"ProductVersion": "0.1.0",
"CompanyName": "Nite",
"FileDescription": "A mesh-drop application",
"LegalCopyright": "© 2026, Nite",
"ProductName": "Nite",
"Comments": "A mesh-drop application"
}
}
}

10
goreleaser/mesh-drop.desktop Executable file
View File

@@ -0,0 +1,10 @@
[Desktop Entry]
Type=Application
Name=mesh-drop
Exec=mesh-drop
Icon=mesh-drop.png
Categories=Network;FileTransfer;
Terminal=false
Keywords=mesh,transfer,file,network,drop
Version=1.0
StartupNotify=false

View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
<assemblyIdentity type="win32" name="com.nite07.meshdrop" version="0.1.0" processorArchitecture="*"/>
<dependency>
<dependentAssembly>
<assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="*" publicKeyToken="6595b64144ccf1df" language="*"/>
</dependentAssembly>
</dependency>
<asmv3:application>
<asmv3:windowsSettings>
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true/pm</dpiAware> <!-- fallback for Windows 7 and 8 -->
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">permonitorv2,permonitor</dpiAwareness> <!-- falls back to per-monitor if per-monitor v2 is not supported -->
</asmv3:windowsSettings>
</asmv3:application>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="asInvoker" uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
</assembly>

View File

@@ -19,7 +19,7 @@ type WindowState struct {
Maximised bool `mapstructure:"maximised"` Maximised bool `mapstructure:"maximised"`
} }
const Version = "0.0.2" var Version = "0.0.2"
type Config struct { type Config struct {
v *viper.Viper v *viper.Viper