Skip to content

Commit

Permalink
package tool fixes and add bundle name field
Browse files Browse the repository at this point in the history
empty name guard
  • Loading branch information
atterpac committed Nov 24, 2024
1 parent 475ba28 commit 8d7f763
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 25 deletions.
28 changes: 6 additions & 22 deletions v3/internal/commands/build_assets/Taskfile.linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,9 @@ tasks:
PRODUCTION: "true"
cmds:
- task: create:appimage
# Requires nfpm to be installed
# - task: create:deb
# - task: create:rpm
# - task: create:aur
- task: create:deb
- task: create:rpm
- task: create:aur

create:appimage:
summary: Creates an AppImage
Expand Down Expand Up @@ -81,33 +80,18 @@ tasks:

generate:deb:
summary: Creates a deb package
preconditions:
- sh: nfpm --version
msg: It appears nfpm is not installed. Please install using `go install github.com/goreleaser/nfpm/v2/cmd/nfpm@latest`
cmds:
- nfpm pkg -f ./build/nfpm/nfpm.yaml -p deb -t ./bin/{{.APP_NAME}}.deb
env:
GOARCH: '{{.ARCH | default ARCH}}'
- wails3 tool package -name {{.APP_NAME}} -format deb -config ./build/nfpm/nfpm.yaml

generate:rpm:
summary: Creates a rpm package
preconditions:
- sh: nfpm --version
msg: It appears nfpm is not installed. Please install using `go install github.com/goreleaser/nfpm/v2/cmd/nfpm@latest`
cmds:
- nfpm pkg -f ./build/nfpm/nfpm.yaml -p rpm -t ./bin/{{.APP_NAME}}.rpm
env:
GOARCH: '{{.ARCH | default ARCH}}'
- wails3 tool package -name {{.APP_NAME}} -format rpm -config ./build/nfpm/nfpm.yaml

generate:aur:
summary: Creates a arch linux packager package
preconditions:
- sh: nfpm --version
msg: It appears nfpm is not installed. Please install using `go install github.com/goreleaser/nfpm/v2/cmd/nfpm@latest`
cmds:
- nfpm pkg -f ./build/nfpm/nfpm.yaml -p arch -t ./bin/{{.APP_NAME}}.pkg.tar.zst
env:
GOARCH: '{{.ARCH | default ARCH}}'
- wails3 tool package -name {{.APP_NAME}} -format arch -config ./build/nfpm/nfpm.yaml

generate:dotdesktop:
summary: Generates a `.desktop` file
Expand Down
10 changes: 9 additions & 1 deletion v3/internal/commands/tool_package.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ func ToolPackage(options *flags.ToolPackage) error {
return fmt.Errorf("please provide a config file using the -config flag")
}

if options.ExecutableName == "" {
return fmt.Errorf("please provide an executable name using the -name flag")
}

// Validate format
var pkgType packager.PackageType
switch strings.ToLower(options.Format) {
Expand All @@ -43,7 +47,11 @@ func ToolPackage(options *flags.ToolPackage) error {
}

// Generate output filename based on format
outputFile := fmt.Sprintf("package.%s", options.Format)
if options.Format == "archlinux" {
// Arch linux packages are not .archlinux files, they are .pkg.tar.zst
options.Format = "pkg.tar.zst"
}
outputFile := fmt.Sprintf("./bin/%s.%s", options.ExecutableName, options.Format)

// Create the package
err = packager.CreatePackageFromConfig(pkgType, configPath, outputFile)
Expand Down
5 changes: 3 additions & 2 deletions v3/internal/flags/package.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ package flags
type ToolPackage struct {
Common

Format string `name:"format" description:"Package format to generate (deb, rpm, archlinux)" default:"deb"`
ConfigPath string `name:"config" description:"Path to the package configuration file" default:""`
Format string `name:"format" description:"Package format to generate (deb, rpm, archlinux)" default:"deb"`
ExecutableName string `name:"name" description:"Name of the executable to package" default:"myapp"`
ConfigPath string `name:"config" description:"Path to the package configuration file" default:""`
}

0 comments on commit 8d7f763

Please sign in to comment.