From 61db37c7ea2717b4c2ddfd952bdab87cf4e52a31 Mon Sep 17 00:00:00 2001 From: peteGSX Date: Wed, 5 Apr 2023 05:30:00 +1000 Subject: [PATCH] Got tag version and URL --- installer.ps1 | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/installer.ps1 b/installer.ps1 index defccd6..3b95535 100644 --- a/installer.ps1 +++ b/installer.ps1 @@ -20,10 +20,11 @@ # 32/64 bit Win installer # https://downloads.arduino.cc/arduino-cli/arduino-cli_latest_Windows_32bit.zip # https://downloads.arduino.cc/arduino-cli/arduino-cli_latest_Windows_64bit.zip +# +# For script errors set ExecutionPolicy: +# Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Bypass -$gitHubAPITags = "https://api.github.com/repos/DCC-EX/CommandStation-EX/git/refs/tags" - -param( +Param( [Parameter()] [String]$buildDirectory ) @@ -34,6 +35,8 @@ if (!$PSBoundParameters.ContainsKey('buildDirectory')) { $buildDirectory = $env:TEMP + "\" + $buildDate } +$gitHubAPITags = "https://api.github.com/repos/DCC-EX/CommandStation-EX/git/refs/tags" + if ((Get-WmiObject win32_operatingsystem | Select-Object osarchitecture).osarchitecture -eq "64-bit") { $arduinoCLIURL = "https://downloads.arduino.cc/arduino-cli/arduino-cli_latest_Windows_64bit.zip" $arduinoCLIZip = $env:TEMP + "\" + "arduino-cli_latest_Windows_64bit.zip" @@ -54,6 +57,12 @@ $ProgressPreference = "Continue" Write-Output "Installing using directory $buildDirectory" -foreach ($tag in Invoke-RestMethod -Uri $gitHubAPITags | Format-List -Property ref) { - $tag.getType() +$tagList = Invoke-RestMethod -Uri $gitHubAPITags + +# Example zip: https://github.com/DCC-EX/CommandStation-EX/archive/refs/tags/v4.2.36-Devel.zip + +foreach ($tag in $tagList) { + $version = $tag.ref.split("/")[2] + $versionURL = "https://github.com/DCC-EX/CommandStation-EX/archive/" + $tag.ref + Write-Output "$version : $versionURL" }