-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtaskfile.yml
More file actions
85 lines (74 loc) · 2.17 KB
/
taskfile.yml
File metadata and controls
85 lines (74 loc) · 2.17 KB
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
version: '3'
tasks:
test:
desc: "Run the test for all packages and subpackages"
cmds:
- |
cd cli
go test -count=1 ./...
test-verbose:
desc: "Run the test for all packages and subpackages with verbose output"
cmds:
- |
cd cli
go test -count=1 -v ./...
install-deps:
desc: "Install dependencies"
cmds:
- |
cd cli
go get .
build-binary:
desc: "Build the binary"
cmds:
- |
cd cli
go build
release:
desc: "Run a standard release from develop to main using git flow"
cmds:
- npx --yes entro-version release --main-branch-name=main
release-major:
desc: "Run a major release from develop to main using git flow"
cmds:
- npx --yes entro-version release --main-branch-name=main --commit-and-tag-version-flag="--release-as=major"
build:
desc: "Build the binary - the assumption is that this is done from the main branch"
cmds:
- |
# Shoutout to Rob Allen for this amazing article
# https://akrabat.com/building-go-binaries-for-different-platforms
# https://akrabat.com/setting-the-version-of-a-go-application-when-building/
rm -rf ./release
cd cli
version=`git describe --tags HEAD`
platforms=(
"darwin/amd64"
"darwin/arm64"
"linux/amd64"
"linux/arm"
"linux/arm64"
"windows/amd64"
)
for platform in "${platforms[@]}"
do
platform_split=(${platform//\// })
GOOS=${platform_split[0]}
GOARCH=${platform_split[1]}
os=$GOOS
if [ $os = "darwin" ]; then
os="macOS"
fi
output_name="dockem-${version}-${os}-${GOARCH}"
if [ $os = "windows" ]; then
output_name+='.exe'
fi
echo "Building release/$output_name..."
env GOOS=$GOOS GOARCH=$GOARCH go build \
-ldflags "-X dockem/cmd.Version=$version" \
-o ../release/$output_name
if [ $? -ne 0 ]; then
echo 'An error has occurred! Aborting.'
exit 1
fi
done