forked from JanDeDobbeleer/oh-my-posh2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
appveyor.yml
68 lines (67 loc) · 3.25 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
skip_tags: true
environment:
GH_KEY:
secure: 7CipYchiaJLIPf5MRNnJ2+Nk7dm+FxWkEHlASCcskJbMz+jbdz/qiseUeKCkQKHC
NG_KEY:
secure: tN2AWqN8DMHjaUvl6AbwwMK1GrF6K0xPiCSGRh1SWZGex4kgVAx+Rri1AxxPYmBg
CA_KEY:
secure: yyBVxcqc8JCSyOJf5I8ufwmwjkgMxouJ1ZyuCkAXdffDDU2VfZCZHK9lkHeph3SM
version: 2.0.{build}
image: WMF 5
install:
- ps: Get-PackageProvider -Name Nuget -Force
- ps: cinst pester
build_script:
- ps: (Get-Content '.\oh-my-posh.psd1' -Raw).Replace('%version%', $ENV:APPVEYOR_BUILD_VERSION) | Out-File -Encoding 'UTF8' '.\oh-my-posh.psd1'
before_test:
- ps: Set-PSRepository -Name PSGallery -InstallationPolicy Trusted
- ps: Install-Module Coveralls -MinimumVersion 1.0.25 -Scope CurrentUser
- ps: Import-Module Coveralls
test_script:
- ps: $coverageSet = @('Helpers\PoshGit.ps1','Helpers\Prompt.ps1')
- ps: $res = Invoke-Pester -CodeCoverage $coverageSet -OutputFormat NUnitXml -OutputFile TestsResults.xml -PassThru -EnableExit
- ps: (New-Object 'System.Net.WebClient').UploadFile("https://ci.appveyor.com/api/testresults/nunit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path .\TestsResults.xml))
- ps: if (!$ENV:CA_KEY) { $ENV:CA_KEY = "14mb4l0n1" }
- ps: $coverageResult = Format-Coverage -PesterResults $res -CoverallsApiToken $ENV:CA_KEY -BranchName $ENV:APPVEYOR_REPO_BRANCH
- ps: Publish-Coverage -Coverage $coverageResult
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/janjoris/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'
}