diff --git a/.gitignore b/.gitignore index 8f4c9b43..d48edb30 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ -build -release +dist dispatch client/dist client/node_modules diff --git a/.goreleaser.yml b/.goreleaser.yml new file mode 100644 index 00000000..c25bceab --- /dev/null +++ b/.goreleaser.yml @@ -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}}" diff --git a/.travis.yml b/.travis.yml index 609417a1..3349b9e8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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.* diff --git a/README.md b/README.md index b49ffe01..312e5b3f 100644 --- a/README.md +++ b/README.md @@ -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) diff --git a/commands/dispatch.go b/commands/dispatch.go index fd5afff5..b5c44f9f 100644 --- a/commands/dispatch.go +++ b/commands/dispatch.go @@ -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")) diff --git a/install.sh b/install.sh new file mode 100755 index 00000000..38d76841 --- /dev/null +++ b/install.sh @@ -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"