Переглянути джерело

Merge pull request #1815 from slingamn/githash

fix some inconsistencies in how git hashes and tags are included in the binary
tags/v2.8.0-rc1
Shivaram Lingamneni 2 роки тому
джерело
коміт
0f8f8b0de9
Аккаунт користувача з таким Email не знайдено
2 змінених файлів з 4 додано та 3 видалено
  1. 1
    1
      Dockerfile
  2. 3
    2
      Makefile

+ 1
- 1
Dockerfile Переглянути файл

@@ -1,7 +1,7 @@
1 1
 ## build ergo binary
2 2
 FROM golang:1.17-alpine3.13 AS build-env
3 3
 
4
-RUN apk add -U --force-refresh --no-cache --purge --clean-protected -l -u make
4
+RUN apk add -U --force-refresh --no-cache --purge --clean-protected -l -u make git
5 5
 
6 6
 # copy ergo source
7 7
 WORKDIR /go/src/github.com/ergochat/ergo

+ 3
- 2
Makefile Переглянути файл

@@ -1,16 +1,17 @@
1 1
 .PHONY: all install build release capdefs test smoke gofmt irctest
2 2
 
3 3
 GIT_COMMIT := $(shell git rev-parse HEAD 2> /dev/null)
4
+GIT_TAG := $(shell git tag --points-at HEAD 2> /dev/null | head -n 1)
4 5
 
5 6
 capdef_file = ./irc/caps/defs.go
6 7
 
7 8
 all: install
8 9
 
9 10
 install:
10
-	go install -v -ldflags "-X main.commit=$(GIT_COMMIT)"
11
+	go install -v -ldflags "-X main.commit=$(GIT_COMMIT) -X main.version=$(GIT_TAG)"
11 12
 
12 13
 build:
13
-	go build -v -ldflags "-X main.commit=$(GIT_COMMIT)"
14
+	go build -v -ldflags "-X main.commit=$(GIT_COMMIT) -X main.version=$(GIT_TAG)"
14 15
 
15 16
 release:
16 17
 	goreleaser --skip-publish --rm-dist

Завантаження…
Відмінити
Зберегти