mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-26 13:23:05 +07:00
Fix protoc support on Windows
This commit is contained in:
parent
189e8e6ec0
commit
04b2ed5b3e
@ -1,15 +1,17 @@
|
|||||||
Function Get-ProtobufTag() {
|
Function Get-ProtobufTag() {
|
||||||
|
$releases = 'https://github.com/protocolbuffers/protobuf/releases'
|
||||||
if("$protobuf_tag" -eq "latest") {
|
if("$protobuf_tag" -eq "latest") {
|
||||||
$protobuf_tag = (Invoke-RestMethod https://api.github.com/repos/protocolbuffers/protobuf/releases).tag_name | Where-Object { $_ -match "v\d+.\d+.\d+$" } | Select-Object -First 1
|
$protobuf_tag = (Invoke-WebRequest -UseBasicParsing -Uri $releases/latest).BaseResponse.RequestMessage.RequestUri.Segments[-1]
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
[net.httpWebRequest] $request = [net.webRequest]::create("https://github.com/protocolbuffers/protobuf/releases/tag/v$protobuf_tag")
|
$protobuf_tag = $protobuf_tag -replace '^v', ''
|
||||||
$req.Method = "HEAD"
|
[net.httpWebRequest] $request = [net.webRequest]::create("$releases/tag/v$protobuf_tag")
|
||||||
|
$request.Method = "HEAD"
|
||||||
[net.httpWebResponse] $response = $request.getResponse()
|
[net.httpWebResponse] $response = $request.getResponse()
|
||||||
$response.Close()
|
$response.Close()
|
||||||
$protobuf_tag = "v$protobuf_tag"
|
$protobuf_tag = "v$protobuf_tag"
|
||||||
} catch {
|
} catch {
|
||||||
$protobuf_tag = (Invoke-RestMethod https://api.github.com/repos/protocolbuffers/protobuf/releases).tag_name | Where-Object { $_ -match "v\d+.\d+.\d+$" } | Select-Object -First 1
|
$protobuf_tag = (Invoke-WebRequest -UseBasicParsing -Uri $releases/latest).BaseResponse.RequestMessage.RequestUri.Segments[-1]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $protobuf_tag
|
return $protobuf_tag
|
||||||
|
Loading…
Reference in New Issue
Block a user