-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathappveyor.yml
More file actions
102 lines (92 loc) · 4.14 KB
/
appveyor.yml
File metadata and controls
102 lines (92 loc) · 4.14 KB
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
image: Visual Studio 2017
clone_folder: c:\gopath\src\github.com\devopsdays\devopsdays-cli
# set to false to build on any commit.
skip_non_tags: true
environment:
# improve readability
VCS_URL: https://github.com/%APPVEYOR_REPO_NAME%
GH_USER: "%APPVEYOR_ACCOUNT_NAME%"
VERSION: "%APPVEYOR_REPO_TAG_NAME%"
# specific to go
GOPATH: c:\gopath
# specific to bintray
JFROG_CLI_OFFER_CONFIG: false
# define secure tokens
CHOCOKEY:
secure: "%CHOCOKEY%"
BT_KEY:
secure: sO0oJP31Isonig3KFPoannXWkSMxUubhXEX+n6ePIwXj06fVvbRqFpI3799mbOP+
GH_TOKEN:
secure: 7bl6S1pr1BMfewnyzvgZeuaArs2mhO04rQg5XbzCXs4zYemWKRaeKoMmXNaPRpfP
# prepare system and project
install:
# install required software
- choco source add -n=mh-cbon -s="https://api.bintray.com/nuget/mh-cbon/choco"
- choco install changelog gh-api-cli go-msi -y
- refreshenv
# to test the build on non tag commits.
- if "%x%"=="%VERSION%" set VERSION=1.0.2
# ensure wix is available in PATH
- set PATH=%WIX%\bin;%PATH%
# fetch bintray client
- curl -fsSk -o jfrog.exe -L "https://api.bintray.com/content/jfrog/jfrog-cli-go/$latest/jfrog-cli-windows-amd64/jfrog.exe?bt_package=jfrog-cli-windows-amd64"
# specific to go
- set PATH=%GOPATH%\bin;%PATH%
- go get -u github.com/mh-cbon/never-fail
- go get -u github.com/Masterminds/glide
- go get -u github.com/aktau/github-release
# test_script:
# # - go test ./...
# - go run main.go
# build msi artifacts
build_script:
# build the program for x386 arch
- go get ./...
- set GOARCH=386
- go build -o %APPVEYOR_PROJECT_NAME%.exe --ldflags "-X cmd.Version=%VERSION%" main.go
# generate the x386 MSI package
- go-msi make --msi %APPVEYOR_PROJECT_NAME%-%GOARCH%-%VERSION%.msi --version %VERSION% --arch %GOARCH%
# build a cross platform x386 nuget package.
- go-msi choco --path wix.json --version %VERSION% --input %APPVEYOR_PROJECT_NAME%-%GOARCH%-%VERSION%.msi --version %VERSION%"
# build the program for amd64 arch
- set GOARCH=amd64
- go build -o %APPVEYOR_PROJECT_NAME%.exe --ldflags "-X cmd.Version=%VERSION%" main.go
# generate the amd64 MSI package
- go-msi make --msi %APPVEYOR_PROJECT_NAME%-%GOARCH%-%VERSION%.msi --version %VERSION% --arch %GOARCH%
- pwd
- dir
# configure the artifacts to upload to the github release page
artifacts:
- path: 'devopsdays-cli-386-*.msi'
name: msi-x86
- path: 'devopsdays-cli-amd64-*.msi'
name: msi-x64
# setup the github release page upload
deploy:
provider: GitHub
release: devopsdays-cli-v$(VERSION)
tag: $(appveyor_repo_tag_name)
artifact: msi-x86, msi-x64
force_update: true
draft: false
prerelease: true
auth_token:
secure: 7bl6S1pr1BMfewnyzvgZeuaArs2mhO04rQg5XbzCXs4zYemWKRaeKoMmXNaPRpfP
on:
appveyor_repo_tag: true
# deploy the nuget/msi packages to bintray
after_build:
- set GOARCH=386
# - github-release info -s "%GH_TOKEN" -u devopsdays -r devopsdays-cli -t "0.7.36"
# - github-release upload -s "%GH_TOKEN" -u "devopsdays" -r "devopsdays-cli" -t "0.7.36" -f "%APPVEYOR_PROJECT_NAME%-%GOARCH%-%VERSION%.msi" -n "%APPVEYOR_PROJECT_NAME%-%GOARCH%-%VERSION%.msi"
# setup both "choco" and "msi" repositories on bintray
# - never-fail jfrog bt pc --user mattstratton --key %BT_KEY% --licenses=MIT --vcs-url=https://github.com/%APPVEYOR_REPO_NAME%/ devopsdays/msi/%APPVEYOR_PROJECT_NAME%
# - never-fail jfrog bt pc --user mattstratton --key %BT_KEY% --licenses=MIT --vcs-url=https://github.com/%APPVEYOR_REPO_NAME%/ devopsdays/choco/%APPVEYOR_PROJECT_NAME%
# upload the nupkg
- jfrog bt upload --user mattstratton --key %BT_KEY% --override=true --publish=true %APPVEYOR_PROJECT_NAME%.%VERSION%.nupkg devopsdays/choco/%APPVEYOR_PROJECT_NAME%/%VERSION%
# upload the x386 msi artifact
- set GOARCH=386
- jfrog bt upload --user mattstratton --key %BT_KEY% --override=true --publish=true %APPVEYOR_PROJECT_NAME%-%GOARCH%-%VERSION%.msi devopsdays/msi/%APPVEYOR_PROJECT_NAME%/%VERSION%
# upload the amd64 msi artifact
- set GOARCH=amd64
- jfrog bt upload --user mattstratton --key %BT_KEY% --override=true --publish=true %APPVEYOR_PROJECT_NAME%-%GOARCH%-%VERSION%.msi devopsdays/msi/%APPVEYOR_PROJECT_NAME%/%VERSION%