Setup goreleaser

This commit is contained in:
Ken-Håvard Lieng 2018-11-16 05:17:20 +01:00
parent 4dcf674c4b
commit b54cb42426
6 changed files with 76 additions and 10 deletions

3
.gitignore vendored
View File

@ -1,5 +1,4 @@
build
release
dist
dispatch
client/dist
client/node_modules

41
.goreleaser.yml Normal file
View File

@ -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}}"

View File

@ -1,8 +1,7 @@
language: go
go:
- "1.10.x"
- "1.11.x"
- 1.x
- tip
os:
@ -16,11 +15,11 @@ 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
@ -28,3 +27,11 @@ script:
- 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.*

View File

@ -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)

View File

@ -17,6 +17,12 @@ import (
"github.com/spf13/viper"
)
var (
version = "dev"
commit = "none"
date = "unknown"
)
const logo = `
____ _ _ _
| _ \ (_) ___ _ __ __ _ | |_ ___ | |__
@ -24,7 +30,11 @@ const logo = `
| |_| || |\__ \| |_) || (_| || |_| (__ | | | |
|____/ |_||___/| .__/ \__,_| \__|\___||_| |_|
|_|
v0.5
%s
Commit: %s
Build Date: %s
`
var rootCmd = &cobra.Command{
@ -32,7 +42,7 @@ var rootCmd = &cobra.Command{
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"))

9
install.sh Executable file
View File

@ -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"