-
Notifications
You must be signed in to change notification settings - Fork 82
/
Taskfile.yml
72 lines (69 loc) · 2.96 KB
/
Taskfile.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# yaml-language-server: $schema=https://taskfile.dev/schema.json
---
version: 3
tasks:
build:
silent: true
vars:
OUTPUT_FULL_PATH: '{{ $args := (splitArgs .CLI_ARGS) }}{{ range $i, $a := $args }}{{ if eq $a "-o" }}{{ index $args (add $i 1) }}{{ end }}{{ end }}'
OUTPUT_FILENAME: '{{ if ne .OUTPUT_FULL_PATH "" }}{{ base (toSlash .OUTPUT_FULL_PATH) }}{{ end }}'
WAILS_ARGS: '
{{ $rawArgs := (splitArgs .CLI_ARGS) }}
{{ $args := without $rawArgs "." "-o" .OUTPUT_FULL_PATH }}
{{ $GOOS := (env "GOOS") }}
{{ $GOARCH := (env "GOARCH") }}
{{ range $args }}
{{ shellQuote . }}
{{ end }}
{{ if ne $GOOS "" }}-platform {{ $GOOS }}{{ if ne $GOARCH "" }}/{{ $GOARCH }}{{ end }}{{ end }}
{{ if ne .OUTPUT_FILENAME "" }}-o {{ .OUTPUT_FILENAME }}{{ end }}
'
cmds:
- GOOS="" GOARCH="" wails build {{.WAILS_ARGS}}
- platforms:
- darwin
cmd: |
{{ if ne .OUTPUT_FILENAME "" }}
pushd "build/bin" || exit 1
codesign --force --deep -s - "{{.OUTPUT_FILENAME}}.app" # If a universal binary is generated, the signature is lost
zip -r "{{.OUTPUT_FILENAME}}.zip" "{{.OUTPUT_FILENAME}}.app" # zip would add the .zip extension anyway
mv "{{.OUTPUT_FILENAME}}.zip" "{{.OUTPUT_FILENAME}}"
popd || exit 1
{{ end }}
- cmd: |
{{ if ne .OUTPUT_FILENAME "" }}
mkdir -p "{{ osDir .OUTPUT_FULL_PATH }}"
cp -r "build/bin/{{.OUTPUT_FILENAME}}" "{{.OUTPUT_FULL_PATH}}"
{{ end }}
build:linux:appimage:
silent: true
platforms: [linux]
vars:
OUTPUT_FULL_PATH: '{{ $args := (splitArgs .CLI_ARGS) }}{{ range $i, $a := $args }}{{ if eq $a "-o" }}{{ index $args (add $i 1) }}{{ end }}{{ end }}'
OUTPUT_FILENAME: '{{ if ne .OUTPUT_FULL_PATH "" }}{{ base (toSlash .OUTPUT_FULL_PATH) }}{{ end }}'
WAILS_ARGS: '
{{ $rawArgs := (splitArgs .CLI_ARGS) }}
{{ $args := without $rawArgs "." "-o" .OUTPUT_FULL_PATH }}
{{ $GOOS := (env "GOOS") }}
{{ $GOARCH := (env "GOARCH") }}
{{ range $args }}
{{ shellQuote . }}
{{ end }}
{{ if ne $GOOS "" }}-platform {{ $GOOS }}{{ if ne $GOARCH "" }}/{{ $GOARCH }}{{ end }}{{ end }}
{{ if ne .OUTPUT_FILENAME "" }}-o {{ .OUTPUT_FILENAME }}{{ end }}
'
cmds:
- GOOS="" GOARCH="" wails build {{.WAILS_ARGS}}
- chmod +x "build/bin/{{.OUTPUT_FILENAME}}"
- mv "build/bin/{{.OUTPUT_FILENAME}}" "build/bin/appimage-bin-tmp"
- chmod +x "build/linux/appimage.sh" # Make sure the script is executable
- build/linux/appimage.sh "build/bin/appimage-bin-tmp" "{{.OUTPUT_FULL_PATH}}"
- rm "build/bin/appimage-bin-tmp"
lint:
silent: true
preconditions:
- golangci-lint --version | grep -q 1.61
cmds:
- GOOS=windows golangci-lint run
- GOOS=linux golangci-lint run
- GOOS=darwin golangci-lint run