-
Notifications
You must be signed in to change notification settings - Fork 0
/
appveyor.yml
76 lines (57 loc) · 2.53 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
version: "{build}"
image: Visual Studio 2017
configuration: Release
platform: Any CPU
clone_depth: 1
cache:
- packages -> **\packages.config
install:
- ps: >-
$name = Select-String -Path nfive.yml -Pattern 'name: ?(.+)$' | %{ $_.Matches[0].Groups[1].Value }
If ($env:APPVEYOR_REPO_PROVIDER -eq "github" -and $env:APPVEYOR_REPO_NAME -ne $name) {
Add-AppveyorMessage -Message "Plugin name mismatch" -Category Error -Details "The GitHub repo name '$env:APPVEYOR_REPO_NAME' does not match the plugin name '$name' from nfive.yml."
Write-Host "Plugin name mismatch: The GitHub repo name '$env:APPVEYOR_REPO_NAME' does not match the plugin name '$name' from nfive.yml." -ForegroundColor Red
$host.SetShouldExit(1)
}
$env:BUILD_VERSION = Select-String -Path nfive.yml -Pattern 'version: ?(.+)$' | %{ $_.Matches[0].Groups[1].Value }
If ($env:APPVEYOR_REPO_TAG -eq $true) {
$tag = $env:APPVEYOR_REPO_TAG_NAME.TrimStart("v")
If ($tag -ne $env:BUILD_VERSION) {
Add-AppveyorMessage -Message "Plugin version mismatch" -Category Error -Details "The Git tag '$tag' does not match the plugin version number '$env:BUILD_VERSION' from nfive.yml."
Write-Host "Plugin version mismatch: The Git tag '$tag' does not match the plugin version number '$env:BUILD_VERSION' from nfive.yml." -ForegroundColor Red
$host.SetShouldExit(1)
}
}
$env:BUILD_VERSION_FILE = "$env:BUILD_VERSION.$env:APPVEYOR_BUILD_NUMBER"
$version = $env:BUILD_VERSION -split '-'
$env:BUILD_VERSION_FRIENDLY = $version[0] -replace "(\.0)$"
If ($version[1]) {
$env:BUILD_VERSION_FILE = "$($version[0]).$env:APPVEYOR_BUILD_NUMBER-$($version[1])"
$end = (Get-Culture).TextInfo.ToTitleCase($version[1].Replace("rc", "RC"))
$env:BUILD_VERSION_FRIENDLY += " " + $end -replace "([a-z]+)(\d+)",'$1 $2'
}
Update-AppveyorBuild -Version $env:BUILD_VERSION_FILE
- appveyor DownloadFile https://dl.nfive.io/nfpm.exe
assembly_info:
patch: true
file: Properties\AssemblyInfo.cs
assembly_version: $(BUILD_VERSION)
assembly_file_version: $(BUILD_VERSION_FILE)
assembly_informational_version: $(BUILD_VERSION_FRIENDLY)
before_build:
- nuget restore
- nfpm install
build:
verbosity: minimal
after_build:
- nfpm pack
artifacts:
- path: $(APPVEYOR_PROJECT_NAME).zip
deploy:
release: $(APPVEYOR_REPO_TAG_NAME)
provider: GitHub
auth_token:
secure: # Put encrypted GitHub token here - https://www.appveyor.com/docs/deployment/github/#provider-settings
on:
branch: master
APPVEYOR_REPO_TAG: true