Skip to content

Commit

Permalink
Add azure-functions-core-tools 'dummy' package
Browse files Browse the repository at this point in the history
- We are not the owner of this package, but we would like to submit the binaries to VirusTotal
  • Loading branch information
flcdrg committed Jun 24, 2024
1 parent 89e70ee commit 2078273
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 3 deletions.
16 changes: 13 additions & 3 deletions _scripts/GitHub.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,17 @@ $headers = @{}
.PARAMETER project
GitHub project path (used to create URL for API)
.PARAMETER tagPrefix
Prefix for the tag name
.PARAMETER newest
Set to true to just get the most recent release (not necessarily one marked 'latest')
.OUTPUTS
Output (if any)
#>
function Get-GitHubLatestRelease($project, $tagPrefix) {
function Get-GitHubLatestRelease($project, $tagPrefix, [switch] $newest) {

$token = $env:github_api_key
$script:headers = @{
Expand All @@ -27,7 +33,11 @@ function Get-GitHubLatestRelease($project, $tagPrefix) {

$releasesUrl = "https://api.github.com/repos/$project/releases"

if ($tagPrefix) {
if ($newest.IsPresent) {
$releases = Invoke-RestMethod -Method Get -Uri "$releasesUrl" -Headers $headers
$releases | Select-Object -First 1
}
elseif ($tagPrefix) {
$releases = Invoke-RestMethod -Method Get -Uri "$releasesUrl" -Headers $headers
$releases | Where-Object { $_.tag_name -and $_.tag_name.StartsWith($tagPrefix) } | Select-Object -First 1

Expand All @@ -37,7 +47,7 @@ function Get-GitHubLatestRelease($project, $tagPrefix) {
}

function Get-GitHubReleaseAssets($release) {
Invoke-RestMethod -Method Get -Uri $release.assets_url -Headers $script:headers
Invoke-RestMethod -Method Get -Uri "$($release.assets_url)?per_page=100" -Headers $script:headers
}

function Get-GitHubReleaseAssetsBrowserDownloadUrls($assets) {
Expand Down
17 changes: 17 additions & 0 deletions azure-functions-core-tools/azure-functions-core-tools.nuspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>azure-functions-core-tools</id>
<version>4.0.5858</version>
<title>Azure Function Core Tools</title>
<authors>Microsoft</authors>
<owners>nugetazurefunctions</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<licenseUrl>https://raw.githubusercontent.com/Azure/azure-functions-core-tools/master/LICENSE</licenseUrl>
<projectUrl>https://github.com/Azure/azure-functions-core-tools</projectUrl>
<iconUrl>https://raw.githubusercontent.com/Azure/azure-functions-core-tools/master/src/Azure.Functions.Cli/npm/assets/azure-functions-logo-color-raster.png</iconUrl>
<description>The Azure Functions Core Tools provide a local development experience for creating, developing, testing, running, and debugging Azure Functions.</description>
<summary>The Azure Functions Core Tools provide a local development experience for creating, developing, testing, running, and debugging Azure Functions.</summary>
<tags>azure functions azure-function cli core-tools</tags>
</metadata>
</package>
34 changes: 34 additions & 0 deletions azure-functions-core-tools/update.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
Import-Module chocolatey-au

. ../_scripts/GitHub.ps1

function global:au_SearchReplace {
@{}
}

function global:au_GetLatest {
$release = Get-GitHubLatestRelease "Azure/azure-functions-core-tools" -newest

$version = Get-ReleaseVersion -release $release

# Convert semver2 to semver1
$version = $version.Replace("-beta.", "-beta").Replace("-rc.", "-rc")

if (-not $version) {
Write-Warning "Couldn't find version number"
return "Ignore"
}

$assets = Get-GitHubReleaseAssets $release
$asset32 = $assets | Where-Object { $_.name -like "Azure.Functions.Cli.win-x86.*.zip" }
$asset64 = $assets | Where-Object { $_.name -like "Azure.Functions.Cli.win-x64.*.zip" }

$Latest = @{
Version = $version
Url32 = $asset32.browser_download_url
Url64 = $asset64.browser_download_url
}
return $Latest
}

update -Force

0 comments on commit 2078273

Please sign in to comment.