commit
c20caeefb7
|
@ -9,6 +9,8 @@ language: go
|
|||
go: 1.9
|
||||
sudo: true # give us 7.5GB and >2 bursted cores.
|
||||
before_install:
|
||||
# Travis only fetches 50 commits by default, and we want them all so we can do git describe --tags
|
||||
- git fetch --unshallow
|
||||
# Dep for Go dependency management.
|
||||
- go get -v github.com/golang/dep/cmd/dep
|
||||
# Gometalinter for good Go linting/hygiene.
|
||||
|
|
|
@ -4,18 +4,16 @@ $ErrorActionPreference="Stop"
|
|||
|
||||
$Root=Join-Path $PSScriptRoot ".."
|
||||
$PublishDir=New-Item -ItemType Directory -Path "$env:TEMP\$([System.IO.Path]::GetRandomFileName())"
|
||||
$GitVersion=$(git rev-parse HEAD)
|
||||
$PublishFile="$(Split-Path -Parent -Path $PublishDir)\$GitVersion.zip"
|
||||
$GitHash=$(git rev-parse HEAD)
|
||||
$PublishFile="$(Split-Path -Parent -Path $PublishDir)\$GitHash.zip"
|
||||
$Version = $(git describe --tags 2>$null)
|
||||
$Branch = $(if (Test-Path env:APPVEYOR_REPO_BRANCH) { $env:APPVEYOR_REPO_BRANCH } else { $(git rev-parse --abbrev-ref HEAD) })
|
||||
$PublishTargets = @($GitVersion, $Branch)
|
||||
|
||||
# If there's a tag, publish using that description as well
|
||||
try { $PublishTargets += $(git describe --tags 2>$null) } catch { }
|
||||
$PublishTargets = @($GitHash, $Version, $Branch)
|
||||
|
||||
function RunGoBuild($goPackage) {
|
||||
$binRoot = New-Item -ItemType Directory -Force -Path "$PublishDir\bin"
|
||||
$outputName = Split-Path -Leaf $(go list -f "{{.Target}}" $goPackage)
|
||||
go build -o $binRoot\${outputName} $goPackage
|
||||
go build -ldflags "-X main.version=$Version" -o "$binRoot\$outputName" $goPackage
|
||||
}
|
||||
|
||||
function CopyPackage($pathToModule, $moduleName) {
|
||||
|
|
|
@ -4,13 +4,14 @@ set -o nounset -o errexit -o pipefail
|
|||
|
||||
ROOT=$(dirname $0)/..
|
||||
PUBDIR=$(mktemp -du)
|
||||
GITVER=$(git rev-parse HEAD)
|
||||
PUBFILE=$(dirname ${PUBDIR})/${GITVER}.tgz
|
||||
GITHASH=$(git rev-parse HEAD)
|
||||
PUBFILE=$(dirname ${PUBDIR})/${GITHASH}.tgz
|
||||
VERSION=$(git describe --tags 2>/dev/null)
|
||||
|
||||
# Figure out which branch we're on. Prefer $TRAVIS_BRANCH, if set, since
|
||||
# Travis leaves us at detached HEAD and `git rev-parse` just returns "HEAD".
|
||||
BRANCH=${TRAVIS_BRANCH:-$(git rev-parse --abbrev-ref HEAD)}
|
||||
declare -a PUBTARGETS=(${GITVER} $(git describe --tags 2>/dev/null) ${BRANCH})
|
||||
declare -a PUBTARGETS=(${GITHASH} ${VERSION} ${BRANCH})
|
||||
|
||||
# usage: run_go_build <path-to-package-to-build>
|
||||
function run_go_build() {
|
||||
|
@ -21,7 +22,7 @@ function run_go_build() {
|
|||
fi
|
||||
|
||||
mkdir -p "${PUBDIR}/bin"
|
||||
go build -o "${PUBDIR}/bin/${output_name}${bin_suffix}" "$1"
|
||||
go build -ldflags "-X main.version=${VERSION}" -o "${PUBDIR}/bin/${output_name}${bin_suffix}" "$1"
|
||||
}
|
||||
|
||||
# usage: copy_package <path-to-module> <module-name>
|
||||
|
|
|
@ -11,6 +11,6 @@ if (!(Test-Path $PublishScript)) {
|
|||
$ReleaseInfo=& $PSScriptRoot\make_release.ps1
|
||||
|
||||
$PublishTargets=${ReleaseInfo}.Targets
|
||||
& $PublishScript $ReleaseInfo.ArchivePath "pulumi/windows/x64" @PublishTargets
|
||||
& $PublishScript $ReleaseInfo.ArchivePath "pulumi/windows/amd64" @PublishTargets
|
||||
|
||||
Remove-Item -Force $ReleaseInfo.ArchivePath
|
||||
|
|
Loading…
Reference in a new issue