Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions eng/pipelines/templates/stages/sign.yml
Original file line number Diff line number Diff line change
Expand Up @@ -363,5 +363,7 @@ stages:
arguments: >-
-ZipFilePathAmd64 release/azd-darwin-amd64.zip
-ZipFilePathArm64 release/azd-darwin-arm64.zip
-LinuxArchivePathAmd64 release/azd-linux-amd64.tar.gz
-LinuxArchivePathArm64 release/azd-linux-arm64.tar.gz
-Version $(CLI_VERSION)
-OutFile homebrew-formula/azd.rb
6 changes: 5 additions & 1 deletion eng/scripts/Update-HomebrewFormula.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,18 @@ param(
[string] $TemplatePath = "$PSSCriptRoot/../templates/brew.template",
[string] $ZipFilePathAmd64,
[string] $ZipFilePathArm64,
[string] $LinuxArchivePathAmd64,
[string] $LinuxArchivePathArm64,
[string] $Version,
[string] $OutFile
)

$sha256amd64 = (Get-FileHash -Path $ZipFilePathAmd64 -Algorithm SHA256).Hash.ToLower()
$sha256arm64 = (Get-FileHash -Path $ZipFilePathArm64 -Algorithm SHA256).Hash.ToLower()
$sha256amd64_linux = (Get-FileHash -Path $LinuxArchivePathAmd64 -Algorithm SHA256).Hash.ToLower()
$sha256arm64_linux = (Get-FileHash -Path $LinuxArchivePathArm64 -Algorithm SHA256).Hash.ToLower()

$content = Get-Content $TemplatePath -Raw
$updatedContent = $content.Replace('%VERSION%', $Version).Replace('%SHA256AMD64%', $sha256amd64).Replace('%SHA256ARM64%', $sha256arm64)
$updatedContent = $content.Replace('%VERSION%', $Version).Replace('%SHA256AMD64%', $sha256amd64).Replace('%SHA256ARM64%', $sha256arm64).Replace('%SHA256AMD64_LINUX%', $sha256amd64_linux).Replace('%SHA256ARM64_LINUX%', $sha256arm64_linux)

Set-Content -Path $OutFile -Value $updatedContent
38 changes: 28 additions & 10 deletions eng/templates/brew.template
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,41 @@ class Azd < Formula
desc "Azure Developer CLI"
homepage "https://github.com/azure/azure-dev"

if Hardware::CPU.intel?
url "https://github.com/Azure/azure-dev/releases/download/azure-dev-cli_%VERSION%/azd-darwin-amd64.zip"
sha256 "%SHA256AMD64%"
elsif Hardware::CPU.arm?
url "https://github.com/Azure/azure-dev/releases/download/azure-dev-cli_%VERSION%/azd-darwin-arm64.zip"
sha256 "%SHA256ARM64%"
if OS.mac?
if Hardware::CPU.intel?
url "https://github.com/Azure/azure-dev/releases/download/azure-dev-cli_%VERSION%/azd-darwin-amd64.zip"
sha256 "%SHA256AMD64%"
elsif Hardware::CPU.arm?
url "https://github.com/Azure/azure-dev/releases/download/azure-dev-cli_%VERSION%/azd-darwin-arm64.zip"
sha256 "%SHA256ARM64%"
end
elsif OS.linux?
if Hardware::CPU.intel?
url "https://github.com/Azure/azure-dev/releases/download/azure-dev-cli_%VERSION%/azd-linux-amd64.tar.gz"
sha256 "%SHA256AMD64_LINUX%"
elsif Hardware::CPU.arm?
url "https://github.com/Azure/azure-dev/releases/download/azure-dev-cli_%VERSION%/azd-linux-arm64.tar.gz"
sha256 "%SHA256ARM64_LINUX%"
end
end

version "%VERSION%"

license "MIT"

def install
if Hardware::CPU.intel?
bin.install "azd-darwin-amd64" => "azd"
elsif Hardware::CPU.arm?
bin.install "azd-darwin-arm64" => "azd"
if OS.mac?
if Hardware::CPU.intel?
bin.install "azd-darwin-amd64" => "azd"
elsif Hardware::CPU.arm?
bin.install "azd-darwin-arm64" => "azd"
end
elsif OS.linux?
if Hardware::CPU.intel?
bin.install "azd-linux-amd64" => "azd"
elsif Hardware::CPU.arm?
bin.install "azd-linux-arm64" => "azd"
end
end

(bin/".installed-by.txt").write "brew"
Expand Down