version: '3' includes: common: ../Taskfile.yml vars: # Signing configuration - edit these values for your project # PGP_KEY: "path/to/signing-key.asc" # SIGN_ROLE: "builder" # Options: origin, maint, archive, builder # # Password is stored securely in system keychain. Run: wails3 setup signing tasks: build: summary: Builds the application for Linux # MPCkit builds on each system natively; there is no Docker cross-build. # The experimental CGO-free backend (-tags purego) uses the Go toolchain # directly on every host; a cgo build needs Linux, a C compiler and the # same architecture. preconditions: - sh: '{{if or (ne .CGO_ENABLED "1") (and (eq OS "linux") (eq .HAS_CC "true") (eq .TARGET_ARCH ARCH))}}true{{else}}false{{end}}' msg: "The Linux app must be built on Linux, with gcc or clang, for the same architecture." cmds: - task: build:native vars: ARCH: '{{.ARCH}}' DEV: '{{.DEV}}' OUTPUT: '{{.OUTPUT}}' EXTRA_TAGS: '{{.EXTRA_TAGS}}' OBFUSCATED: '{{.OBFUSCATED}}' GARBLE_ARGS: '{{.GARBLE_ARGS}}' CGO_ENABLED: '{{.CGO_ENABLED}}' vars: DEFAULT_OUTPUT: '{{.BIN_DIR}}/{{.APP_NAME}}' OUTPUT: '{{ .OUTPUT | default .DEFAULT_OUTPUT }}' # Determine target architecture (defaults to host ARCH if not specified) TARGET_ARCH: '{{.ARCH | default ARCH}}' CGO_ENABLED: '{{.CGO_ENABLED | default (ternary "0" "1" (has "purego" (splitList "," (.EXTRA_TAGS | default ""))))}}' # Check if a C compiler is available (gcc or clang) — cross-platform via wails3 tool HAS_CC: sh: 'wails3 tool has "gcc|clang"' build:native: summary: Builds the application natively on Linux internal: true deps: - task: common:go:mod:tidy - task: common:build:frontend vars: BUILD_FLAGS: ref: .BUILD_FLAGS OBFUSCATED: ref: .OBFUSCATED DEV: ref: .DEV - task: common:generate:icons - task: generate:dotdesktop preconditions: - sh: '{{if eq .OBFUSCATED "true"}}command -v garble >/dev/null 2>&1{{else}}true{{end}}' msg: "garble is required for obfuscated builds. Install it with: go install mvdan.cc/garble@v0.16.0 (requires Go 1.24+). See https://github.com/burrowers/garble/releases for version/toolchain compatibility." cmds: - '{{if eq .OBFUSCATED "true"}}garble {{.GARBLE_ARGS}} build{{else}}go build{{end}} {{.BUILD_FLAGS}} -o {{.OUTPUT}}' vars: BUILD_FLAGS: '{{if eq .DEV "true"}}{{if or .EXTRA_TAGS (eq .OBFUSCATED "true")}}-tags {{if eq .OBFUSCATED "true"}}wails_obfuscated{{if .EXTRA_TAGS}},{{end}}{{end}}{{.EXTRA_TAGS}} {{end}}-buildvcs=false -gcflags=all="-l"{{else}}-tags production{{if eq .OBFUSCATED "true"}},wails_obfuscated{{end}}{{if .EXTRA_TAGS}},{{.EXTRA_TAGS}}{{end}} -trimpath -buildvcs=false -ldflags="-w -s -X git.monoexp.com/bajdev/mpckit/internal/app.Version={{.APP_VERSION}} -X git.monoexp.com/bajdev/mpckit/internal/app.Commit={{.COMMIT}}"{{end}}' DEFAULT_OUTPUT: '{{.BIN_DIR}}/{{.APP_NAME}}' OUTPUT: '{{ .OUTPUT | default .DEFAULT_OUTPUT }}' env: GOOS: linux CGO_ENABLED: '{{.CGO_ENABLED | default (ternary "0" "1" (has "purego" (splitList "," (.EXTRA_TAGS | default ""))))}}' GOARCH: '{{.ARCH | default ARCH}}' package: summary: Packages the application for Linux deps: - task: build cmds: - task: create:appimage - task: create:deb - task: create:rpm - task: create:aur create:appimage: summary: Creates an AppImage dir: build/linux/appimage deps: - task: build - task: generate:dotdesktop cmds: - cp "{{.APP_BINARY}}" "{{.APP_NAME}}" - cp ../../appicon.png "{{.APP_NAME}}.png" - wails3 generate appimage -binary "{{.APP_NAME}}" -icon {{.ICON}} -desktopfile {{.DESKTOP_FILE}} -outputdir {{.OUTPUT_DIR}} -builddir {{.ROOT_DIR}}/build/linux/appimage/build vars: APP_NAME: '{{.APP_NAME}}' APP_BINARY: '../../../bin/{{.APP_NAME}}' ICON: '{{.APP_NAME}}.png' DESKTOP_FILE: '../{{.APP_NAME}}.desktop' OUTPUT_DIR: '../../../bin' create:deb: summary: Creates a deb package deps: - task: build cmds: - task: generate:dotdesktop - task: generate:deb create:rpm: summary: Creates a rpm package deps: - task: build cmds: - task: generate:dotdesktop - task: generate:rpm create:aur: summary: Creates a arch linux packager package deps: - task: build cmds: - task: generate:dotdesktop - task: generate:aur generate:deb: summary: Creates a deb package cmds: - wails3 tool package -name "{{.APP_NAME}}" -format deb -config ./build/linux/nfpm/nfpm.yaml -out {{.ROOT_DIR}}/bin generate:rpm: summary: Creates a rpm package cmds: - wails3 tool package -name "{{.APP_NAME}}" -format rpm -config ./build/linux/nfpm/nfpm.yaml -out {{.ROOT_DIR}}/bin generate:aur: summary: Creates a arch linux packager package cmds: - wails3 tool package -name "{{.APP_NAME}}" -format archlinux -config ./build/linux/nfpm/nfpm.yaml -out {{.ROOT_DIR}}/bin generate:dotdesktop: summary: Generates a `.desktop` file dir: build cmds: - mkdir -p {{.ROOT_DIR}}/build/linux/appimage - wails3 generate .desktop -name "{{.PRODUCT_NAME}}" -exec "{{.EXEC}}" -icon "{{.ICON}}" -outputfile "{{.ROOT_DIR}}/build/linux/{{.APP_NAME}}.desktop" -categories "{{.CATEGORIES}}" vars: APP_NAME: '{{.APP_NAME}}' EXEC: '{{.APP_NAME}}' ICON: '{{.APP_NAME}}' CATEGORIES: 'Development;' OUTPUTFILE: '{{.ROOT_DIR}}/build/linux/{{.APP_NAME}}.desktop' run: cmds: - '{{.BIN_DIR}}/{{.APP_NAME}}' sign:deb: summary: Signs the DEB package desc: | Signs the .deb package with a PGP key. Set PGP_KEY in the vars section to override the key configured globally via `wails3 setup` (~/.config/wails/defaults.yaml). Password is retrieved from system keychain (run: wails3 setup signing) deps: - task: create:deb cmds: # PGP_KEY is optional: if unset, `wails3 tool sign` falls back to the key # configured globally via `wails3 setup`. - wails3 tool sign --input "{{.BIN_DIR}}/{{.APP_NAME}}*.deb" {{if .PGP_KEY}}--pgp-key "{{.PGP_KEY}}"{{end}} {{if .SIGN_ROLE}}--role "{{.SIGN_ROLE}}"{{end}} sign:rpm: summary: Signs the RPM package desc: | Signs the .rpm package with a PGP key. Set PGP_KEY in the vars section to override the key configured globally via `wails3 setup` (~/.config/wails/defaults.yaml). Password is retrieved from system keychain (run: wails3 setup signing) deps: - task: create:rpm cmds: - wails3 tool sign --input "{{.BIN_DIR}}/{{.APP_NAME}}*.rpm" {{if .PGP_KEY}}--pgp-key "{{.PGP_KEY}}"{{end}} sign:packages: summary: Signs all Linux packages (DEB and RPM) desc: | Signs both .deb and .rpm packages with a PGP key. Set PGP_KEY in the vars section to override the key configured globally via `wails3 setup` (~/.config/wails/defaults.yaml). Password is retrieved from system keychain (run: wails3 setup signing) cmds: - task: sign:deb - task: sign:rpm