2018-01-08 08:54:30 +00:00
|
|
|
version: '{build}'
|
|
|
|
image: 'Visual Studio 2017'
|
2018-03-16 12:07:56 +00:00
|
|
|
platform: 'x64'
|
2018-01-08 08:54:30 +00:00
|
|
|
|
2018-03-16 12:07:56 +00:00
|
|
|
clone_folder: 'c:\gopath\src\github.com\drone-plugins\drone-matrix'
|
2018-01-08 08:54:30 +00:00
|
|
|
max_jobs: 1
|
|
|
|
|
|
|
|
environment:
|
2018-03-16 12:07:56 +00:00
|
|
|
GOPATH: c:\gopath
|
2018-01-08 08:54:30 +00:00
|
|
|
DOCKER_USERNAME:
|
|
|
|
secure: '4YzzahbEiMZQJpOCOd1LAw=='
|
|
|
|
DOCKER_PASSWORD:
|
|
|
|
secure: 'VqO/G3Zfslu6zSLdwHKO+Q=='
|
|
|
|
|
|
|
|
install:
|
|
|
|
- ps: |
|
|
|
|
docker version
|
|
|
|
go version
|
2018-03-16 12:07:56 +00:00
|
|
|
- ps: |
|
|
|
|
$env:Path = "c:\gopath\bin;$env:Path"
|
2018-01-08 08:54:30 +00:00
|
|
|
|
|
|
|
build_script:
|
|
|
|
- ps: |
|
2018-03-16 12:07:56 +00:00
|
|
|
go get -u github.com/golang/dep/cmd/dep
|
|
|
|
dep ensure
|
|
|
|
|
2018-01-08 08:54:30 +00:00
|
|
|
if ( $env:APPVEYOR_REPO_TAG -eq 'false' ) {
|
2018-03-16 12:07:56 +00:00
|
|
|
go build -ldflags "-X main.build=$env:APPVEYOR_BUILD_VERSION" -a -o release/drone-matrix.exe
|
2018-01-08 08:54:30 +00:00
|
|
|
} else {
|
|
|
|
$version = $env:APPVEYOR_REPO_TAG_NAME.substring(1)
|
2018-03-16 12:07:56 +00:00
|
|
|
go build -ldflags "-X main.version=$version -X main.build=$env:APPVEYOR_BUILD_VERSION" -a -o release/drone-matrix.exe
|
2018-01-08 08:54:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
docker pull microsoft/nanoserver:10.0.14393.1593
|
2018-01-23 22:20:50 +00:00
|
|
|
docker build -f Dockerfile.windows -t plugins/matrix:windows-amd64 .
|
2018-01-08 08:54:30 +00:00
|
|
|
|
|
|
|
test_script:
|
|
|
|
- ps: |
|
2018-01-23 22:20:50 +00:00
|
|
|
docker run --rm plugins/matrix:windows-amd64 --version
|
2018-01-08 08:54:30 +00:00
|
|
|
|
|
|
|
deploy_script:
|
|
|
|
- ps: |
|
|
|
|
$ErrorActionPreference = 'Stop';
|
|
|
|
|
|
|
|
if ( $env:APPVEYOR_PULL_REQUEST_NUMBER ) {
|
|
|
|
Write-Host Nothing to deploy.
|
|
|
|
} else {
|
2018-06-30 12:58:45 +00:00
|
|
|
echo $env:DOCKER_PASSWORD | docker login --username $env:DOCKER_USERNAME --password-stdin
|
2018-01-08 08:54:30 +00:00
|
|
|
|
|
|
|
if ( $env:APPVEYOR_REPO_TAG -eq 'true' ) {
|
|
|
|
$major,$minor,$patch = $env:APPVEYOR_REPO_TAG_NAME.substring(1).split('.')
|
|
|
|
|
2018-01-24 08:02:40 +00:00
|
|
|
docker push plugins/matrix:windows-amd64
|
2018-01-08 08:54:30 +00:00
|
|
|
|
2018-01-25 11:20:33 +00:00
|
|
|
docker tag plugins/matrix:windows-amd64 plugins/matrix:$major.$minor.$patch-windows-amd64
|
2018-01-23 22:20:50 +00:00
|
|
|
docker push plugins/matrix:$major.$minor.$patch-windows-amd64
|
2018-01-08 08:54:30 +00:00
|
|
|
|
2018-01-25 11:20:33 +00:00
|
|
|
docker tag plugins/matrix:windows-amd64 plugins/matrix:$major.$minor-windows-amd64
|
2018-01-23 22:20:50 +00:00
|
|
|
docker push plugins/matrix:$major.$minor-windows-amd64
|
2018-01-08 08:54:30 +00:00
|
|
|
|
2018-01-25 11:20:33 +00:00
|
|
|
docker tag plugins/matrix:windows-amd64 plugins/matrix:$major-windows-amd64
|
2018-01-23 22:20:50 +00:00
|
|
|
docker push plugins/matrix:$major-windows-amd64
|
2018-01-08 08:54:30 +00:00
|
|
|
} else {
|
|
|
|
if ( $env:APPVEYOR_REPO_BRANCH -eq 'master' ) {
|
2018-01-23 22:20:50 +00:00
|
|
|
docker push plugins/matrix:windows-amd64
|
2018-01-08 08:54:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|