Fix protoc setup

This commit is contained in:
Shivam Mathur 2022-03-26 00:10:00 +05:30
parent d37cc30485
commit 9e33c7b24e
No known key found for this signature in database
GPG Key ID: 3E13E4C8591ACC2A

View File

@ -1,6 +1,6 @@
Function Get-ProtobufTag() { Function Get-ProtobufTag() {
if("$protobuf_tag" -eq "latest") { if("$protobuf_tag" -eq "latest") {
$protobuf_tag = (Invoke-RestMethod https://api.github.com/repos/protocolbuffers/protobuf/tags).Name | Where-Object { $_ -match "v\d+.\d+.\d+$" } | Select-Object -First 1 $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
} else { } else {
try { try {
[net.httpWebRequest] $request = [net.webRequest]::create("https://github.com/protocolbuffers/protobuf/releases/tag/v$protobuf_tag") [net.httpWebRequest] $request = [net.webRequest]::create("https://github.com/protocolbuffers/protobuf/releases/tag/v$protobuf_tag")
@ -9,7 +9,7 @@ Function Get-ProtobufTag() {
$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/tags).Name | Where-Object { $_ -match "v\d+.\d+.\d+$" } | Select-Object -First 1 $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
} }
} }
return $protobuf_tag return $protobuf_tag