Skip to content

Commit

Permalink
Update to latest
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexanderSehr committed Sep 19, 2023
1 parent 6709b7e commit d72e793
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,12 @@ Mandatory. The relative path of the module e.g. `avm/res/network/private-endpoin
#>

function Get-ModuleTargetVersion {

[CmdletBinding()]
param (
[Parameter()]
[string] $ModuleRelativePath
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,49 @@ function Publish-ToPublicBicepRegistry {
)

# Load used functions
. (Join-Path $PSScriptRoot 'Get-ModulesToPublish.ps1')
. (Join-Path $PSScriptRoot 'Get-ModulesMissingFromPrivateBicepRegistry.ps1')
. (Join-Path $PSScriptRoot 'Get-ModuleTargetVersion.ps1')
. (Join-Path $PSScriptRoot 'Get-BRMRepositoryName.ps1')
. (Join-Path $PSScriptRoot 'Get-ModuleReadmeLink.ps1')
. (Join-Path $PSScriptRoot 'Publish-ModuleToPrivateBicepRegistry.ps1')

$moduleRelativePath = Split-Path $TemplateFilePath -Parent

# 1. Get-ModuleTargetVersion
$targetVersion = Get-ModuleTargetVersion -ModuleRelativePath $moduleRelativePath

# 2. Get Target Published Module Name
$publishedModuleName = Get-BRMRepositoryName -TemplateFilePath $TemplateFilePath

# 3. Get-ModuleReadmeLink
$documentationUri = Get-ModuleReadmeLink -ModuleRelativePath $moduleRelativePath

# -2. Replace telemetry version value (in JSON)
$tokenConfiguration = @{

}
$null = Convert-TokensInFileList @tokenConfiguration

# -1. Publish
$jsonTemplateFilePath = Join-Path $moduleRelativePath 'main.json'
$plainPublicRegistryServer = ConvertFrom-SecureString $PublicRegistryServer -AsPlainText
$publishingTargetPath = "br:{0}/public/bicep/{1}:{2}" -f $plainPublicRegistryServer, $publishedModuleName, $targetVersion

# THIS would publish to the public registry
$publishInput = @(
$jsonTemplateFilePath
'--target', $publishingTargetPath
'--documentationUri', $documentationUri
'--force'
)
# bicep publish @publishInput








$modulesToPublish = @()

################################
Expand All @@ -31,26 +70,7 @@ function Publish-ToPublicBicepRegistry {
# Get the modified child resources
$modulesToPublish += Get-ModulesToPublish @functionInput -Verbose

#############################
## Get missing modules ##
#############################
# Add all modules that don't exist in the target location
$missingInputObject = @{
TemplateFilePath = $TemplateFilePath
BicepRegistryName = 'avmtemptesting-acr'
BicepRegistryRgName = 'avmtemptesting-rg'
}

Write-Verbose "Invoke Get-ModulesMissingFromPrivateBicepRegistry with" -Verbose
Write-Verbose ($missingInputObject | ConvertTo-Json | Out-String) -Verbose

$missingModules = Get-ModulesMissingFromPrivateBicepRegistry @missingInputObject

foreach ($missingModule in $missingModules) {
if ($modulesToPublish.TemplateFilePath -notcontains $missingModule.TemplateFilePath) {
$modulesToPublish += $missingModule
}
}

#################
## Publish ##
Expand All @@ -73,15 +93,7 @@ function Publish-ToPublicBicepRegistry {
Publish-ModuleToPrivateBicepRegistry @functionInput -Verbose


$targetVersion = '' # "${{ steps.parse-tag.outputs.version }}"
$moduleFilePath = '' # ${{ steps.parse-tag.outputs.module_path }}
$jsonTemplateFilePath = Join-Path (Split-Path $moduleToPublish.TemplateFilePath -Parent) 'main.json'
$plainPublicRegistryServer = ConvertFrom-SecureString $PublicRegistryServer -AsPlainText
$publishingTargetPath = "br:{0}/public/bicep/{1}:{2}" -f $plainPublicRegistryServer, $moduleFilePath, $targetVersion
$documentationUri = '' # "${{ steps.parse-tag.outputs.documentation_uri }}"

# THIS would publish to the public registry
# bicep publish $jsonTemplateFilePath --target $publishingTargetPath --documentationUri $documentationUri --force
}

}

0 comments on commit d72e793

Please sign in to comment.