File tree Expand file tree Collapse file tree 5 files changed +83
-44
lines changed
Expand file tree Collapse file tree 5 files changed +83
-44
lines changed Original file line number Diff line number Diff line change 1+ name : release
2+
3+ concurrency :
4+ group : release-${{ github.ref_name }}
5+ cancel-in-progress : true
6+
7+ on :
8+ push :
9+ tags :
10+ - " v*"
11+
12+ permissions :
13+ contents : write
14+
15+ jobs :
16+ release :
17+ runs-on : ubuntu-latest
18+ steps :
19+ - name : Checkout
20+ uses : actions/checkout@v2
21+ with :
22+ fetch-depth : 0
23+
24+ - name : Fetch all tags
25+ run : git fetch --force --tags
26+
27+ - name : Set up Go
28+ uses : actions/setup-go@v2
29+ with :
30+ go-version : 1.18
31+
32+ - name : Run GoReleaser
33+ uses : goreleaser/goreleaser-action@v2
34+ with :
35+ distribution : goreleaser
36+ version : latest
37+ args : release --rm-dist
38+ env :
39+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
Original file line number Diff line number Diff line change 1+ before :
2+ hooks :
3+ - go mod tidy
4+ builds :
5+ - id : rivendell
6+ dir : ./
7+ env :
8+ - CGO_ENABLED=0
9+ goos :
10+ - linux
11+ - darwin
12+ goarch :
13+ - amd64
14+ - arm64
15+ ldflags :
16+ - -s -w -X github.com/anduintransaction/rivendell/utils.Version={{.Version}} -X github.com/anduintransaction/rivendell/utils.Commit={{.Commit}}
17+ archives :
18+ - id : rivendell
19+ builds :
20+ - rivendell
21+ name_template : " {{ .ProjectName }}-{{ .Version }}-{{ .Os }}-{{ .Arch }}"
22+ format : tar.gz
23+ files :
24+ - none*
25+ changelog :
26+ skip : true
27+ checksum :
28+ name_template : " checksums.txt"
29+ snapshot :
30+ name_template : " dev-snapshot"
Original file line number Diff line number Diff line change 1- DIST =./dist
2- BIN =rivendell
3- OS_MAC =darwin
4- ARCH_MAC =amd64
5- OS_LINUX =linux
6- ARCH_LINUX =amd64
7- OS_M1 =darwin
8- ARCH_M1 =arm64
9-
10- build :
11- go build
12-
131install :
142 go install
153
16- clean :
17- rm -rf ${BIN} ${DIST} ${GOPATH} /bin/${BIN}
18-
19- dist : clean build .dist-prepare .dist-mac .dist-linux .dist-m1
20-
214test : .test-project .test-utils .test-kubernetes
225
23- .dist-prepare :
24- rm -rf ${DIST}
25- mkdir -p ${DIST}
26-
27- .dist-mac :
28- CGO_ENABLED=0 GOOS=${OS_MAC} GOARCH=${ARCH_MAC} go build -o ${DIST} /${BIN} && \
29- cd ${DIST} && \
30- tar czf ${BIN} -` ../${BIN} version` -${OS_MAC} -${ARCH_MAC} .tar.gz ${BIN} && \
31- rm ${BIN} && \
32- cd ..
33-
34- .dist-m1 :
35- CGO_ENABLED=0 GOOS=${OS_M1} GOARCH=${ARCH_M1} go build -o ${DIST} /${BIN} && \
36- cd ${DIST} && \
37- tar czf ${BIN} -` ../${BIN} version` -${OS_M1} -${ARCH_M1} .tar.gz ${BIN} && \
38- rm ${BIN} && \
39- cd ..
40-
41- .dist-linux :
42- CGO_ENABLED=0 GOOS=${OS_LINUX} GOARCH=${ARCH_LINUX} go build -o ${DIST} /${BIN} && \
43- cd ${DIST} && \
44- tar czf ${BIN} -` ../${BIN} version` -${OS_LINUX} -${ARCH_LINUX} .tar.gz ${BIN} && \
45- rm ${BIN} && \
46- cd ..
6+ build : test
7+ goreleaser build --snapshot --rm-dist
478
489.test-project :
4910 go test ./project -v
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ var versionCmd = &cobra.Command{
2727 Short : "Display rivendell version" ,
2828 Long : "Display rivendell version" ,
2929 Run : func (cmd * cobra.Command , args []string ) {
30- fmt .Println (utils .Version )
30+ fmt .Println (utils .FullVersion () )
3131 },
3232}
3333
Original file line number Diff line number Diff line change 11package utils
22
33import (
4+ "fmt"
45 "os"
56 "path/filepath"
67 "regexp"
@@ -11,8 +12,16 @@ import (
1112 "github.com/palantir/stacktrace"
1213)
1314
14- // Version of rivendell
15- var Version = "1.1.5"
15+ var (
16+ // Version of rivendell
17+ Version = "dev"
18+ // Commit returns rivendell build commit
19+ Commit = "unknown"
20+ )
21+
22+ func FullVersion () string {
23+ return fmt .Sprintf ("%s (Commit: %s)" , Version , Commit )
24+ }
1625
1726// MergeMaps merges multiple maps into one
1827func MergeMaps (maps ... map [string ]string ) map [string ]string {
You can’t perform that action at this time.
0 commit comments