-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Multiple files & versions of choice (#4)
- Loading branch information
Showing
6 changed files
with
86 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
Param( | ||
[string] | ||
[Parameter(Mandatory=$true)] | ||
$Files, | ||
|
||
[string] | ||
[Parameter(Mandatory=$false)] | ||
$Version = "latest" | ||
) | ||
|
||
if ($Files -eq $null) { | ||
Write-Host "Please provide at least one .bicep file" -ForegroundColor Red -BackgroundColor Yellow | ||
} | ||
|
||
$items = Get-ChildItem -Path $($Files -split " ") -Recurse | ||
if (($items -eq $null) -or ($items.Count -eq 0)) { | ||
Write-Host "Please provide at least one .bicep file" -ForegroundColor Red -BackgroundColor Yellow | ||
|
||
return | ||
} | ||
|
||
# Check Bicep version | ||
$uri = "https://api.github.com/repos/Azure/bicep/releases" | ||
$headers = @{ Accept = "application/vnd.github.v3+json" } | ||
|
||
$releases = Invoke-RestMethod -Method GET -Uri $uri -Headers $headers | ||
if ($Version -eq "latest") { | ||
$release = ($releases | Select-Object -Property tag_name | Sort-Object -Descending)[0] | ||
} else { | ||
$release = ($releases | Where-Object { $_.tag_name -like $Version.Replace("x", "*") } | Select-Object -Property tag_name | Sort-Object -Descending)[0] | ||
} | ||
|
||
$uri = "https://github.com/Azure/bicep/releases/download/$($release.tag_name)/bicep-linux-x64" | ||
|
||
# Fetch the given version of Bicep CLI binary | ||
curl -Lo bicep $uri | ||
|
||
# Mark it as executable | ||
chmod +x ./bicep | ||
|
||
# Add bicep to your PATH (requires admin) | ||
sudo mv ./bicep /usr/local/bin/bicep | ||
|
||
# Verify you can now access the 'bicep' command | ||
bicep --help | ||
# Done! | ||
|
||
# Build bicep files individually | ||
$items | ForEach-Object { | ||
bicep build $_.FullName | ||
|
||
Write-Host "$($_.FullName) -> $($_.FullName.Replace(".bicep", ".json"))" | ||
} |
This file was deleted.
Oops, something went wrong.