mirror of
https://github.com/tobiasehlert/teslamateapi.git
synced 2026-02-27 09:54:18 +08:00
adding arg for apiVersion based on git release
This commit is contained in:
@@ -54,3 +54,5 @@ jobs:
|
||||
labels: ${{ steps.docker_meta.outputs.labels }}
|
||||
cache-from: type=local,src=/tmp/.buildx-cache
|
||||
cache-to: type=local,dest=/tmp/.buildx-cache
|
||||
build-args: |
|
||||
apiVersion=${{ github.event.release.tag_name }}
|
||||
|
||||
+4
-1
@@ -1,6 +1,9 @@
|
||||
# get latest golang container
|
||||
FROM golang:1.17.5
|
||||
|
||||
# get args
|
||||
ARG apiVersion=unknown
|
||||
|
||||
# create and set workingfolder
|
||||
WORKDIR /go/src/
|
||||
|
||||
@@ -14,7 +17,7 @@ RUN go mod download
|
||||
COPY src/ .
|
||||
|
||||
# compile the program
|
||||
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o app .
|
||||
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -ldflags="-w -s -X 'main.apiVersion=${apiVersion}'" -o app .
|
||||
|
||||
|
||||
# get latest alpine container
|
||||
|
||||
+1
-2
@@ -14,8 +14,7 @@ import (
|
||||
)
|
||||
|
||||
// setting TeslaMateApi version number
|
||||
// TODO: get the value from git-tag later..
|
||||
var apiVersion = "1.11.0"
|
||||
var apiVersion = "unspecified"
|
||||
|
||||
// defining db var
|
||||
var db *sql.DB
|
||||
|
||||
Reference in New Issue
Block a user