Skip to content

Commit

Permalink
Automatically publish releases
Browse files Browse the repository at this point in the history
  • Loading branch information
justincampbell committed Jun 7, 2018
1 parent d8eda95 commit 8fcc7a9
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 38 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
release/
20 changes: 20 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
language: go

sudo: false

go:
- "1.10"

script:
- make test release

deploy:
provider: releases
file: release/pomodoro*
file_glob: true
skip_cleanup: true
api_key:
secure: ZQObSk5C6MViH8yiKj89dCniBfHa0/625SAiqhU1anoiSioVcG0oAdeiH14zIlCb8Ivf8Ng831R6Jddr/nAPhFsYkpJshbcYAALgReAdguzwons2hNp9BUM07AKlx8Ed3ygECwA8ZQsaJZTV6t6lTAf6t6p0r8JHtxpRRu1ex8eItsJBwEp5KalPemk5dccxAWsJ1M/uSJFMMMS6HpP9y1MWOsHNyFQalx0f9DiW2Gmcy8wtAqfjCdZubtwxBR8gsN/bLT5t2ybBSJea/E9Qao7LGZc8WQUU77CteJkaoWsctEk7bShD9Vw0oioEy7c5ZqjWNHufA3/NEGXM5IvbsHktArQ23PYaHVh5gFyD66nCUDd6wB7MDtOtx8JJzuX7+UpvAePj5ARi0Rdn/pFz4W2rwKErWRSlgZnLNnD9Ay62Upi8XUGoeNoIP5/R7vJmfgD3DuecQmLgEnzLc4NkjV4eH4nPfn4+LRJkc6GD/cZPWj4wAM/GOFBTkVeJomEtPjJViQ1uSPDIskq0YQ0lopmXdeXuIqtzvS4pcq+JlxWPLEa6ZrOs3INT2nPJ05gMOiAhTwGvKuMYN80h80zksW3+Yq0b8ZaNl2O1Ogt2ImDgJvptJt4kEGUjKWFVIVDiy+57ksd1CaiUt/ns1FLt/bCtg56DEB2FUvIYNK3fCA8=
on:
repo: open-pomodoro/openpomodoro-cli
tags: true
46 changes: 34 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,15 +1,37 @@
DEMO_COMMANDS := start status end status start clear status
DEMO_COMMANDS := start status
TMPDIR := $(shell mktemp -d)
NAME := pomodoro
BINDIR := release
BIN := $(BINDIR)/$(NAME)

demo: bin/pomodoro
@for s in $(DEMO_COMMANDS); do \
echo; \
echo $$ pomodoro $$s; \
pomodoro --directory $(TMPDIR) $$s; \
done
GOX_OSARCH := darwin/amd64 linux/amd64
VERSION := 0.1.0

bin/pomodoro: *.go
go build -o $@
LDFLAGS := "-X main.Version=$(VERSION)"

.PHONY: demo
default: deps test build

test: deps
go test ./...

install: build
cp $(BIN) /usr/local/bin/$(NAME)

build: $(BIN)

clean:
rm -rf $(BINDIR)

$(BIN): deps
go build -ldflags $(LDFLAGS) -o $@

release: deps
gox \
-ldflags $(LDFLAGS) -osarch="$(GOX_OSARCH)" \
-output="release/$(NAME)_{{.OS}}_{{.Arch}}_$(VERSION)" \
./cmd/$(NAME)
cd release/; for f in *; do mv -v $$f $(NAME); tar -zcf $$f.tar.gz $(NAME); rm $(NAME); done

deps:
go get -t ./...
go get github.com/mitchellh/gox

.PHONY: all build clean default deps release test
26 changes: 0 additions & 26 deletions cmd/cmd_test.go

This file was deleted.

8 changes: 8 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@ package main

import "github.com/open-pomodoro/openpomodoro-cli/cmd"

// Version is the version of this tool. It is set from LDFLAGS in the
// Makefile/build process.
var Version = "dev"

func init() {
cmd.RootCmd.Version = Version
}

func main() {
cmd.Execute()
}

0 comments on commit 8fcc7a9

Please sign in to comment.