File tree 3 files changed +22
-2
lines changed
3 files changed +22
-2
lines changed Original file line number Diff line number Diff line change 31
31
run : |
32
32
TAG=${GITHUB_REF#refs/tags/}
33
33
MAJOR=${TAG%.*}
34
+ SHORT_COMMIT=${GITHUB_SHA::8}
35
+ DATE=$(date '+%Y-%m-%dT%H:%M:%SZ')
34
36
echo ::set-output name=tag_name::${TAG}
35
37
echo ::set-output name=major_tag::${MAJOR}
38
+ echo ::set-output name=short_commit::${SHORT_COMMIT}
39
+ echo ::set-output name=date::${DATE}
36
40
- name : Set up QEMU
37
41
uses : docker/setup-qemu-action@v1
38
42
- name : Set up Docker Buildx
45
49
file : build/Dockerfile
46
50
platforms : linux/amd64,linux/arm64
47
51
push : true
52
+ build-args : |
53
+ VERSION=${{ steps.prepare.outputs.tag_name }}
54
+ SHORT_COMMIT=${{ steps.prepare.outputs.short_commit }}
55
+ DATE=${{ steps.prepare.outputs.date }}
48
56
tags : |
49
57
golangci/golangci-lint:${{ steps.prepare.outputs.tag_name }}
50
58
golangci/golangci-lint:${{ steps.prepare.outputs.major_tag }}
56
64
context : .
57
65
file : build/Dockerfile.alpine
58
66
platforms : linux/amd64,linux/arm64
67
+ build-args : |
68
+ VERSION=${{ steps.prepare.outputs.tag_name }}
69
+ SHORT_COMMIT=${{ steps.prepare.outputs.short_commit }}
70
+ DATE=${{ steps.prepare.outputs.date }}
59
71
push : true
60
72
tags : |
61
73
golangci/golangci-lint:${{ steps.prepare.outputs.tag_name }}-alpine
Original file line number Diff line number Diff line change 1
1
# stage 1 building the code
2
2
FROM golang:1.15 as builder
3
3
4
+ ARG VERSION
5
+ ARG SHORT_COMMIT
6
+ ARG DATE
7
+
4
8
COPY / /golangci
5
9
WORKDIR /golangci
6
- RUN go build -o golangci-lint ./cmd/golangci-lint/main.go
10
+ RUN go build -ldflags "-s -w -X main.version=$VERSION -X main.commit=$SHORT_COMMIT -X main.date=$DATE" - o golangci-lint ./cmd/golangci-lint/main.go
7
11
8
12
# stage 2
9
13
FROM golang:1.15
Original file line number Diff line number Diff line change 1
1
# stage 1 building the code
2
2
FROM golang:1.15-alpine as builder
3
3
4
+ ARG VERSION
5
+ ARG SHORT_COMMIT
6
+ ARG DATE
7
+
4
8
COPY / /golangci
5
9
WORKDIR /golangci
6
- RUN CGO_ENABLED=0 go build -o golangci-lint ./cmd/golangci-lint/main.go
10
+ RUN go build -ldflags "-s -w -X main.version=$VERSION -X main.commit=$SHORT_COMMIT -X main.date=$DATE" -o golangci-lint ./cmd/golangci-lint/main.go
7
11
8
12
# stage 2
9
13
FROM golang:1.15-alpine
You can’t perform that action at this time.
0 commit comments