Skip to content

Commit

Permalink
travis with releases
Browse files Browse the repository at this point in the history
  • Loading branch information
mcuadros committed Sep 30, 2015
1 parent 3a5cb95 commit f086da6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 20 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ deploy:
provider: releases
api_key: $GITHUB_TOKEN
file:
- build/ofelia_darwin_amd64.tar.gz
- build/ofelia_linux_amd64.tar.gz
- build/ofelia_${TRAVIS_TAG}_darwin_amd64.tar.gz
- build/ofelia_${TRAVIS_TAG}_linux_amd64.tar.gz
skip_cleanup: true
on:
tags: true
27 changes: 9 additions & 18 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Package configuration
PROJECT = ofelia
COMMANDS = ofelia
DEPENDENCIES = github.com/aktau/github-release
DEPENDENCIES =

# Environment
BASE_PATH := $(shell pwd)
Expand All @@ -24,6 +24,10 @@ GOGET = $(GOCMD) get -v
GOTEST = $(GOCMD) test -v
GHRELEASE = github-release

ifneq ($(origin TRAVIS_TAG), undefined)
BRANCH := $(TRAVIS_TAG)
endif

# Rules
all: clean upload

Expand All @@ -38,27 +42,14 @@ packages: dependencies
for os in $(PKG_OS); do \
for arch in $(PKG_ARCH); do \
cd $(BASE_PATH); \
mkdir -p $(BUILD_PATH)/$(PROJECT)_$${os}_$${arch}; \
mkdir -p $(BUILD_PATH)/$(PROJECT)_$(BRANCH)_$${os}_$${arch}; \
for cmd in $(COMMANDS); do \
GOOS=$${os} GOARCH=$${arch} $(GOCMD) build -ldflags "-X main.version $(SHA1) -X main.build \"$(BUILD)\"" -o $(BUILD_PATH)/$(PROJECT)_$${os}_$${arch}/$${cmd} $${cmd}.go ; \
GOOS=$${os} GOARCH=$${arch} $(GOCMD) build -ldflags "-X main.version $(BRANCH) -X main.build \"$(BUILD)\"" -o $(BUILD_PATH)/$(PROJECT)_$(BRANCH)_$${os}_$${arch}/$${cmd} $${cmd}.go ; \
done; \
for content in $(PKG_CONTENT); do \
cp -rf $${content} $(BUILD_PATH)/$(PROJECT)_$${os}_$${arch}/; \
cp -rf $${content} $(BUILD_PATH)/$(PROJECT)_$(BRANCH)_$${os}_$${arch}/; \
done; \
cd $(BUILD_PATH) && tar -cvzf $(BUILD_PATH)/$(PROJECT)_$${os}_$${arch}.tar.gz $(PROJECT)_$${os}_$${arch}/; \
done; \
done;

upload: packages
cd $(BASE_PATH); \
$(GHRELEASE) delete --tag $(PKG_TAG); \
$(GHRELEASE) release --tag $(PKG_TAG) --name "$(PKG_TAG) ($(SHA1))"; \
for os in $(PKG_OS); do \
for arch in $(PKG_ARCH); do \
$(GHRELEASE) upload \
--tag $(PKG_TAG) \
--name "$(PROJECT)_$${os}_$${arch}.tar.gz" \
--file $(BUILD_PATH)/$(PROJECT)_$${os}_$${arch}.tar.gz; \
cd $(BUILD_PATH) && tar -cvzf $(BUILD_PATH)/$(PROJECT)_$(BRANCH)_$${os}_$${arch}.tar.gz $(PROJECT)_$(BRANCH)_$${os}_$${arch}/; \
done; \
done;

Expand Down

0 comments on commit f086da6

Please sign in to comment.