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
36 changes: 35 additions & 1 deletion .azuredevops/pipelineTemplates/jobs.publishModule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,13 @@ jobs:
}
}

# Filter modules to publish 'prerelease' only if branch is not main/master
$BranchName = '$(Build.SourceBranch)'
if ($BranchName -ne 'refs/heads/main' -and $BranchName -ne 'refs/heads/master') {
Write-Verbose "Filtering modules to only publish a [prerelease] version as the current branch [$BranchName] is not [main/master]." -Verbose
$modulesToPublish = $modulesToPublish | Where-Object -Property version -like '*-prerelease'
}

#################
## Publish ##
#################
Expand Down Expand Up @@ -225,6 +232,13 @@ jobs:
pwsh: true
ScriptType: InlineScript
inline: |
# Load PS-Profile configuration
if (Test-Path $profile) {
. $profile
} else {
Write-Warning "No profile loaded from location [$profile]"
}

# Set context to chosen subscription
Write-Verbose ('Setting context to subscription [{0}]' -f '${{ parameters.subscriptionId }}') -Verbose
$null = Set-AzContext -Subscription '${{ parameters.subscriptionId }}'
Expand Down Expand Up @@ -279,6 +293,13 @@ jobs:
}
}

# Filter modules to publish 'prerelease' only if branch is not main/master
$BranchName = '$(Build.SourceBranch)'
if ($BranchName -ne 'refs/heads/main' -and $BranchName -ne 'refs/heads/master') {
Write-Verbose "Filtering modules to only publish a [prerelease] version as the current branch [$BranchName] is not [main/master]." -Verbose
$modulesToPublish = $modulesToPublish | Where-Object -Property version -like '*-prerelease'
}

#################
## Publish ##
#################
Expand Down Expand Up @@ -316,8 +337,14 @@ jobs:
scriptType: pscore
scriptLocation: inlineScript
inlineScript: |
# Load PS-Profile configuration
if (Test-Path $profile) {
. $profile
} else {
Write-Warning "No profile loaded from location [$profile]"
}

# Log into Az-PowerShell context
. $profile # Load PS-Profile configuration
$SecuredPassword = ConvertTo-SecureString -AsPlainText -String $env:servicePrincipalKey
$Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $env:servicePrincipalId, $SecuredPassword
$null = Connect-AzAccount -ServicePrincipal -TenantId $env:tenantId -Credential $Credential
Expand Down Expand Up @@ -370,6 +397,13 @@ jobs:

$missingModules = Get-ModulesMissingFromPrivateBicepRegistry @missingInputObject

# Filter modules to publish 'prerelease' only if branch is not main/master
$BranchName = '$(Build.SourceBranch)'
if ($BranchName -ne 'refs/heads/main' -and $BranchName -ne 'refs/heads/master') {
Write-Verbose "Filtering modules to only publish a [prerelease] version as the current branch [$BranchName] is not [main/master]." -Verbose
$modulesToPublish = $modulesToPublish | Where-Object -Property version -like '*-prerelease'
}

foreach($missingModule in $missingModules) {
if($modulsToPublish.TemplateFilePath -notcontains $missingModule.TemplateFilePath) {
$modulesToPublish += $missingModule
Expand Down
14 changes: 14 additions & 0 deletions .github/actions/templates/publishModule/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,13 @@ runs:
}
}

# Filter modules to publish 'prerelease' only if branch is not main/master
$BranchName = "$env:GITHUB_REF_NAME"
if ($BranchName -ne 'main' -and $BranchName -ne 'master') {
Write-Verbose "Filtering modules to only publish a [prerelease] version as the current branch [$BranchName] is not [main/master]." -Verbose
$modulesToPublish = $modulesToPublish | Where-Object -Property version -like '*-prerelease'
}

#################
## Publish ##
#################
Expand Down Expand Up @@ -222,6 +229,13 @@ runs:
}
}

# Filter modules to publish 'prerelease' only if branch is not main/master
$BranchName = "$env:GITHUB_REF_NAME"
if ($BranchName -ne 'main' -and $BranchName -ne 'master') {
Write-Verbose "Filtering modules to only publish a [prerelease] version as the current branch [$BranchName] is not [main/master]." -Verbose
$modulesToPublish = $modulesToPublish | Where-Object -Property version -like '*-prerelease'
}

#################
## Publish ##
#################
Expand Down
2 changes: 1 addition & 1 deletion utilities/tools/Set-ModuleReadMe.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -1575,7 +1575,7 @@ function Set-ModuleReadMe {
}

$moduleRoot = Split-Path $TemplateFilePath -Parent
$fullModuleIdentifier = $moduleRoot.Replace('\', '/').split('modules/')[1]
$fullModuleIdentifier = $moduleRoot.Replace('\', '/').split('modules/')[-1]
# Custom modules are modules having the same resource type but different properties based on the name
# E.g., web/site/config--appsetting vs web/site/config--authsettingv2
$customModuleSeparator = '--'
Expand Down