-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathappveyor.yml
54 lines (53 loc) · 2.37 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
skip_tags: true
environment:
GH_KEY:
secure: 7CipYchiaJLIPf5MRNnJ2+Nk7dm+FxWkEHlASCcskJbMz+jbdz/qiseUeKCkQKHC
NG_KEY:
secure: tN2AWqN8DMHjaUvl6AbwwMK1GrF6K0xPiCSGRh1SWZGex4kgVAx+Rri1AxxPYmBg
version: 1.0.{build}
image: WMF 5
install:
- ps: Get-PackageProvider -Name Nuget -Force
build_script:
- ps: (Get-Content '.\Get-PackageUpdates.psd1' -Raw).Replace('%version%', $ENV:APPVEYOR_BUILD_VERSION) | Out-File -Encoding 'UTF8' '.\Get-PackageUpdates.psd1'
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/get-packageupdates/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\}'
$uploadUri = $uploadUri + '?name=get-packageupdates.zip'
Add-Type -assembly "system.io.compression.filesystem"
[io.compression.zipfile]::CreateFromDirectory($env:APPVEYOR_BUILD_FOLDER, "$HOME\Desktop\get-packageupdates.zip")
$uploadParams = @{
Uri = $uploadUri
Method = 'POST'
Headers = @{
Authorization = $auth
}
ContentType = 'application/zip'
InFile = "$HOME\Desktop\get-packageupdates.zip"
}
$result = Invoke-RestMethod @uploadParams
Write-Host 'GitHub release completed'
}