-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
44e30db
commit 40179e0
Showing
6 changed files
with
130 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
bin/* | ||
dist/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
language: go | ||
go: | ||
- 1.7 | ||
script: | ||
- go test -v ./... | ||
before_deploy: | ||
- ./release | ||
deploy: | ||
provider: releases | ||
api_key: | ||
secure: "oXycHqW9WaRJvfWeNOKEElHzolcaEGc9WCPa9f6j5xUD5ZMA4hjAeJrj+HhrdjfUIiGOvIUY2k1VYcDbHPIWJ9HtC7xg1oa+ZRt+qFvT93JteNnfGG/gVabbJMOtohNKy01jbJoBHLNoDlken7+4kmPJdxFvr1/lQtc7YvM0B/qr7ZxxnC3uKePHIUkSJw/AutPVVVu7M2xJoABqSfREvdyD5zSVKNH7zcuXj7mTIOMdoAcpLNjLDo+X0jFam78dVYQSmIA3d4jaG7KJR47f3L93kPhVPEfZA0FP7iG9vqGg66TjoUca1qFX/kBGn05QSXEZjPUj3c3w5qAT67fKBOiH88fgWgciwWxU50FWiY5AsmgwiLpyPxYoIodTiBMfTRP4MycdaDSgTiX5QBmdlaLDF/PoUVxsXBXMKu/fxq/Kq7mIYc0pbkZlFwqtsjBccvypukeBPMNfLrzL4EVML+P2Oih4edHLcKmXGwbBBonCVHrdd1OZSmKpESe1ZPwXlsuulEJ9m2pqpvNMlqgSNbd7TETQfK/sK04VcCuRgYguMEpGwb0PN7L5S/Wa2s6YBQS7cPwomgkw46MBqKGwBGZmrsJY/M7bEdFTwlJesoHfZOHc7khOXziQAjTAaeRcpvAWzXMz9E7zbxvCVI+Hg1e1/dsn3hUQKUhlBtLLxvY=" | ||
skip_cleanup: true | ||
file_glob: true | ||
file: "dist/*" | ||
on: | ||
tags: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
Copyright (c) 2016 Kazuki Suda <kazuki.suda@gmail.com> | ||
|
||
MIT License | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining | ||
a copy of this software and associated documentation files (the | ||
"Software"), to deal in the Software without restriction, including | ||
without limitation the rights to use, copy, modify, merge, publish, | ||
distribute, sublicense, and/or sell copies of the Software, and to | ||
permit persons to whom the Software is furnished to do so, subject to | ||
the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be | ||
included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | ||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | ||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
# the current git commit hash | ||
COMMIT=`git rev-parse HEAD` | ||
|
||
# the current git tag | ||
VERSION=$(git describe --exact-match --abbrev=0 --tags ${COMMIT} 2> /dev/null || true) | ||
[ -z "$VERSION" ] && VERSION=$COMMIT | ||
|
||
# check for changed files (not untracked files) | ||
[ -n "$(git diff --shortstat 2> /dev/null | tail -n1)" ] && VERSION="${VERSION}-dirty" | ||
|
||
TARGET=github.com/superbrothers-sandbox/try-travisci-github-release-go | ||
BINARY=${BINARY:-bin/hello} | ||
LDFLAGS="-X 'main.gitVersion=${VERSION}' -X 'main.gitCommit=${COMMIT}'" | ||
|
||
CGO_ENABLED=0 go build -a -installsuffix cgo -o=$BINARY -ldflags "$LDFLAGS" | ||
# vim: ft=sh ts=2 st=2 sw=2 : |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package main | ||
|
||
import ( | ||
"flag" | ||
"fmt" | ||
"html/template" | ||
"os" | ||
"runtime" | ||
) | ||
|
||
var ( | ||
gitVersion = "v0.0.0" | ||
gitCommit = "$Format:%H$" | ||
|
||
printVersion = false | ||
) | ||
|
||
const versionTemplate = `Git version: {{.GitVersion}} | ||
Git commit: {{.GitCommit}} | ||
Go version: {{.GoVersion}} | ||
Compiler: {{.Compiler}} | ||
Platform: {{.Platform}} | ||
` | ||
|
||
func main() { | ||
flag.BoolVar(&printVersion, "version", printVersion, "Print version and exit") | ||
flag.Parse() | ||
|
||
if printVersion { | ||
tmpl := template.Must(template.New("").Parse(versionTemplate)) | ||
if err := tmpl.Execute(os.Stderr, struct { | ||
GitVersion string | ||
GitCommit string | ||
GoVersion string | ||
Compiler string | ||
Platform string | ||
}{ | ||
GitVersion: gitVersion, | ||
GitCommit: gitCommit, | ||
GoVersion: runtime.Version(), | ||
Compiler: runtime.Compiler, | ||
Platform: fmt.Sprintf("%s/%s", runtime.GOOS, runtime.GOARCH), | ||
}); err != nil { | ||
panic(err) | ||
} | ||
|
||
os.Exit(1) | ||
} | ||
|
||
arg := "World" | ||
if flag.Arg(0) != "" { | ||
arg = flag.Arg(0) | ||
} | ||
|
||
fmt.Printf("Hello %s\n", arg) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
PLATFORMS="linux/amd64 darwin/amd64 freebsd/amd64 windows/amd64" | ||
|
||
for PLATFORM in $PLATFORMS; do | ||
export GOOS=${PLATFORM%/*} | ||
export GOARCH=${PLATFORM#*/} | ||
export BINARY="dist/hello-${GOOS}-${GOARCH}" | ||
./build | ||
sha256sum "$BINARY" | head -c 64 > "$BINARY".sha256 | ||
done | ||
# vim: ft=sh ts=2 st=2 sw=2 : |