forked from Splamy/TS3AudioBot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
appveyor.yml
128 lines (91 loc) · 4.91 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
version: appveyor-{branch}-{build}
branches:
only:
- master
- develop
image: Visual Studio 2019
configuration: Release
clone_depth: 99999
init:
- pwsh: dotnet --version;
clone_script:
- pwsh: >-
git clone -q --recursive --branch=$env:APPVEYOR_REPO_BRANCH https://github.com/$env:APPVEYOR_REPO_NAME.git $env:APPVEYOR_BUILD_FOLDER
git config remote.origin.fetch +refs/heads/*:refs/remotes/origin/*
git fetch
git checkout -qf master
git checkout -qf $env:APPVEYOR_REPO_COMMIT
environment:
UPLOAD_TOKEN:
secure: wQTHAXf9NMII8m8gga6cVnA/yE6PCW5jzOppF7jgUlM=
cache:
- '%USERPROFILE%\.nuget\packages'
- WebInterface\node_modules -> WebInterface\package.json
before_build:
- pwsh: nuget restore
build:
parallel: true
verbosity: minimal
after_build:
- pwsh: >-
dotnet publish TS3AudioBot --framework netcoreapp2.2 -c Release
dotnet publish TS3AudioBot --framework netcoreapp3.1 -c Release
deploy_script:
- pwsh: >-
Install-Module Microsoft.PowerShell.Archive -MinimumVersion 1.2.3.0 -Repository PSGallery -Force
if(${env:UPLOAD_TOKEN}) {
$rel = [io.path]::combine("${env:APPVEYOR_BUILD_FOLDER}", "TS3AudioBot", "bin", "Release")
cd([io.path]::combine(${rel}, "net472"))
(.\TS3AudioBot.exe -V | Out-String) -match "Version: (?<version>[-_\d\w\.]+)"
$ver = $matches['version']
echo "Current version: ${ver}"
cd([io.path]::combine("${env:APPVEYOR_BUILD_FOLDER}", "WebInterface"))
npm install
npm run build
$dst = [io.path]::combine(${rel}, "WebInterface")
Copy-Item "./dist" -Destination $dst -Recurse
#net
cd([io.path]::combine(${rel}, "net472"))
Compress-Archive -Path *.exe,*.dll,*.config,lib,../WebInterface -DestinationPath TS3AudioBot.zip
Invoke-RestMethod -Uri "https://splamy.de/api/nightly/ts3ab/${env:APPVEYOR_REPO_BRANCH}?filename=TS3AudioBot.zip&commit=${env:APPVEYOR_REPO_COMMIT}&version=${ver}" -Headers @{ "Content-Type" = "application/zip"; "Authorization" = "${env:UPLOAD_TOKEN}" } -Method Put -InFile .\TS3AudioBot.zip
#core 2.2
cd([io.path]::combine(${rel}, "netcoreapp2.2", "publish"))
Compress-Archive -Path *.*,lib,../../WebInterface -DestinationPath TS3AudioBot.zip
Invoke-RestMethod -Uri "https://splamy.de/api/nightly/ts3ab/${env:APPVEYOR_REPO_BRANCH}_dotnet_core?filename=TS3AudioBot.zip&commit=${env:APPVEYOR_REPO_COMMIT}&version=${ver}" -Headers @{ "Content-Type" = "application/zip"; "Authorization" = "${env:UPLOAD_TOKEN}" } -Method Put -InFile .\TS3AudioBot.zip
#core 3.1
cd([io.path]::combine(${rel}, "netcoreapp3.1", "publish"))
Compress-Archive -Path *.*,lib,../../WebInterface -DestinationPath TS3AudioBot.zip
Invoke-RestMethod -Uri "https://splamy.de/api/nightly/ts3ab/${env:APPVEYOR_REPO_BRANCH}_dotnet_core_3_1_preview?filename=TS3AudioBot.zip&commit=${env:APPVEYOR_REPO_COMMIT}&version=${ver}" -Headers @{ "Content-Type" = "application/zip"; "Authorization" = "${env:UPLOAD_TOKEN}" } -Method Put -InFile .\TS3AudioBot.zip
}
on_success:
- pwsh: >-
# cut to the first 7 chars of the commit hash
$commitCut = $env:APPVEYOR_REPO_COMMIT.Substring(0, 7)
# and set up a nice teamspeak link for it
$commitLink = "[url=https://github.com/$env:APPVEYOR_REPO_NAME/commit/$env:APPVEYOR_REPO_COMMIT]$commitCut[/url]"
# now we do the same for the appveyor build
$buildLink = "[url=https://ci.appveyor.com/project/$env:APPVEYOR_REPO_NAME/builds/$env:APPVEYOR_BUILD_ID]Build #$env:APPVEYOR_BUILD_NUMBER[/url]"
$gitTitle = git log --format=%B -n 1 HEAD | Out-String
$finalMsg = [System.Uri]::EscapeDataString("Commit $commitLink in branch $env:APPVEYOR_REPO_BRANCH ($buildLink) [b][color=green]succeeded[/b].`n Summary: $gitTitle")
$finalMsg = $finalMsg.Replace("(", "%28").Replace(")", "%29")
try { Invoke-RestMethod -Uri "https://bot.splamy.de/api/bot/template/splamy/(/xecute(/pm/channel/$finalMsg)" }
catch {
Write-Host "Failed to notify:"
Write-Host $_
}
on_failure:
- pwsh: >-
# cut to the first 7 chars of the commit hash
$commitCut = $env:APPVEYOR_REPO_COMMIT.Substring(0, 7)
# and set up a nice teamspeak link for it
$commitLink = "[url=https://github.com/$env:APPVEYOR_REPO_NAME/commit/$env:APPVEYOR_REPO_COMMIT]$commitCut[/url]"
# now we do the same for the appveyor build
$buildLink = "[url=https://ci.appveyor.com/project/$env:APPVEYOR_REPO_NAME/builds/$env:APPVEYOR_BUILD_ID]Build #$env:APPVEYOR_BUILD_NUMBER[/url]"
$gitTitle = git log --format=%B -n 1 HEAD | Out-String
$finalMsg = [System.Uri]::EscapeDataString("Commit $commitLink in branch $env:APPVEYOR_REPO_BRANCH ($buildLink) [b][color=red]failed[/b].`n Summary: $gitTitle")
$finalMsg = $finalMsg.Replace("(", "%28").Replace(")", "%29")
try { Invoke-RestMethod -Uri "https://bot.splamy.de/api/bot/template/splamy/(/xecute(/pm/channel/$finalMsg)" }
catch {
Write-Host "Failed to notify:"
Write-Host $_
}