forked from Splamy/TS3AudioBot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
appveyor.yml
92 lines (79 loc) · 4.2 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
version: appveyor-{branch}-{build}
branches:
only:
- master
- develop
image: Visual Studio 2019
configuration: Release
clone_depth: 99999
environment:
UPLOAD_TOKEN:
secure: wQTHAXf9NMII8m8gga6cVnA/yE6PCW5jzOppF7jgUlM=
cache:
- '%USERPROFILE%\.nuget\packages -> TS3AudioBot\TS3AudioBot.csproj, TSLib\TSLib.csproj, TS3ABotUnitTests\TS3ABotUnitTests.csproj'
- 'WebInterface\node_modules -> WebInterface\package.json'
build:
parallel: true
verbosity: minimal
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
install:
- ps: Install-Product node LTS
- pwsh: Install-Module Microsoft.PowerShell.Archive -MinimumVersion 1.2.5 -Repository PSGallery -Force
before_build:
- pwsh: |-
nuget restore
deploy_script:
- pwsh: |-
if(${env:UPLOAD_TOKEN}) {
dotnet publish TS3AudioBot -c Release --framework netcoreapp3.1
$targets_linux = "linux-x64", "linux-arm", "linux-arm64"
$targets = $targets_linux + "win-x64"
foreach ($target in $targets) {
Write-Host -ForegroundColor Yellow Publishing $target
dotnet publish TS3AudioBot -c Release --framework netcoreapp3.1 --self-contained --runtime $target -p:PublishSingleFile=true,IncludeSymbolsInSingleFile=true,PublishTrimmed=true
}
Write-Host -ForegroundColor Yellow Extracting Version
$rel = [io.path]::combine("${env:APPVEYOR_BUILD_FOLDER}", "TS3AudioBot", "bin", "Release")
cd([io.path]::combine(${rel}, "netcoreapp3.1"))
(dotnet .\TS3AudioBot.dll -V | Out-String) -match "Version: (?<version>[-_\d\w\.]+)"
$ver = $matches['version']
echo "Current version: ${ver}"
Write-Host -ForegroundColor Yellow Building Webinterface
cd([io.path]::combine("${env:APPVEYOR_BUILD_FOLDER}", "WebInterface"))
npm install
npm run build
$webInter = [io.path]::combine(${rel}, "WebInterface")
Copy-Item "./dist" -Destination $webInter -Recurse
Write-Host -ForegroundColor Yellow Packing dotnet 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}?filename=TS3AudioBot.zip&commit=${env:APPVEYOR_REPO_COMMIT}&version=${ver}" -Headers @{ "Content-Type" = "application/zip"; "Authorization" = "${env:UPLOAD_TOKEN}" } -Method Put -InFile .\TS3AudioBot.zip
Write-Host -ForegroundColor Yellow Packing win-x64
cd([io.path]::combine(${rel}, "netcoreapp3.1", "win-x64", "publish"))
Compress-Archive -Path TS3AudioBot.exe,../../../WebInterface -DestinationPath TS3AudioBot.zip
Invoke-RestMethod -Uri "https://splamy.de/api/nightly/ts3ab/${env:APPVEYOR_REPO_BRANCH}_win_x64?filename=TS3AudioBot.zip&commit=${env:APPVEYOR_REPO_COMMIT}&version=${ver}" -Headers @{ "Content-Type" = "application/zip"; "Authorization" = "${env:UPLOAD_TOKEN}" } -Method Put -InFile .\TS3AudioBot.zip
$pack_linux = [io.path]::combine("${env:APPVEYOR_BUILD_FOLDER}", "Tools", "pack_linux.csx")
foreach ($target in $targets_linux) {
Write-Host -ForegroundColor Yellow Packing $target
cd([io.path]::combine(${rel}, "netcoreapp3.1", $target, "publish"))
Copy-Item $webInter -Destination "./WebInterface" -Recurse
# creates TS3AudioBot.tar.gz
dotnet script $pack_linux
$name = $target -replace '-','_'
Invoke-RestMethod -Uri "https://splamy.de/api/nightly/ts3ab/${env:APPVEYOR_REPO_BRANCH}_${name}?filename=TS3AudioBot.tar.gz&commit=${env:APPVEYOR_REPO_COMMIT}&version=${ver}" -Headers @{ "Content-Type" = "application/gzip"; "Authorization" = "${env:UPLOAD_TOKEN}" } -Method Put -InFile .\TS3AudioBot.tar.gz
}
}
on_success:
- pwsh: |-
& ([io.path]::combine("${env:APPVEYOR_BUILD_FOLDER}", "Tools", "ts3notify.ps1")) 1
on_failure:
- pwsh: |-
& ([io.path]::combine("${env:APPVEYOR_BUILD_FOLDER}", "Tools", "ts3notify.ps1")) 0