From 74df46e0ee9497d26dcfefd7e0d2ca6d17077320 Mon Sep 17 00:00:00 2001 From: Niko Storni Date: Wed, 27 Feb 2019 20:14:26 +0100 Subject: [PATCH] implement goreleaser --- .goreleaser.yml | 28 ++++++++++++++++++++++++++++ .travis.yml | 5 +++-- scripts/deploy.sh | 7 +++++++ scripts/release.sh | 5 +++++ 4 files changed, 43 insertions(+), 2 deletions(-) create mode 100644 .goreleaser.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..133e7d8 --- /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 }}" +archive: + 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:' + diff --git a/.travis.yml b/.travis.yml index 583d034..c963aee 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,11 +8,12 @@ go: env: - GO111MODULE=on deploy: - provider: releases + provider: script + skip_cleanup: true + script: ./scripts/deploy.sh api_key: secure: 8WrFVcu/Nf6/BjxSXS6cewnm+2KWbJ2hz8A8FQ1VrsUDP+R0R1QYfO7QtbfSsoCuvtWNy5Tvk/zpjRH8ZvAVR16kE++rX0NYqXNzf19l0kgZQQQjQxulGRBPCa/BdqO99NcSFyyG63dpMOL9amcvH0FPGMGO2V3QsneB3EgtsK4EZAAFDO0B9GqWrB/cMlhzHyPiUN258BRg9jjka8Dnsxcprmk9RMn0Eoc7Doavt4JGbkBRo2rEfNUpKHofELOu5YZfuZZsKgyZ0yX+tGZhafqyqHyEZLruKp42DtzSlkBwzDq1Yix84WOgvPABBiX15K4vqPUpz0PnPktfqLmzvDSs3pT3Lu5IB47mnTzydlD4lRn31Id+1vb7vaIgbXeujt7cFAeQ/Oy6X2wMv9PQgS6WrP/l3b8RzJBdDCB5kG9QwOI6V5C35nQlp5C0R5Z5wR61WTjeaU0Ck9xzXOsXnKjKZdTyrPfw/x96KjuIwt/rjYc3RLduR0YrngS7sOabb9WbErNLjI32w/LEK9A39yAwXl9KKxp4I+1QYLzqzVkN/TzHtrpmb04EJFhgb7wAcRu3n5T0jyTUFskFbOMQ+CypekIB2t8vAhozy56jH116l60zsG3Je7B+Caug0Idn+0B8w1OKqVnjtic+dg6NzHsUIp+0ADBT9OAQDjLkymM= file: bin/ytsync on: repo: lbryio/ytsync tags: true - skip_cleanup: true \ No newline at end of file diff --git a/scripts/deploy.sh b/scripts/deploy.sh new file mode 100755 index 0000000..ea477d7 --- /dev/null +++ b/scripts/deploy.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +export IMPORTPATH="github.com/lbryio/ytsync" +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..aec443d --- /dev/null +++ b/scripts/release.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +go get github.com/caarlos0/svu +git tag `svu "$1"` +git push --tags \ No newline at end of file