Skip to content

Commit

Permalink
fix: loss branch info when release
Browse files Browse the repository at this point in the history
  • Loading branch information
hugefiver committed Jan 31, 2021
1 parent 707c0de commit e21ea4e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
1 change: 1 addition & 0 deletions .github/workflows/docker_push_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ jobs:
csust/csust-got:${{ steps.version.outputs.tag }}
build-args: |
TAG=${{ steps.version.outputs.tag }}
BRANCH=release
RELEASE=release
- name: Image digest
Expand Down
9 changes: 8 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,16 @@ FROM golang:alpine AS buildenv

RUN apk add make git tzdata

ARG BRANCH
ARG RELEASE
ARG TAG

WORKDIR /go/src/app
COPY . .
RUN make deploy
RUN make \
BRANCH=${BRANCH} \
TAG=${TAG} \
deploy

# deploy image
FROM alpine
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

PROJECT := csust-got
VERSION ?= $(if $(TAG),$(TAG),$(shell git rev-parse --short HEAD))
BRANCH ?= $(if $(RELEASE),$(RELEASE),$(shell git branch --show-current))
BRANCH ?= $(shell git branch --show-current)
BUILDTIME := $(shell TZ="Asia/Shanghai" date '+%Y/%m/%d-%H:%M:%S')

FLAGPKG = $(PROJECT)/base
Expand All @@ -26,7 +26,7 @@ test:

fmt:
gofmt -l -w .

`
deploy: get
CGO_ENABLED=$(CGOFLAG) \
go build -o $(OUTPUT) -ldflags "$(LDFLAGS)" .
Expand Down

0 comments on commit e21ea4e

Please sign in to comment.