62 lines
2.0 KiB
YAML
62 lines
2.0 KiB
YAML
version: '{build}'
|
|
image: 'Visual Studio 2017'
|
|
platform: x64
|
|
|
|
max_jobs: 1
|
|
|
|
environment:
|
|
GOPATH: c:\go
|
|
docker_username:
|
|
secure: em/TNLUXxG19O/HvbvfJuQ==
|
|
docker_password:
|
|
secure: Yo9FJJqihaNz5q8T4Jz8tQ==
|
|
|
|
branches:
|
|
only:
|
|
- master
|
|
|
|
install:
|
|
- ps: |
|
|
docker version
|
|
go version
|
|
go env
|
|
|
|
build_script:
|
|
- ps: |
|
|
if ( $env:APPVEYOR_REPO_TAG -eq 'false' ) {
|
|
$version = $env:APPVEYOR_REPO_COMMIT
|
|
} else {
|
|
$version = $env:APPVEYOR_REPO_TAG_NAME
|
|
}
|
|
go build -ldflags "-X main.Version=$version" -a -o release/drone-telegram.exe .
|
|
|
|
docker pull microsoft/nanoserver:10.0.14393.1884
|
|
docker build -f docker/Dockerfile.windows.amd64 -t appleboy/drone-telegram:windows-amd64 .
|
|
|
|
test_script:
|
|
- ps: |
|
|
docker run --rm appleboy/drone-telegram:windows-amd64 --version
|
|
|
|
deploy_script:
|
|
- ps: |
|
|
$ErrorActionPreference = 'Stop';
|
|
if ( $env:APPVEYOR_PULL_REQUEST_NUMBER ) {
|
|
Write-Host Nothing to deploy.
|
|
} else {
|
|
echo $env:DOCKER_PASSWORD | docker login --username $env:DOCKER_USERNAME --password-stdin
|
|
if ( $env:APPVEYOR_REPO_TAG -eq 'true' ) {
|
|
$major,$minor,$patch = $env:APPVEYOR_REPO_TAG_NAME.split('.')
|
|
docker push appleboy/drone-telegram:windows-amd64
|
|
docker tag appleboy/drone-telegram:windows-amd64 appleboy/drone-telegram:$major.$minor.$patch-windows-amd64
|
|
docker push appleboy/drone-telegram:$major.$minor.$patch-windows-amd64
|
|
docker tag appleboy/drone-telegram:windows-amd64 appleboy/drone-telegram:$major.$minor-windows-amd64
|
|
docker push appleboy/drone-telegram:$major.$minor-windows-amd64
|
|
docker tag appleboy/drone-telegram:windows-amd64 appleboy/drone-telegram:$major-windows-amd64
|
|
docker push appleboy/drone-telegram:$major-windows-amd64
|
|
} else {
|
|
if ( $env:APPVEYOR_REPO_BRANCH -eq 'master' ) {
|
|
docker push appleboy/drone-telegram:windows-amd64
|
|
}
|
|
}
|
|
}
|