-
Notifications
You must be signed in to change notification settings - Fork 19
/
.appveyor.yml
83 lines (72 loc) · 3.13 KB
/
.appveyor.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
version: '{build}'
image: 'Visual Studio 2017'
platform: x64
clone_folder: 'c:\gopath\src\github.com\go-ggz\ggz'
max_jobs: 1
environment:
GOPATH: c:\gopath
docker_username:
secure: em/TNLUXxG19O/HvbvfJuQ==
docker_password:
secure: Yo9FJJqihaNz5q8T4Jz8tQ==
GO111MODULE: on
GOVERSION: 1.13.3
branches:
only:
- master
install:
- go version
- go env
- ps: |
docker version
go version
- ps: |
$env:Path = "c:\gopath\bin;$env:Path"
build_script:
- ps: |
if ( $env:APPVEYOR_REPO_TAG -eq 'false' ) {
$version = $env:APPVEYOR_REPO_COMMIT
$buildDate = $env:APPVEYOR_REPO_COMMIT_TIMESTAMP
} else {
$version = $env:APPVEYOR_REPO_TAG_NAME
$buildDate = $env:APPVEYOR_REPO_COMMIT_TIMESTAMP
}
go get -u github.com/UnnoTed/fileb0x
go generate ./assets/...
go build -ldflags "-X github.com/go-ggz/ggz/pkg/version.Version=$version -X github.com/go-ggz/ggz/pkg/version.BuildDate=$buildDate" -a -o release/ggz-server.exe ./cmd/ggz-server
go build -ldflags "-X github.com/go-ggz/ggz/pkg/version.Version=$version -X github.com/go-ggz/ggz/pkg/version.BuildDate=$buildDate" -a -o release/ggz-redirect.exe ./cmd/ggz-redirect
docker pull microsoft/nanoserver:10.0.14393.1884
docker build -f docker/ggz-server/Dockerfile.windows.amd64 -t goggz/ggz-server:windows-amd64 .
docker build -f docker/ggz-redirect/Dockerfile.windows.amd64 -t goggz/ggz-redirect:windows-amd64 .
test_script:
- ps: |
docker run --rm goggz/ggz-server:windows-amd64 --version
docker run --rm goggz/ggz-redirect: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 tag goggz/ggz-server:windows-amd64 goggz/ggz:$major.$minor.$patch-windows-amd64
docker push goggz/ggz-server:$major.$minor.$patch-windows-amd64
docker tag goggz/ggz-redirect:windows-amd64 goggz/ggz:$major.$minor.$patch-windows-amd64
docker push goggz/ggz-redirect:$major.$minor.$patch-windows-amd64
docker tag goggz/ggz-server:windows-amd64 goggz/ggz:$major.$minor-windows-amd64
docker push goggz/ggz-server:$major.$minor-windows-amd64
docker tag goggz/ggz-redirect:windows-amd64 goggz/ggz:$major.$minor-windows-amd64
docker push goggz/ggz-redirect:$major.$minor-windows-amd64
docker tag goggz/ggz-server:windows-amd64 goggz/ggz:$major-windows-amd64
docker push goggz/ggz-server:$major-windows-amd64
docker tag goggz/ggz-redirect:windows-amd64 goggz/ggz:$major-windows-amd64
docker push goggz/ggz-redirect:$major-windows-amd64
} else {
if ( $env:APPVEYOR_REPO_BRANCH -eq 'master' ) {
docker push goggz/ggz-server:windows-amd64
docker push goggz/ggz-redirect:windows-amd64
}
}
}