-
Notifications
You must be signed in to change notification settings - Fork 2
/
appveyor.yml
138 lines (118 loc) · 4.84 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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
os: Windows Server 2019
image: Visual Studio 2019
# Restrict to Git branches below
branches:
only:
- master
# Build Configuration, i.e. Debug, Release, etc.
configuration: Debug
# Scripts that run after cloning repository
install:
- cmd: where dotnet
- cmd: dotnet nuget locals all -c
- cmd: dotnet restore
environment:
VERSION_SIMPLE: '{version}'
VERSION_INFORMATIONAL: '{version}'
VERSION_UNSTABLE_SUFFIX: 'preview'
APPVEYOR_TOKEN:
secure: LtoVAPATN9iTCl1zkCvEktqP92QSEEngyS3vqG3GphE=
init:
- ps: |
$env:VERSION_SIMPLE = $env:APPVEYOR_BUILD_VERSION.TrimStart("v")
$env:VERSION_INFORMATIONAL = "$env:VERSION_SIMPLE"
$env:GITHUB_REPO_API = "https://api.github.com/repos/$env:APPVEYOR_REPO_NAME/tags"
if ($env:APPVEYOR_REPO_TAG -eq "true" -and $env:APPVEYOR_REPO_TAG_NAME) {
### CHECK IF A IT'S A TAGGED BUILD
$env:APPVEYOR_REPO_TAG_NAME = $env:APPVEYOR_REPO_TAG_NAME.TrimStart("v")
Write-Host "Building a tagged Git commit: $git_current_tag";
if ($env:APPVEYOR_REPO_TAG_NAME -match '^([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?)$') {
$tag_ver = [version]$env:APPVEYOR_REPO_TAG_NAME
$env:VERSION_INFORMATIONAL = "{0}.{1}.{2}" -f $tag_ver.Major, $tag_ver.Minor, $tag_ver.Build
$env:VERSION_SIMPLE = "$env:VERSION_INFORMATIONAL.$env:APPVEYOR_BUILD_NUMBER"
}
} elseif ($env:VERSION_INFORMATIONAL -match '^([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?)$') {
$current_ver = [version]$env:VERSION_INFORMATIONAL
$env:VERSION_INFORMATIONAL = "{0}.{1}.{2}" -f $current_ver.Major, $current_ver.Minor, $current_ver.Build
$env:VERSION_INFORMATIONAL = "{0}-{1}{2}" -f $env:VERSION_INFORMATIONAL, $env:VERSION_UNSTABLE_SUFFIX, $env:APPVEYOR_BUILD_NUMBER
}
### MAKE CALCULATED INFORMATIONAL VERSION THE ACTUAL BUILD VERSION
Update-AppveyorBuild -Version $env:VERSION_INFORMATIONAL
Write-Host "Using build version: $env:VERSION_SIMPLE"
Write-Host "Using (informational) build version: $env:VERSION_INFORMATIONAL"
dotnet_csproj:
patch: true
file: '**\*.csproj'
assembly_version: $(VERSION_SIMPLE)
file_version: $(VERSION_SIMPLE)
version: $(VERSION_INFORMATIONAL)
package_version: $(VERSION_INFORMATIONAL)
informational_version: $(VERSION_INFORMATIONAL)
assembly_info:
patch: true
file: '**\AssemblyInfo.*'
assembly_version: $(VERSION_SIMPLE)
assembly_file_version: $(VERSION_SIMPLE)
assembly_informational_version: $(VERSION_INFORMATIONAL)
# Run scripts below before
before_build:
- cmd: dotnet clean
# Run scripts below before
build_script:
- cmd: dotnet build
# NuGet files qualified as artifacts
artifacts:
- path: 'bin\**\*.nupkg' # find the NuGet files
name: NuGet_Files
# Deploy to GitHub releases
deploy:
-
provider: GitHub
auth_token:
secure: 2+d0KgCbWQpUR8TZfzvUEzbi4NQP6F/Tt0PUwLn6jXZCyO8FnrFVFJPsFa0QBQFl
artifact: NuGet_Files
draft: false
force_update: true
prerelease: false
release: "$(APPVEYOR_PROJECT_NAME) v$(APPVEYOR_REPO_TAG_NAME)"
tag: $(APPVEYOR_REPO_TAG_NAME)
on:
appveyor_repo_tag: true
-
provider: NuGet
api_key:
secure: i6oWn60J7ZOM4UuYcvxbuk9OAEp6or+Wq7izyJDPNlcLIhG2UKsxz7G/8erhdY3M
artifact: NuGet_Files
server: # remove to push to NuGet.org
skip_symbols: false
symbol_server: # remove to push symbols to SymbolSource.org
on:
appveyor_repo_tag: true
-
provider: NuGet
server: https://ci.appveyor.com/nuget/salaros/api/v2/package
symbol_server: https://ci.appveyor.com/nuget/salaros/api/v2/package
api_key:
secure: 3zmnmVBweTgdk4SBM/rWHdC9JOM9s0pxm1bw1d+WHDo=
artifact: NuGet_Files
after_deploy:
- ps: |
if ($env:APPVEYOR_REPO_TAG -eq "true" -and $env:APPVEYOR_REPO_TAG_NAME) {
$apiUrl = 'https://ci.appveyor.com/api'
$headers = @{
"Authorization" = "Bearer $env:APPVEYOR_TOKEN"
"Content-type" = "application/json"
}
Invoke-RestMethod -Method Put "$apiUrl/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG/settings/build-number" -Body '{"nextBuildNumber": 1 }' -Headers $headers
$env:APPVEYOR_REPO_TAG_NAME = $env:APPVEYOR_REPO_TAG_NAME.TrimStart("v")
if ($env:APPVEYOR_REPO_TAG_NAME -match '^([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?)$') {
$tag_ver = [version]$env:APPVEYOR_REPO_TAG_NAME
$ver_format = "version: {0}.{1}.{2}.{3}" -f $tag_ver.Major, $tag_ver.Minor, ($tag_ver.Build + 1), '{build}'
$headers."Content-type" = "text/plain";
Invoke-RestMethod -Method Put "$apiUrl/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG/settings/yaml" -Body $ver_format -Headers $headers
}
}
# Start builds on tags only (GitHub and BitBucket)
skip_non_tags: false
# Tests shall stay off for now
test: off