diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..d943fa3 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,18 @@ +language: go +go: +- 1.9 +script: go vet +before_deploy: +- "./build.sh" +deploy: + provider: releases + api_key: + secure: NvHJ1rlXl5hMaQ2iat9/zT0bgTtc+O8AyqBhgJlMHdpXanT1d+zq2ZU6BM6O8nB6jceeocz/ZVmceU3IYCZE9QqYgWMhDphabtLo+ykp7QltQUb4JBqXJ/dIZ/t0nJzMxWbnJ7LrCVs3iXk/jrffCNJXrrO00CC2aT4eu2nS2Vsx3ZZom6Q4kkvu05+iO+3VH6L2obLiUnTPonfZLZQgd4TM+SUaqjvlWOY6/Ubzs6qsf8OpFOazqH7xFkiuDlli5nfpr47Cp0Fw5k0+A9Rk8OmPV6R3LQx9ffOAxbjZDga7qqpohNGZhWgBjMZKc8t/GEHVFHRfRE5bAqG7leEaPJzhyivxP1L4gV/kKBqrEtbvpDIlpCfeHLfL2l65smnN7U4QfA66VY2u/87Ef3YPXo998GMBfdU0YdeuU3yL/EAOSZG/5pnUrwVvPnYQQocnAsYMbYZAzOY8SR/DiT3aFFZ6hL+VkZG4FVWlurL1n5LmGxQWypLE54xQjWtFjcBIEK2eyVHXCCe0rXjDcgHGKbruCWTlbiAN3pqIayQ2W9GpUcAAvTtfzqmFT7wA4rKduY/09rouSF6rCSUCu38uvRx+HGirRahUt11/NlSWYqUAyK2GkNB8yEY2G4dL0KpgN0X6AhJR26UFlgCLb1tTE8Hmexlbnc/rP7/fQfQ1vbY= + skip_cleanup: true + file: + - release/pve_exporter-linux-amd64 + - release/pve_exporter-linux-amd64.sha256 + on: + repo: wakeful/pve_exporter + branch: master + tags: true diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..87820ee --- /dev/null +++ b/build.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env bash + +set -e + +VERSION=$(git describe --tags --dirty) +GO_BUILD_CMD="go build -a -installsuffix cgo" +GO_BUILD_LDFLAGS="-s -w -X main.version=$VERSION" + +BUILD_PLATFORMS="linux" +BUILD_ARCHS="amd64" + +mkdir -p release + +for OS in ${BUILD_PLATFORMS[@]}; do + for ARCH in ${BUILD_ARCHS[@]}; do + NAME="pve_exporter-$OS-$ARCH" + echo "Building for $OS/$ARCH" + GOARCH=$ARCH GOOS=$OS CGO_ENABLED=0 $GO_BUILD_CMD -ldflags "$GO_BUILD_LDFLAGS"\ + -o "release/$NAME" pve_exporter.go + shasum -a 256 "release/$NAME" > "release/$NAME".sha256 + done +done \ No newline at end of file