add travis and auto deployment

This commit is contained in:
Niko Storni 2020-08-11 17:23:56 +02:00
parent 60479a8694
commit ced5578445
4 changed files with 67 additions and 0 deletions

28
.goreleaser.yml Normal file
View file

@ -0,0 +1,28 @@
# This is an example goreleaser.yaml file with some sane defaults.
# Make sure to check the documentation at http://goreleaser.com
builds:
- env:
- CGO_ENABLED=0
goos:
- linux
goarch:
- amd64
ldflags:
- -X "{{ .Env.IMPORTPATH }}/meta.semVersion={{ .Tag }}" -X "{{ .Env.IMPORTPATH }}/meta.version={{ .Env.VERSIONSHORT }}" -X "{{ .Env.IMPORTPATH }}/meta.versionLong={{ .Env.VERSIONLONG }}" -X "{{ .Env.IMPORTPATH }}/meta.commitMsg={{ .Env.COMMITMSG }}"
archives:
- id: zip
name_template: '{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}'
replacements:
linux: Linux
amd64: x86_64
format: zip
checksum:
name_template: 'checksums.txt'
snapshot:
name_template: "{{ .Tag }}-next"
changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'

27
.travis.yml Normal file
View file

@ -0,0 +1,27 @@
os: linux
dist: bionic
language: go
go:
- 1.14.4
install: true
cache:
directories:
- $HOME/.cache/go-build
- $HOME/gopath/pkg/mod
services:
- docker
script:
- make
deploy:
provider: script
skip_cleanup: true
script: ./scripts/deploy.sh
file: bin/voidwalker
on:
repo: lbryio/voidwalker
tags: true

7
scripts/deploy.sh Executable file
View file

@ -0,0 +1,7 @@
#!/usr/bin/env bash
export IMPORTPATH="github.com/lbryio/voidwalker"
export VERSIONSHORT="${TRAVIS_COMMIT:-"$(git describe --tags --always --dirty)"}"
export VERSIONLONG="${TRAVIS_COMMIT:-"$(git describe --tags --always --dirty --long)"}"
export COMMITMSG="$(echo ${TRAVIS_COMMIT_MESSAGE:-"$(git show -s --format=%s)"} | tr -d '"' | head -n 1)"
curl -sL https://git.io/goreleaser | bash

5
scripts/release.sh Executable file
View file

@ -0,0 +1,5 @@
#!/usr/bin/env bash
GO111MODULE=off go get github.com/caarlos0/svu
git tag `svu "$1"`
git push --tags