2017-12-09 13:59:38 +03:00
|
|
|
version: '{build}'
|
|
|
|
image: 'Visual Studio 2017'
|
2017-12-19 04:31:38 +03:00
|
|
|
platform: x64
|
2017-12-09 13:59:38 +03:00
|
|
|
|
|
|
|
clone_folder: 'c:\go\src\github.com\appleboy\drone-telegram'
|
2017-12-19 04:31:38 +03:00
|
|
|
max_jobs: 1
|
2017-12-09 13:59:38 +03:00
|
|
|
|
|
|
|
environment:
|
2017-12-09 14:09:09 +03:00
|
|
|
GOPATH: c:\go
|
2017-12-09 13:59:38 +03:00
|
|
|
docker_username:
|
|
|
|
secure: em/TNLUXxG19O/HvbvfJuQ==
|
|
|
|
docker_password:
|
|
|
|
secure: Yo9FJJqihaNz5q8T4Jz8tQ==
|
|
|
|
|
2017-12-09 14:09:09 +03:00
|
|
|
branches:
|
|
|
|
only:
|
|
|
|
- master
|
|
|
|
|
2017-12-09 13:59:38 +03:00
|
|
|
install:
|
2017-12-09 14:09:09 +03:00
|
|
|
- echo %PATH%
|
|
|
|
- echo %GOPATH%
|
|
|
|
- set PATH=%GOPATH%\bin;c:\go\bin;%PATH%
|
|
|
|
- go version
|
|
|
|
- go env
|
|
|
|
- docker version
|
|
|
|
|
2017-12-09 13:59:38 +03:00
|
|
|
build_script:
|
|
|
|
- ps: |
|
2017-12-19 04:31:38 +03:00
|
|
|
if ( $env:APPVEYOR_REPO_TAG -eq 'false' ) {
|
|
|
|
go build -ldflags "-X main.build=$env:APPVEYOR_BUILD_VERSION" -a -o drone-telegram.exe
|
|
|
|
} else {
|
|
|
|
$version = $env:APPVEYOR_REPO_TAG_NAME.substring(1)
|
|
|
|
go build -ldflags "-X main.Version=$version -X main.build=$env:APPVEYOR_BUILD_VERSION" -a -o drone-telegram.exe
|
|
|
|
}
|
2017-12-09 14:09:09 +03:00
|
|
|
docker pull microsoft/nanoserver:10.0.14393.1884
|
2017-12-09 13:59:38 +03:00
|
|
|
docker build -f Dockerfile.windows -t appleboy/drone-telegram:windows .
|
2017-12-09 14:09:09 +03:00
|
|
|
|
2017-12-09 13:59:38 +03:00
|
|
|
test_script:
|
|
|
|
- ps: |
|
|
|
|
docker run --rm appleboy/drone-telegram:windows --version
|
2017-12-09 14:09:09 +03:00
|
|
|
|
2017-12-09 13:59:38 +03:00
|
|
|
deploy_script:
|
|
|
|
- ps: |
|
2017-12-19 04:52:09 +03:00
|
|
|
$ErrorActionPreference = 'Stop';
|
|
|
|
if ( $env:APPVEYOR_PULL_REQUEST_NUMBER ) {
|
|
|
|
Write-Host Nothing to deploy.
|
|
|
|
} else {
|
|
|
|
docker login --username $env:DOCKER_USERNAME --password $env:DOCKER_PASSWORD
|
|
|
|
if ( $env:APPVEYOR_REPO_TAG -eq 'true' ) {
|
|
|
|
$major,$minor,$patch = $env:APPVEYOR_REPO_TAG_NAME.substring(1).split('.')
|
|
|
|
docker push appleboy/drone-telegram:windows
|
|
|
|
docker tag appleboy/drone-telegram:windows appleboy/drone-telegram:$major.$minor.$patch-windows
|
|
|
|
docker push appleboy/drone-telegram:$major.$minor.$patch-windows
|
|
|
|
docker tag appleboy/drone-telegram:windows appleboy/drone-telegram:$major.$minor-windows
|
|
|
|
docker push appleboy/drone-telegram:$major.$minor-windows
|
|
|
|
docker tag appleboy/drone-telegram:windows appleboy/drone-telegram:$major-windows
|
|
|
|
docker push appleboy/drone-telegram:$major-windows
|
|
|
|
} else {
|
|
|
|
if ( $env:APPVEYOR_REPO_BRANCH -eq 'master' ) {
|
|
|
|
docker push appleboy/drone-telegram:windows
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|