forked from deep-project/moss
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Taskfile.yml
120 lines (94 loc) · 2.27 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# https://taskfile.dev
version: '3'
tasks:
run:
cmds:
- cd ./main/tmp && go run ../cmd/web/main.go
silent: true
admin:
cmds:
- cd ./admin && npm run dev
#############
### init ###
#############
init-admin:
cmds:
- cd ./admin && npm install
init-themes:
cmds:
- cd ./theme/germ && npm install
### 开发默认模板时,更新模板到资源文件
init-resources-themes:
cmds:
- cd ./theme/germ && npx tailwindcss -i ./css/style.css -o ../../main/tmp/themes/germ/public/style.css --minify
- rm -r -f ./main/resources/themes
- cp -r ./main/tmp/themes ./main/resources/themes
#############
### build ###
#############
build:
- task: build-admin
- task: build-linux-amd64
build-all:
- task: build-admin
- task: build-main
build-admin:
cmds:
- cd ./admin && npm run build
build-main:
deps: [
build-linux-386,
build-linux-amd64,
#build-windows-386,
build-windows-amd64,
build-darwin-amd64,
build-darwin-arm64,
]
build-linux-386:
- task: _build
vars:
GOOS: linux
GOARCH: 386
build-linux-amd64:
- task: _build
vars:
GOOS: linux
GOARCH: amd64
build-windows-386:
- task: _build
vars:
GOOS: windows
GOARCH: 386
FILE_EXT: .exe
build-windows-amd64:
- task: _build
vars:
GOOS: windows
GOARCH: amd64
FILE_EXT: .exe
build-darwin-amd64:
- task: _build
vars:
GOOS: darwin
GOARCH: amd64
build-darwin-arm64:
- task: _build
vars:
GOOS: darwin
GOARCH: arm64
######
######
_build:
vars:
FILE_NAME: 'moss_{{.GOOS}}_{{.GOARCH}}{{.FILE_EXT}}'
BUILD_FILE_PATH: '{{.ROOT_DIR}}/dist/{{.FILE_NAME}}'
BACKUP_FILE_PATH: '{{.ROOT_DIR}}/dist/backup/{{.FILE_NAME}}_{{now | date "2006.01.02.15.04.05"}}'
env:
CGO_ENABLED: 0
GOOS: '{{.GOOS}}'
GOARCH: '{{.GOARCH}}'
cmds:
- mkdir -p './dist/backup' && mv "{{.BUILD_FILE_PATH}}" "{{.BACKUP_FILE_PATH}}"
- cd ./main && go build -ldflags="-s -w" -trimpath -o "{{.BUILD_FILE_PATH}}" ./cmd/web/main.go
- upx -4 "{{.BUILD_FILE_PATH}}"
ignore_error: true