powershell Powershell脚本将UWP .zip包上传到hockeyapp进行部署

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了powershell Powershell脚本将UWP .zip包上传到hockeyapp进行部署相关的知识,希望对你有一定的参考价值。

 Param(
     [string]$HockeyAppAppID, 
     [string]$HockeyAppApiToken
 )
 
$zipFile = Get-Item *.zip | Select-Object -first 1
Write-Host "Zip file found to upload $($zipFile)"

$create_url = "https://rink.hockeyapp.net/api/2/apps/$HockeyAppAppID/app_versions/new"
 
$zip = $zipFile.BaseName
$version = $zip.subString(0,$zip.LastIndexOf("_"))
$version = $version.subString(0,$version.LastIndexOf("_"))
$version = $version.subString($version.LastIndexOf("_")+1)
Write-Host "Extracted version from zip file $($version)"
 
$response = Invoke-RestMethod -Method POST -Uri $create_url  -Header @{ "X-HockeyAppToken" = $HockeyAppApiToken } -Body @{bundle_version = $Version}
 
$update_url = "https://rink.hockeyapp.net/api/2/apps/$($HockeyAppAppID)/app_versions/$($response.id)"
 

$fileBin = [IO.File]::ReadAllBytes($zipFile)
$enc = [System.Text.Encoding]::GetEncoding("ISO-8859-1")
$fileEnc = $enc.GetString($fileBin)
$boundary = [System.Guid]::NewGuid().ToString()
$LF = "`r`n"

$bodyLines = (
    "--$boundary",
	"content-transfer-encoding: base64",
	"Content-Disposition: form-data; content-transfer-encoding: `"base64`"; name=`"ipa`"; filename=`" [System.IO.Path]::GetFileName $zipFile`"$LF",$fileEnc,
    "--$boundary",
    "Content-Disposition: form-data; name=`"status`"$LF","2",
    "--$boundary--$LF") -join $LF
	
Invoke-RestMethod -Uri $update_url -Method PUT -Headers @{ "X-HockeyAppToken" = $HockeyAppApiToken } -ContentType "multipart/form-data; boundary=`"$boundary`""  -Body $bodyLines

以上是关于powershell Powershell脚本将UWP .zip包上传到hockeyapp进行部署的主要内容,如果未能解决你的问题,请参考以下文章

powershell 将执行策略远程签名设置为信任powershell脚本

PowerShell 将powershell脚本转换成exe

powershell 用于将WebVTT转换为SRT的Windows PowerShell脚本

将变量从 Powershell 脚本传递到 SQLPlus

powershell Powershell脚本将UWP .zip包上传到hockeyapp进行部署

powershell脚本隐藏退出码