forked from mh-cbon/go-msi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
appveyor.yml
90 lines (82 loc) · 3.88 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
84
85
86
87
88
89
90
image: Visual Studio 2017
clone_folder: c:\gopath\src\github.com\%APPVEYOR_ACCOUNT_NAME%\%APPVEYOR_PROJECT_SLUG%
# skip_non_tags: true
# environment variables
environment:
GOPATH: c:\gopath
JFROG_CLI_OFFER_CONFIG: false
VCS_URL: https://github.com/%APPVEYOR_REPO_NAME%
BT_KEY:
secure: P9xGXGG38T4AvO8XXXXcbaDG2sSN4t6KH92zssGp0nrbyQAZuxHD9F84s6PM9mOD
GH_TOKEN:
secure: WVMaMjrLzXN8YNcnFRfcucTYWtvoDeE/4b2TUGQBZDvv7u+ERBQ///z5Q8qYSt0L
install:
- choco source add -n=mh-cbon -s="https://api.bintray.com/nuget/mh-cbon/choco"
- choco install changelog gh-api-cli -y
- refreshenv
- set GH_APP=%APPVEYOR_PROJECT_NAME%
- set GH_USER=%APPVEYOR_ACCOUNT_NAME%
- set VERSION=%APPVEYOR_REPO_TAG_NAME%
- if "%x%"=="%VERSION%" set VERSION=1.0.2
- set PATH=%WIX%\bin;%PATH%
- set PATH=%GOPATH%\bin;%PATH%
- 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"
- go get -u github.com/mh-cbon/never-fail
- go get -u github.com/Masterminds/glide
- glide install
before_test:
# do a manual installation of go-msi from pulled source code
- mkdir C:\go-msi\
- set GOARCH=amd64
- go build -o C:\go-msi\go-msi.exe --ldflags "-X main.VERSION=%VERSION%" main.go
- XCOPY /I /E templates C:\go-msi\templates
# prepare tests packages
- cd testing\\hello
- glide install
- cd ..
- glide install
- cd ..
# run tests
- go run testing\\main.go
- cd && dir *msi
# build msi artifacts
build_script:
# x386
- set GOARCH=386
- go build -o %GH_APP%.exe --ldflags "-X main.VERSION=%VERSION%" main.go
- .\go-msi.exe make --msi %GH_APP%-%GOARCH%-%VERSION%.msi --version %VERSION% --arch %GOARCH%
- cp %GH_APP%-%GOARCH%-%VERSION%.msi %GH_APP%-%GOARCH%.msi
# nuget package is built only for the x86 arch.
- .\go-msi.exe choco --path wix.json --version %VERSION% --input %GH_APP%-%GOARCH%-%VERSION%.msi --changelog-cmd "changelog ghrelease --version %VERSION%"
# amd64
- set GOARCH=amd64
- go build -o %GH_APP%.exe --ldflags "-X main.VERSION=%VERSION%" main.go
- .\go-msi.exe make --msi %GH_APP%-%GOARCH%-%VERSION%.msi --version %VERSION% --arch %GOARCH%
- cp %GH_APP%-%GOARCH%-%VERSION%.msi %GH_APP%-%GOARCH%.msi
deploy_script:
- never-fail jfrog bt pc --user %GH_USER% --key %BT_KEY% --licenses=MIT --vcs-url=https://github.com/%APPVEYOR_REPO_NAME% %GH_USER%/msi/%GH_APP%
- never-fail jfrog bt pc --user %GH_USER% --key %BT_KEY% --licenses=MIT --vcs-url=https://github.com/%APPVEYOR_REPO_NAME% %GH_USER%/choco/%GH_APP%
- never-fail curl -X "DELETE" -u%GH_USER%:%BT_KEY% https://api.bintray.com/content/%GH_USER%/choco/%GH_APP%.%VERSION%.nupkg # workaround until --override=true is honored in next upload
- jfrog bt upload --user %GH_USER% --key %BT_KEY% --override=true --publish=true %GH_APP%.%VERSION%.nupkg %GH_USER%/choco/%GH_APP%/%VERSION%
- set GOARCH=386
- jfrog bt upload --user %GH_USER% --key %BT_KEY% --override=true --publish=true %GH_APP%-%GOARCH%-%VERSION%.msi %GH_USER%/msi/%GH_APP%/%VERSION%
- set GOARCH=amd64
- jfrog bt upload --user %GH_USER% --key %BT_KEY% --override=true --publish=true %GH_APP%-%GOARCH%-%VERSION%.msi %GH_USER%/msi/%GH_APP%/%VERSION%
# next section is a workaround for https://github.com/appveyor/ci/issues/1752
- never-fail gh-api-cli upload-release-asset -t %GH_TOKEN% -g "*-386.msi" -o %GH_USER% -r %GH_APP% --ver %VERSION%
- never-fail gh-api-cli upload-release-asset -t %GH_TOKEN% -g "*-amd64.msi" -o %GH_USER% -r %GH_APP% --ver %VERSION%
artifacts:
- path: '*-386.msi'
name: msi-x86
- path: '*-amd64.msi'
name: msi-x64
deploy:
- provider: GitHub
artifact: msi-x86, msi-x64
draft: false
prerelease: false
desription: "Release %APPVEYOR_REPO_TAG_NAME%"
auth_token:
secure: WVMaMjrLzXN8YNcnFRfcucTYWtvoDeE/4b2TUGQBZDvv7u+ERBQ///z5Q8qYSt0L
on:
appveyor_repo_tag: true # deploy on tag push only