-
Notifications
You must be signed in to change notification settings - Fork 0
/
Taskfile.yml
97 lines (87 loc) · 4.13 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
# yaml-language-server: https://taskfile.dev/schema.json
# https://taskfile.dev
version: "3"
vars:
CMD_NAME: radiomux
PACKAGE_NAME: "github.com/ItsNotGoodName/radiomux"
APK_NAME: radiomuxplayer
tasks:
clean:
cmds:
- rm -rf dist
- mkdir dist dist/artifacts dist/files dist/files-windows
build-apk:
internal: true
dir: android
cmds:
- chmod +x gradlew
- ./gradlew :app:assembleRelease -x test
- rm {{.RELEASE_DIR}}/app-release-unsigned-aligned.apk || true
- zipalign -v -p 4 {{.RELEASE_DIR}}/app-release-unsigned.apk {{.RELEASE_DIR}}/app-release-unsigned-aligned.apk
- echo $ANDROID_KEYSTORE | base64 --decode > my-release-key.jks
- apksigner sign --ks my-release-key.jks --ks-pass env:ANDROID_KEYSTORE_PASSWORD --out {{.RELEASE_DIR}}/app-release.apk {{.RELEASE_DIR}}/app-release-unsigned-aligned.apk
- apksigner verify {{.RELEASE_DIR}}/app-release.apk
- cp {{.RELEASE_DIR}}/app-release.apk ../dist/{{.APK_NAME}}-release.apk
vars:
RELEASE_DIR: app/build/outputs/apk/release
env:
ANDROID_KEYSTORE:
ANDROID_KEYSTORE_PASSWORD:
build-apk-debug:
internal: true
dir: android
cmds:
- chmod +x gradlew
- ./gradlew :app:assembleDebug -x test
- cp {{.DEBUG_DIR}}/app-debug.apk ../dist/{{.APK_NAME}}-debug.apk
vars:
DEBUG_DIR: app/build/outputs/apk/debug
build-server:
internal: true
cmds:
- go mod tidy
- go generate ./...
- GOOS=linux GOARCH=amd64 go build -ldflags="{{.MAIN_LDFLAGS}}" -o ./dist/{{.CMD_NAME}}_Linux_x86_64/{{.CMD_NAME}} {{.MAIN_PACKAGE}}
- GOOS=linux GOARCH=arm GOARM=7 go build -ldflags="{{.MAIN_LDFLAGS}}" -o ./dist/{{.CMD_NAME}}_Linux_armv7/{{.CMD_NAME}} {{.MAIN_PACKAGE}}
- GOOS=linux GOARCH=arm64 go build -ldflags="{{.MAIN_LDFLAGS}}" -o ./dist/{{.CMD_NAME}}_Linux_arm64/{{.CMD_NAME}} {{.MAIN_PACKAGE}}
- GOOS=darwin GOARCH=arm64 go build -ldflags="{{.MAIN_LDFLAGS}}" -o ./dist/{{.CMD_NAME}}_Darwin_arm64/{{.CMD_NAME}} {{.MAIN_PACKAGE}}
- GOOS=windows GOARCH=amd64 go build -ldflags="{{.MAIN_LDFLAGS}}" -o ./dist/{{.CMD_NAME}}_Windows_x86_64/{{.CMD_NAME}}.exe {{.MAIN_PACKAGE}}
env:
CGO_ENABLED: 0
vars:
BUILD_PACKAGE_NAME: "{{.PACKAGE_NAME}}/internal/build"
BUILD_VERSION: "nightly"
BUILD_DATE: '{{now | date "2006-01-02T15:04:05Z07:00"}}'
BUILD_COMMIT:
sh: git rev-parse HEAD
BUILD_REPO_URL: "https://{{.PACKAGE_NAME}}"
MAIN_LDFLAGS: -s -w -X {{.BUILD_PACKAGE_NAME}}.version={{.BUILD_VERSION}} -X {{.BUILD_PACKAGE_NAME}}.commit={{.BUILD_COMMIT}} -X {{.BUILD_PACKAGE_NAME}}.date={{.BUILD_DATE}} -X {{.BUILD_PACKAGE_NAME}}.repoURL={{.BUILD_REPO_URL}}
MAIN_PACKAGE: "{{.PACKAGE_NAME}}/cmd/{{.CMD_NAME}}"
compile-artifacts:
internal: true
dir: dist
cmds:
- cp *.apk artifacts/
- for: { var: FILES }
cmd: cp ../{{.ITEM}} "./files/$(basename {{.ITEM}})"
- for: { var: WINDOWS_FILES }
cmd: cp ../{{.ITEM}} "./files-windows/$(basename {{.ITEM}})"
- cd {{.CMD_NAME}}_Linux_x86_64 && cp ../files/* . && tar -czf ../artifacts/{{.CMD_NAME}}_Linux_x86_64.tar.gz *
- cd {{.CMD_NAME}}_Linux_armv7 && cp ../files/* . && tar -czf ../artifacts/{{.CMD_NAME}}_Linux_armv7.tar.gz *
- cd {{.CMD_NAME}}_Linux_arm64 && cp ../files/* . && tar -czf ../artifacts/{{.CMD_NAME}}_Linux_arm64.tar.gz *
- cd {{.CMD_NAME}}_Darwin_arm64 && cp ../files/* . && tar -czf ../artifacts/{{.CMD_NAME}}_Darwin_arm64.tar.gz *
- cd {{.CMD_NAME}}_Windows_x86_64 && cp ../files/* . && cp ../files-windows/* . && zip -q ../artifacts/{{.CMD_NAME}}_Windows_x86_64.zip *
- cd artifacts && sha256sum *.tar.gz *.zip *.apk > checksum.txt
vars:
FILES: README.md LICENSE
WINDOWS_FILES: WinSW.xml
build:
deps: [clean, build-apk, build-server]
dir: dist
cmds:
- task: compile-artifacts
build-debug:
deps: [clean, build-apk-debug, build-server]
dir: dist
cmds:
- task: compile-artifacts