diff --git a/.gitignore b/.gitignore index ba8194a..fdbd31f 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,5 @@ bin frontend/dist frontend/node_modules build/linux/appimage/build -build/windows/nsis/MicrosoftEdgeWebview2Setup.exe \ No newline at end of file +build/windows/nsis/MicrosoftEdgeWebview2Setup.exe +dist \ No newline at end of file diff --git a/.goreleaser.yaml b/.goreleaser.yaml new file mode 100644 index 0000000..632e64d --- /dev/null +++ b/.goreleaser.yaml @@ -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 " + 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:" diff --git a/build.sh b/build.sh deleted file mode 100644 index 5b1a591..0000000 --- a/build.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -go-task linux:build -go-task windows:build -go-task linux:create:aur diff --git a/build/appicon.icon/Assets/wails_icon_vector.svg b/build/appicon.icon/Assets/wails_icon_vector.svg deleted file mode 100644 index b099222..0000000 --- a/build/appicon.icon/Assets/wails_icon_vector.svg +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/build/appicon.icon/icon.json b/build/appicon.icon/icon.json deleted file mode 100644 index ecf1849..0000000 --- a/build/appicon.icon/icon.json +++ /dev/null @@ -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" - } -} \ No newline at end of file diff --git a/build/linux/Taskfile.yml b/build/linux/Taskfile.yml index 7555ce3..e56049f 100644 --- a/build/linux/Taskfile.yml +++ b/build/linux/Taskfile.yml @@ -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: diff --git a/build/linux/appimage/mesh-drop b/build/linux/appimage/mesh-drop new file mode 100755 index 0000000..1b3285f Binary files /dev/null and b/build/linux/appimage/mesh-drop differ diff --git a/build/linux/appimage/mesh-drop.png b/build/linux/appimage/mesh-drop.png new file mode 100644 index 0000000..c5b11b9 Binary files /dev/null and b/build/linux/appimage/mesh-drop.png differ diff --git a/build/linux/desktop b/build/linux/desktop deleted file mode 100644 index 5d7deab..0000000 --- a/build/linux/desktop +++ /dev/null @@ -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 - - diff --git a/build/linux/mesh-drop.desktop b/build/linux/mesh-drop.desktop index 607a583..e9ba2c9 100755 --- a/build/linux/mesh-drop.desktop +++ b/build/linux/mesh-drop.desktop @@ -3,8 +3,8 @@ Type=Application Name=mesh-drop Exec=mesh-drop Icon=mesh-drop -Categories=Development; +Categories=GTK;FileTransfer;Utility; Terminal=false -Keywords=wails +Keywords=file transfer Version=1.0 StartupNotify=false diff --git a/build/windows/Taskfile.yml b/build/windows/Taskfile.yml index df416bb..cadd53e 100644 --- a/build/windows/Taskfile.yml +++ b/build/windows/Taskfile.yml @@ -46,20 +46,17 @@ tasks: platforms: [windows] - cmd: rm -f *.syso platforms: [linux, darwin] + - cmd: upx -t "{{.BIN_DIR}}/{{.APP_NAME}}.exe" || upx "{{.BIN_DIR}}/{{.APP_NAME}}.exe" + platforms: [linux] 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: GOOS: windows CGO_ENABLED: '{{.CGO_ENABLED | default "0"}}' 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: summary: Cross-compiles for Windows using Docker with Zig (for CGO builds on non-Windows) internal: true diff --git a/goreleaser/icon.ico b/goreleaser/icon.ico new file mode 100644 index 0000000..68167ed Binary files /dev/null and b/goreleaser/icon.ico differ diff --git a/goreleaser/icon.png b/goreleaser/icon.png new file mode 100644 index 0000000..c5b11b9 Binary files /dev/null and b/goreleaser/icon.png differ diff --git a/goreleaser/info.json b/goreleaser/info.json new file mode 100644 index 0000000..00437b6 --- /dev/null +++ b/goreleaser/info.json @@ -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" + } + } +} \ No newline at end of file diff --git a/goreleaser/mesh-drop.desktop b/goreleaser/mesh-drop.desktop new file mode 100755 index 0000000..94b5690 --- /dev/null +++ b/goreleaser/mesh-drop.desktop @@ -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 diff --git a/goreleaser/wails.exe.manifest b/goreleaser/wails.exe.manifest new file mode 100644 index 0000000..e2cd992 --- /dev/null +++ b/goreleaser/wails.exe.manifest @@ -0,0 +1,22 @@ + + + + + + + + + + + true/pm + permonitorv2,permonitor + + + + + + + + + + \ No newline at end of file diff --git a/internal/config/config.go b/internal/config/config.go index 8db96ed..e7e9c08 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -19,7 +19,7 @@ type WindowState struct { Maximised bool `mapstructure:"maximised"` } -const Version = "0.0.2" +var Version = "0.0.2" type Config struct { v *viper.Viper