forked from JanDeDobbeleer/oh-my-posh2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
appveyor.yml
59 lines (59 loc) · 2.61 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
skip_tags: true
environment:
GH_KEY:
secure: 7CipYchiaJLIPf5MRNnJ2+Nk7dm+FxWkEHlASCcskJbMz+jbdz/qiseUeKCkQKHC
NG_KEY:
secure: tN2AWqN8DMHjaUvl6AbwwMK1GrF6K0xPiCSGRh1SWZGex4kgVAx+Rri1AxxPYmBg
CA_KEY:
secure: 3kVQxECrq007jkGdai1dUpk35w+YigWkfk5C5aXi2lAX0zU+oOI1SYkGo2o6NbIp
version: 2.0.{build}
image: Visual Studio 2017
build_script:
- ps: (Get-Content '.\oh-my-posh.psd1' -Raw).Replace('1.0.0.0', $ENV:APPVEYOR_BUILD_VERSION) | Out-File -Encoding 'UTF8' '.\oh-my-posh.psd1'
before_test:
- ps: .\Build\setup_test_env.ps1
- pwsh: .\Build\setup_test_env.ps1
test_script:
- ps: .\Build\test_script_v5.ps1
- pwsh: Invoke-Pester
deploy_script:
- ps: >-
if ($ENV:APPVEYOR_REPO_BRANCH -eq 'master' -and [string]::IsNullOrWhiteSpace($ENV:APPVEYOR_PULL_REQUEST_NUMBER)) {
Publish-Module -path . -NuGetApiKey $env:NG_KEY -Verbose
#Create GitHub release
Write-Host 'Starting GitHub release'
$releaseData = @{
tag_name = $ENV:APPVEYOR_BUILD_VERSION
target_commitish = 'master'
name = $ENV:APPVEYOR_BUILD_VERSION
draft = $false
prerelease = $false
}
$auth = 'Basic ' + [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes($env:GH_KEY + ':x-oauth-basic'))
$releaseParams = @{
Uri = 'https://api.github.com/repos/jandedobbeleer/oh-my-posh/releases'
Method = 'POST'
Headers = @{
Authorization = $auth
}
ContentType = 'application/json'
Body = (ConvertTo-Json -InputObject $releaseData -Compress)
}
$result = Invoke-RestMethod @releaseParams
$uploadUri = $result | Select-Object -ExpandProperty upload_url
$uploadUri = $uploadUri -creplace '\{\?name,label\}' #, '?name=oh-my-posh.zip'
$uploadUri = $uploadUri + '?name=oh-my-posh.zip'
Add-Type -assembly "system.io.compression.filesystem"
[io.compression.zipfile]::CreateFromDirectory($env:APPVEYOR_BUILD_FOLDER, "$HOME\Desktop\oh-my-posh.zip")
$uploadParams = @{
Uri = $uploadUri
Method = 'POST'
Headers = @{
Authorization = $auth
}
ContentType = 'application/zip'
InFile = "$HOME\Desktop\oh-my-posh.zip"
}
$result = Invoke-RestMethod @uploadParams
Write-Host 'GitHub release completed'
}