Add a release system. (#550)

* feat: add release system.
* feat: goreleaser.
* review: minor changes.
This commit is contained in:
Ludovic Fernandez 2018-05-29 19:40:00 +02:00 committed by Wyatt Johnson
parent 8e9c5ac3e6
commit 3cc9a19a1c
5 changed files with 86 additions and 16 deletions

2
.gitignore vendored
View file

@ -2,3 +2,5 @@ lego.exe
lego lego
.lego .lego
.idea .idea
dist/
builds/

38
.goreleaser.yml Normal file
View file

@ -0,0 +1,38 @@
project_name: lego
builds:
- binary: lego
goos:
- windows
- darwin
- linux
- freebsd
- openbsd
- solaris
goarch:
- amd64
- 386
- arm
- arm64
goarm:
- 7
ignore:
- goos: darwin
goarch: 386
- goos: openbsd
goarch: arm
archive:
name_template: '{{ .ProjectName }}_v{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ if .Arm
}}v{{ .Arm }}{{ end }}'
format: tar.gz
format_overrides:
- goos: windows
format: zip
files:
- LICENSE
- CHANGELOG.md
release:
disable: true

View file

@ -1,16 +1,35 @@
language: go language: go
go: go:
- 1.8.x - 1.9.x
- 1.9.x - 1.x
- tip
services: services:
- memcached - memcached
env: env:
- MEMCACHED_HOSTS=localhost:11211 - MEMCACHED_HOSTS=localhost:11211
install:
- go get -t ./...
script:
- go vet ./...
- go test -v ./...
before_install: before_install:
- '[ "${TRAVIS_PULL_REQUEST}" = "false" ] && openssl aes-256-cbc -K $encrypted_26c593b079d9_key -iv $encrypted_26c593b079d9_iv -in .gitcookies.enc -out .gitcookies -d || true' - '[ "${TRAVIS_PULL_REQUEST}" = "false" ] && openssl aes-256-cbc -K $encrypted_26c593b079d9_key -iv $encrypted_26c593b079d9_iv -in .gitcookies.enc -out .gitcookies -d || true'
install:
- go get -t ./...
deploy:
- provider: script
skip_cleanup: true
script: curl -sL https://git.io/goreleaser | bash
on:
tags: true
condition: $TRAVIS_GO_VERSION =~ ^1\.10\.[0-9]+$
- provider: releases
api_key: ${GITHUB_TOKEN}
file: dist/lego_*
skip_cleanup: true
overwrite: true
file_glob: true
on:
tags: true
condition: $TRAVIS_GO_VERSION =~ ^1\.10\.[0-9]+$

15
Makefile Normal file
View file

@ -0,0 +1,15 @@
.PHONY: all
default: clean checks test build
test: clean
go test -v -cover ./...
clean:
rm -rf dist/ builds/ cover.out
checks:
go vet ./...
build: clean
go build

10
cli.go
View file

@ -7,7 +7,6 @@ import (
"log" "log"
"os" "os"
"path" "path"
"strings"
"text/tabwriter" "text/tabwriter"
"github.com/urfave/cli" "github.com/urfave/cli"
@ -25,18 +24,15 @@ func logger() *log.Logger {
return Logger return Logger
} }
var gittag string var (
version = "dev"
)
func main() { func main() {
app := cli.NewApp() app := cli.NewApp()
app.Name = "lego" app.Name = "lego"
app.Usage = "Let's Encrypt client written in Go" app.Usage = "Let's Encrypt client written in Go"
version := "0.4.1"
if strings.HasPrefix(gittag, "v") {
version = gittag
}
app.Version = version app.Version = version
acme.UserAgent = "lego/" + app.Version acme.UserAgent = "lego/" + app.Version