From ced5578445f8242e639cd2d7cd3742fad5a2e946 Mon Sep 17 00:00:00 2001 From: Niko Storni Date: Tue, 11 Aug 2020 17:23:56 +0200 Subject: [PATCH] add travis and auto deployment --- .goreleaser.yml | 28 ++++++++++++++++++++++++++++ .travis.yml | 27 +++++++++++++++++++++++++++ scripts/deploy.sh | 7 +++++++ scripts/release.sh | 5 +++++ 4 files changed, 67 insertions(+) create mode 100644 .goreleaser.yml create mode 100644 .travis.yml create mode 100755 scripts/deploy.sh create mode 100755 scripts/release.sh diff --git a/.goreleaser.yml b/.goreleaser.yml new file mode 100644 index 0000000..d319ca7 --- /dev/null +++ b/.goreleaser.yml @@ -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:' \ No newline at end of file diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..6a0972e --- /dev/null +++ b/.travis.yml @@ -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 diff --git a/scripts/deploy.sh b/scripts/deploy.sh new file mode 100755 index 0000000..cdf34fb --- /dev/null +++ b/scripts/deploy.sh @@ -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 \ No newline at end of file diff --git a/scripts/release.sh b/scripts/release.sh new file mode 100755 index 0000000..965d9a4 --- /dev/null +++ b/scripts/release.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +GO111MODULE=off go get github.com/caarlos0/svu +git tag `svu "$1"` +git push --tags