File tree Expand file tree Collapse file tree 5 files changed +58
-14
lines changed
Expand file tree Collapse file tree 5 files changed +58
-14
lines changed Original file line number Diff line number Diff line change 99 lint :
1010 runs-on : ubuntu-latest
1111 steps :
12- - uses : actions/setup-go@v5
1312 - uses : actions/checkout@v4
13+ - uses : actions/setup-go@v5
14+ with :
15+ go-version : " 1.21"
1416 - name : golangci-lint
1517 uses : golangci/golangci-lint-action@v3
1618
17- docker-release :
18- runs-on : ubuntu-latest
19- needs : lint
20- steps :
21- - uses : actions/checkout@v4
22- - name : Docker login
23- run : docker login --username ${{ secrets.DOCKER_LOGIN }} --password ${{ secrets.DOCKER_PASSWORD }}
24- - name : Docker release
25- run : make docker-release
26-
27- github-release :
19+ release :
2820 runs-on : ubuntu-latest
2921 needs : lint
3022 steps :
3123 - uses : actions/checkout@v4
3224 - uses : actions/setup-go@v5
3325 with :
3426 go-version : " 1.21"
27+
28+ # Get values for cache paths to be used in later steps
29+ - name : Get cache paths
30+ id : go-cache-paths
31+ run : |
32+ echo "::set-output name=go-build::$(go env GOCACHE)"
33+ echo "::set-output name=go-mod::$(go env GOMODCACHE)"
34+
35+ # Cache go "build cache", used to speedup go test
36+ - name : Go Build Cache
37+ uses : actions/cache@v3
38+ with :
39+ path : ${{ steps.go-cache-paths.outputs.go-build }}
40+ key : ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}
41+ restore-keys : |
42+ ${{ runner.os }}-go-build-
43+
44+ # Cache go mod cache, used to speedup builds
45+ - name : Go Mod Cache
46+ uses : actions/cache@v3
47+ with :
48+ path : ${{ steps.go-cache-paths.outputs.go-mod }}
49+ key : ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}
50+ restore-keys : |
51+ ${{ runner.os }}-go-mod-
52+
53+ - name : Docker login
54+ run : docker login --username ${{ secrets.DOCKER_LOGIN }} --password ${{ secrets.DOCKER_PASSWORD }}
55+
3556 - name : Run GoReleaser
3657 uses : goreleaser/goreleaser-action@v5
3758 with :
Original file line number Diff line number Diff line change 11app
22.vscode
3+ dist
Original file line number Diff line number Diff line change @@ -18,3 +18,18 @@ changelog:
1818 exclude :
1919 - ' ^docs:'
2020 - ' ^test:'
21+ dockers :
22+ - goos : linux
23+ goarch : amd64
24+ image_templates :
25+ - " mxssl/selectel-billing-exporter:latest"
26+ - " mxssl/selectel-billing-exporter:{{ .Tag }}"
27+ dockerfile : Dockerfile.ci
28+ use : buildx
29+ build_flag_templates :
30+ - " --label=org.opencontainers.image.created={{.Date}}"
31+ - " --label=org.opencontainers.image.title={{.ProjectName}}"
32+ - " --label=org.opencontainers.image.revision={{.FullCommit}}"
33+ - " --label=org.opencontainers.image.version={{.Version}}"
34+ - " --platform=linux/amd64"
35+ - " --pull"
Original file line number Diff line number Diff line change @@ -5,7 +5,6 @@ ENV GO111MODULE=on
55WORKDIR /go/src/github.com/mxssl/selectel-billing-exporter
66COPY . .
77
8- # install deps
98RUN apk add --no-cache \
109 ca-certificates \
1110 curl \
@@ -14,7 +13,6 @@ RUN apk add --no-cache \
1413RUN CGO_ENABLED=0 \
1514 go build -v -o app
1615
17- # copy compiled binary to a clear Alpine Linux image
1816FROM alpine:3.19.1
1917WORKDIR /
2018RUN apk add --no-cache \
Original file line number Diff line number Diff line change 1+ # syntax=docker/dockerfile:1
2+ FROM alpine:3.19.1
3+ WORKDIR /
4+ RUN <<EOF
5+ apk add --no-cache ca-certificates
6+ EOF
7+ COPY selectel-billing-exporter /app
8+ RUN chmod +x app
9+ CMD ["./app"]
You can’t perform that action at this time.
0 commit comments