version detection travis friendly

This commit is contained in:
Umputun 2018-12-05 10:47:55 -06:00
parent 9cc7f05bd3
commit b896912dcf

View file

@ -12,11 +12,6 @@ ARG TRAVIS_PULL_REQUEST
ARG TRAVIS_PULL_REQUEST_SHA ARG TRAVIS_PULL_REQUEST_SHA
ARG TRAVIS_REPO_SLUG ARG TRAVIS_REPO_SLUG
ARG TRAVIS_TAG ARG TRAVIS_TAG
ARG DRONE
ARG DRONE_TAG
ARG DRONE_COMMIT
ARG DRONE_BRANCH
ARG DRONE_PULL_REQUEST
WORKDIR /go/src/github.com/umputun/rss2twitter WORKDIR /go/src/github.com/umputun/rss2twitter
ADD . /go/src/github.com/umputun/rss2twitter ADD . /go/src/github.com/umputun/rss2twitter
@ -38,7 +33,9 @@ RUN if [ -z "$COVERALLS_TOKEN" ] ; then \
else goveralls -coverprofile=.cover/cover.out -service=travis-ci -repotoken $COVERALLS_TOKEN || echo "coverall failed!"; fi else goveralls -coverprofile=.cover/cover.out -service=travis-ci -repotoken $COVERALLS_TOKEN || echo "coverall failed!"; fi
RUN \ RUN \
version=$(/script/git-rev.sh) && \ if [ -z "$TRAVIS" ] ; then \
echo "runs outside of travis" && version=$(/script/git-rev.sh); \
else version=${TRAVIS_TAG}${TRAVIS_BRANCH}${TRAVIS_PULL_REQUEST}-${TRAVIS_COMMIT:0:7}-$(date +%Y%m%dT%H:%M:%S); fi && \
echo "version=$version" && \ echo "version=$version" && \
go build -o rss2twitter -ldflags "-X main.revision=${version} -s -w" ./app go build -o rss2twitter -ldflags "-X main.revision=${version} -s -w" ./app