forked from chummer5a/chummer5a
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathappveyor.yml
71 lines (68 loc) · 3.44 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
version: "5.194.{build}"
branches:
only:
- master
skip_tags: true
image: Visual Studio 2017
configuration: Release
platform: x86
assembly_info:
patch: true
file: '**\AssemblyInfo.*'
assembly_version: '{version}'
assembly_file_version: '{version}'
assembly_informational_version: '{version}'
hosts:
api.nuget.org: 93.184.221.200
environment:
SolutionDir: C:\projects\chummer\
matrix:
- project_name: Chummer
api_token: 'secure: Ez1QcWiKJJWMAO+xXkQglJNI4OnWM5/JMjXgy6gwJH5IuUX4ttzrpthVYNjHWS12'
init:
- ps: |
$headers = @{
"Authorization" = "Bearer $token"
"Content-type" = "application/json"
}
$apiURL = "https://ci.appveyor.com/api/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG"
$history = Invoke-RestMethod -Uri "$apiURL/history?recordsNumber=2" -Headers $headers -Method Get
if ($history.builds.Count -eq 2)
{
$CurrentCommitID = $history.builds[0].commitId
$PreviousCommitID = $history.builds[1].commitId
Write-host "Current Commit ID: $CurrentCommitID"
Write-host "Previous Commit ID: $PreviousCommitID"
$history.builds[1].commitId
if ($CurrentCommitID -eq $PreviousCommitID)
{
Write-host "Current Commit ID is the same as previous, exiting build."
Exit-AppveyorBuild
}
}
install:
- ps: "$token = $env:api_token\n$accountName = 'chummer5a'\n$projectSlug = 'chummer'\n$headers = @{\n \"Authorization\" = \"Bearer $token\"\n \"Content-type\" = \"application/json\"\n}\n\nSet-AppveyorBuildVariable -Name OldMinorVersion -Value $($env:APPVEYOR_BUILD_VERSION).Split('.')[1]\nWrite-Host \"Environment Variable: $env:OldMinorVersion\"\n$Assemblyfile = \"C:\\projects\\chummer\\Chummer\\Properties\\AssemblyInfo.cs\"\n\n$regex = new-object System.Text.RegularExpressions.Regex ('(AssemblyVersion(Attribute)?\\s*\\(\\s*\\\")(.*)(\\\"\\s*\\))', \n [System.Text.RegularExpressions.RegexOptions]::MultiLine)\n\n$content = [IO.File]::ReadAllText($assemblyFile)\n\n$version = $null\n$match = $regex.Match($content)\nif($match.Success) {\n $version = $match.groups[3].value\n}\n\n$Major = $version.Split('.')[0]\n$Minor = $version.Split('.')[1]\n\nIf ($Minor -ne $($env:OldMinorVersion))\n{ \n$apiUrl = 'https://ci.appveyor.com/api/projects'\n$BuildNumber = '{ nextBuildNumber: 1; }'\n$Format = '{ versionFormat: $Major.$Minor.0; }'\n# get project with last build details\nInvoke-RestMethod -Method Put -Uri \"$apiUrl/$accountName/$projectSlug/settings/build-number\" -Headers $headers -Body $BuildNumber\nInvoke-RestMethod -Method Put -Uri \"$apiUrl/$accountName/$projectSlug/settings\" -Headers $headers -Body $BuildNumber\nUpdate-AppveyorBuild -Version \"$Major.$Minor.0\"\n}\nelse \n{\n Update-AppveyorBuild -Version \"$Major.$Minor.$env:appveyor_build_number\"\n}"
nuget:
account_feed: true
project_feed: true
disable_publish_on_pr: true
before_build:
- ps:
nuget restore
& ${env:CommonProgramFiles(x86)}'\Microsoft Shared\TextTemplating\14.0\TextTransform.exe' 'C:\projects\chummer\Chummer\Properties\contributors.tt'
build:
project: Chummer.sln
verbosity: normal
after_build:
- ps: 7z a Chummer.Nightly.zip C:\projects\chummer\Chummer\bin\release\* -r
artifacts:
- path: Chummer.Nightly.zip
name: Chummer
deploy:
- provider: GitHub
tag: Nightly-v$(appveyor_build_version)
auth_token:
secure: xrNlPolUlOE6KAfl/ZDdT8kdVxlzMZXfvafmN92gRYHGh6b2XcwXNi8K1+f0LO6m
artifact: Chummer
draft: false
prerelease: true