Skip to content

Commit

Permalink
Merge bc3923b into f7dc952
Browse files Browse the repository at this point in the history
  • Loading branch information
hligit committed Dec 8, 2020
2 parents f7dc952 + bc3923b commit 6d5b2a3
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 3 deletions.
24 changes: 22 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,29 @@ services:
go:
- 1.14.x

arch:
- amd64
- arm64

os:
- linux

jobs:
include:
- os: linux
arch: amd64
- os: linux
arch: arm64
- stage: Push Docker manifest
env:
- DOCKER_CLI_EXPERIMENTAL=enabled
script:
- if [ "$TRAVIS_OS_NAME" == "linux" -a ! -z "$TRAVIS_TAG" ]; then
echo "Executing release-manifest on tag build $TRAVIS_TAG";
docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD";
make release-manifest;
fi

before_install:
- go get -v github.com/mattn/goveralls

Expand All @@ -25,10 +45,10 @@ script:
- make coveralls

after_success:
- if [ "$TRAVIS_OS_NAME" == "linux" -a ! -z "$TRAVIS_TAG" ]; then
- if [ "$TRAVIS_BUILD_STAGE_NAME" == "test" -a "$TRAVIS_OS_NAME" == "linux" -a ! -z "$TRAVIS_TAG" ]; then
echo "Executing release on tag build $TRAVIS_TAG";
docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD";
make release;
ARCH=linux CPU_ARCH="$TRAVIS_CPU_ARCH" make release;
else
echo "Not executing release on non-tag build";
fi
15 changes: 14 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ GIT_HASH := $$(git rev-parse --short HEAD)
GOBUILD_VERSION_ARGS := -ldflags "-s -X $(VERSION_VAR)=$(REPO_VERSION) -X $(GIT_VAR)=$(GIT_HASH) -X $(BUILD_DATE_VAR)=$(BUILD_DATE)"
# useful for other docker repos
DOCKER_REPO ?= jtblin
IMAGE_NAME := $(DOCKER_REPO)/$(BINARY_NAME)
CPU_ARCH ?= amd64
IMAGE_NAME := $(DOCKER_REPO)/$(BINARY_NAME)-$(CPU_ARCH)
MANIFEST_NAME := $(DOCKER_REPO)/$(BINARY_NAME)
ARCH ?= darwin
GOLANGCI_LINT_VERSION ?= v1.23.8
GOLANGCI_LINT_CONCURRENCY ?= 4
Expand Down Expand Up @@ -87,6 +89,17 @@ ifeq (, $(findstring -rc, $(REPO_VERSION)))
docker push $(IMAGE_NAME):latest
endif

release-manifest:
for tag in latest $(REPO_VERSION); do \
for arch in amd64 arm64; do \
docker pull $(MANIFEST_NAME)-$$arch:$$tag; \
done; \
docker manifest create $(MANIFEST_NAME):$$tag --amend \
$(MANIFEST_NAME)-amd64:$$tag \
$(MANIFEST_NAME)-arm64:$$tag; \
docker manifest push $(MANIFEST_NAME):$$tag; \
done

version:
@echo $(REPO_VERSION)

Expand Down

0 comments on commit 6d5b2a3

Please sign in to comment.