Skip to content

Commit

Permalink
Setup goreleaser
Browse files Browse the repository at this point in the history
  • Loading branch information
khlieng committed Nov 17, 2018
1 parent 4dcf674 commit b54cb42
Show file tree
Hide file tree
Showing 6 changed files with 76 additions and 10 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
build
release
dist
dispatch
client/dist
client/node_modules
Expand Down
41 changes: 41 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
builds:
- ldflags:
- -s -w -X github.com/khlieng/dispatch/commands.version=v{{.Version}} -X github.com/khlieng/dispatch/commands.commit={{.ShortCommit}} -X github.com/khlieng/dispatch/commands.date={{.Date}}

env:
- CGO_ENABLED=0

goos:
- linux
- darwin
- windows

goarch:
- amd64
- arm
- arm64

goarm:
- 6
- 7

archive:
files:
- none*

format_overrides:
- goos: windows
format: zip

checksum:
name_template: "checksums.txt"

changelog:
filters:
exclude:
- "(?i)^update.*dep"
- Merge pull request
- Merge branch

release:
name_template: "{{.Version}}"
17 changes: 12 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
language: go

go:
- "1.10.x"
- "1.11.x"
- 1.x
- tip

os:
Expand All @@ -16,15 +15,23 @@ matrix:
install:
- go get github.com/jteeuwen/go-bindata/...
- cd client
- nvm install 10.11.0
- nvm use 10.11.0
- nvm install 11.2.0
- nvm use 11.2.0
- npm install -g yarn
- yarn global add gulp@next
- yarn --ignore-engines
- yarn

script:
- yarn test:verbose
- gulp build
- cd ..
- go vet ./...
- go test -v -race ./...

deploy:
- provider: script
skip_cleanup: true
script: curl -sL https://git.io/goreleaser | bash
on:
tags: true
condition: $TRAVIS_OS_NAME = linux && $TRAVIS_GO_VERSION = 1.*
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ There is a few different ways of getting it:
### 1. Binary

- **[Windows (x64)](https://github.com/khlieng/dispatch/releases/download/v0.5/dispatch_windows_amd64.zip)**
- **[OS X (x64)](https://github.com/khlieng/dispatch/releases/download/v0.5/dispatch_darwin_amd64.zip)**
- **[macOS (x64)](https://github.com/khlieng/dispatch/releases/download/v0.5/dispatch_darwin_amd64.zip)**
- **[Linux (x64)](https://github.com/khlieng/dispatch/releases/download/v0.5/dispatch_linux_amd64.tar.gz)**
- [Other versions](https://github.com/khlieng/dispatch/releases)

Expand Down
14 changes: 12 additions & 2 deletions commands/dispatch.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,32 @@ import (
"github.com/spf13/viper"
)

var (
version = "dev"
commit = "none"
date = "unknown"
)

const logo = `
____ _ _ _
| _ \ (_) ___ _ __ __ _ | |_ ___ | |__
| | | || |/ __|| '_ \ / _ || __|/ __|| '_ \
| |_| || |\__ \| |_) || (_| || |_| (__ | | | |
|____/ |_||___/| .__/ \__,_| \__|\___||_| |_|
|_|
v0.5
%s
Commit: %s
Build Date: %s
`

var rootCmd = &cobra.Command{
Use: "dispatch",
Short: "Web-based IRC client in Go.",
PersistentPreRun: func(cmd *cobra.Command, args []string) {
if cmd.Use == "dispatch" {
fmt.Println(logo)
fmt.Printf(logo, version, commit, date)
}

storage.Initialize(viper.GetString("dir"))
Expand Down
9 changes: 9 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env bash

Import="github.com/khlieng/dispatch/commands"

Version=$(git describe --tags)
Commit=$(git rev-parse --short HEAD)
Date=$(date +'%Y-%m-%dT%TZ')

go install -ldflags "-s -w -X $Import.version=$Version -X $Import.commit=$Commit -X $Import.date=$Date"

0 comments on commit b54cb42

Please sign in to comment.