Skip to content

Commit 59f9aff

Browse files
committed
build: auto upload release files
1 parent 7f3e922 commit 59f9aff

2 files changed

Lines changed: 49 additions & 25 deletions

File tree

.gitflow.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
release:
2+
templates:
3+
- name: release
4+
title: "{tag}"
5+
exec:
6+
- make build-all
7+
files:
8+
- name: ucloud-cli-{tag}-darwin_amd64.zip
9+
path: out/darwin_amd64
10+
- name: ucloud-cli-{tag}-darwin_arm64.zip
11+
path: out/darwin_arm64
12+
- name: ucloud-cli-{tag}-linux_amd64.zip
13+
path: out/linux_amd64
14+
- name: ucloud-cli-{tag}-linux_arm64.zip
15+
path: out/linux_arm64
16+
- name: ucloud-cli-{tag}-windows_amd64.zip
17+
path: out/windows_amd64
18+

Makefile

Lines changed: 31 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6,31 +6,37 @@ install:
66
go build -i -v -mod=vendor -o out/ucloud main.go
77
cp out/ucloud /usr/local/bin
88

9-
.PHONY : build_mac
10-
build_mac:
11-
GOOS=darwin GOARCH=amd64 go build -mod=vendor -o out/ucloud main.go
12-
tar zcvf out/ucloud-cli-macosx-${VERSION}-amd64.tgz -C out ucloud
13-
shasum -a 256 out/ucloud-cli-macosx-${VERSION}-amd64.tgz
14-
15-
build_mac_arm:
16-
GOOS=darwin GOARCH=arm64 go build -mod=vendor -o out/ucloud main.go
17-
tar zcvf out/ucloud-cli-macosx-${VERSION}-arm64.tgz -C out ucloud
18-
shasum -a 256 out/ucloud-cli-macosx-${VERSION}-arm64.tgz
19-
20-
.PHONY : build_linux
21-
build_linux:
22-
GOOS=linux GOARCH=amd64 go build -mod=vendor -o out/ucloud main.go
23-
tar zcvf out/ucloud-cli-linux-${VERSION}-amd64.tgz -C out ucloud
24-
shasum -a 256 out/ucloud-cli-linux-${VERSION}-amd64.tgz
25-
26-
.PHONY : build_windows
27-
build_windows:
28-
GOOS=windows GOARCH=amd64 go build -mod=vendor -o out/ucloud.exe main.go
29-
zip -r out/ucloud-cli-windows-${VERSION}-amd64.zip out/ucloud.exe
30-
shasum -a 256 out/ucloud-cli-windows-${VERSION}-amd64.zip
31-
32-
.PHONY : build_all
33-
build_all: build_mac build_linux build_windows
9+
.PHONY : build-darwin-amd64
10+
build-darwin-amd64:
11+
GOOS=darwin GOARCH=amd64 go build -mod=vendor -o out/darwin_amd64/ucloud main.go
12+
@cp LICENSE out/darwin_amd64
13+
14+
.PHONY : build-darwin-arm64
15+
build-darwin-arm64:
16+
GOOS=darwin GOARCH=arm64 go build -mod=vendor -o out/darwin_arm64/ucloud main.go
17+
@cp LICENSE out/darwin_arm64
18+
19+
.PHONY : build-linux-amd64
20+
build-linux-amd64:
21+
GOOS=linux GOARCH=amd64 go build -mod=vendor -o out/linux_amd64/ucloud main.go
22+
@cp LICENSE out/linux_amd64
23+
24+
.PHONY : build-linux-arm64
25+
build-linux-arm64:
26+
GOOS=linux GOARCH=amd64 go build -mod=vendor -o out/linux_arm64/ucloud main.go
27+
@cp LICENSE out/linux_arm64
28+
29+
.PHONY : build-windows-amd64
30+
build-windows-amd64:
31+
GOOS=windows GOARCH=amd64 go build -mod=vendor -o out/windows_amd64/ucloud.exe main.go
32+
@cp LICENSE out/windows_amd64
33+
34+
.PHONY : build-all
35+
build-all: build-darwin-amd64 build-darwin-arm64 build-linux-arm64 build-linux-amd64 build-windows-amd64
36+
37+
.PHONY : release
38+
release:
39+
@gitflow run release -f .gitflow.yaml
3440

3541
.PHONY: fmt
3642
fmt:

0 commit comments

Comments
 (0)