-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathappveyor.yml
73 lines (61 loc) · 1.82 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
version: 0.{build}
branches:
only:
- master
nuget:
project_feed: true
configuration: Debug
environment:
gh_token:
secure: 5NfMTIHSZWCVv5fbAQroqXFDASFCQjRhL0XA61PGKdHJb88a8HrtftbA789/VdEh
build:
project: appveyor-test2.sln
verbosity: minimal
artifacts:
- path: test.zip
name: test
after_build:
- cmd: 7z a test.zip %APPVEYOR_BUILD_FOLDER%\appveyor-test2\bin\*.*
deploy_script:
- ps: |
$token = $env:gh_token
$uploadFilePath = "c:\projects\appveyor-test\test.zip"
$releaseName = "v$env:appveyor_build_version"
$repo = 'jfayre/appveyor-test'
$tag = $env:appveyor_repo_tag_name
$headers = @{
"Authorization" = "token $token"
"Content-type" = "application/json"
}
$body = @{
tag_name = $tag
target_commitish = "master"
name = $releaseName
body = "Description of the release"
draft = $false
prerelease = $false
}
Write-Host "Creating release..." -NoNewline
$json = (ConvertTo-Json $body)
$release = Invoke-RestMethod -Uri "https://api.github.com/repos/$repo/releases" -Headers $headers -Method POST -Body $json
$uploadUrl = $release.upload_url.Replace("{?name,label}", "") + "?name=" + [IO.Path]::GetFileName($uploadFilePath)
Write-Host "OK" -ForegroundColor Green
$uploadUrl
Write-Host "Uploading asset..." -NoNewline
$data = [System.IO.File]::ReadAllBytes($uploadFilePath)
$wc = New-Object Net.WebClient
$wc.Headers['Content-type'] = 'application/octet-stream'
$wc.Headers['Authorization'] = "token $token"
try {
$response = $wc.UploadData($uploadUrl, "POST", $data)
Write-Host "OK" -ForegroundColor Green
} catch {
$host.SetShouldExit(1)
}
notifications:
- provider: Email
to:
subject: TFM build
on_build_success: true
on_build_failure: true