forked from dotnet/aspire
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstallLatestFromReleaseBranch.sh
executable file
·51 lines (38 loc) · 1.71 KB
/
installLatestFromReleaseBranch.sh
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
#!/bin/bash
# Check if jq is installed
if ! command -v jq &> /dev/null
then
echo "Error: jq is not installed. Please install jq to run this script."
echo "On Ubuntu/Debian: sudo apt-get install jq"
echo "On macOS: brew install jq"
exit 1
fi
# NuGet Feed URL
nugetUrl="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json"
# Package name to search for
packageName="Microsoft.NET.Sdk.Aspire.Manifest-8.0.100"
# Fetch the feed data
feedData=$(curl -s $nugetUrl)
# Extract resources and find the first package's metadata URL using jq
metadataUrl=$(echo $feedData | jq -r '.resources[] | select(."@type" | contains("RegistrationsBaseUrl")) | ."@id"' | head -1)
# Fetch the package data
packageData=$(curl -s "${metadataUrl}${packageName}/index.json")
# Get the latest version
latestVersion=$(echo $packageData | jq -r '.items[-1].upper')
# Create the content for the rollback file
fileContent=$(cat <<-END
{
"microsoft.net.sdk.aspire": "$latestVersion/8.0.100"
}
END
)
# Write to file
echo "$fileContent" > aspire-rollback.txt
# Run dotnet workload update command
dotnet workload update --source "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json" --skip-sign-check --from-rollback-file ./aspire-rollback.txt
# Run dotnet workload install command
dotnet workload install aspire --source "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json" --skip-sign-check --from-rollback-file ./aspire-rollback.txt
# Delete the rollback file as it is no longer needed.
rm -f ./aspire-rollback.txt
# Output the latest version
echo "Installed Latest version of aspire produced from the release branch. Version installed was $latestVersion."