From 6d9ee6dcc3d24fa313dc3fea90ceae9d7fe1d058 Mon Sep 17 00:00:00 2001 From: freddydk Date: Fri, 24 Nov 2023 23:22:46 +0100 Subject: [PATCH] add useProjectsAsFolders setting --- Actions/AL-Go-Helper.ps1 | 1 + ...ReferenceDocumentation.HelperFunctions.ps1 | 37 +++++++++---------- .../BuildReferenceDocumentation.ps1 | 4 +- RELEASENOTES.md | 1 + Scenarios/settings.md | 2 +- 5 files changed, 22 insertions(+), 23 deletions(-) diff --git a/Actions/AL-Go-Helper.ps1 b/Actions/AL-Go-Helper.ps1 index ddedee320..dc0ce03bb 100644 --- a/Actions/AL-Go-Helper.ps1 +++ b/Actions/AL-Go-Helper.ps1 @@ -626,6 +626,7 @@ function ReadSettings { "ContinuousDeployment" = $false "DeployToGitHubPages" = $true "MaxReleases" = 3 + "useProjectsAsFolders" = $true "Projects" = @() "ExcludeProjects" = @() "Header" = "Documentation for {REPOSITORY} {VERSION}" diff --git a/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.HelperFunctions.ps1 b/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.HelperFunctions.ps1 index 1ebfc9a09..fb9337ec0 100644 --- a/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.HelperFunctions.ps1 +++ b/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.HelperFunctions.ps1 @@ -59,6 +59,7 @@ function GenerateDocsSite { [string] $defaultReleaseMD, [string] $docsPath, [string] $logLevel, + [switch] $useProjectsAsFolders, [switch] $hostIt ) @@ -123,31 +124,27 @@ function GenerateDocsSite { } $allApps | ConvertTo-Json -Depth 99 | Out-Host if ($allApps.Keys.Count -eq 1 -and $allApps.Keys[0] -eq $repoName) { - # Single project repo - foreach($appFile in $allApps."$repoName") { - $apps += @($appFile) - $appName, $appFolder = GetAppNameAndFolder -appFile $appFile - $newTocYml += @( - " - name: $appName" - " href: reference/$appFolder/toc.yml" - ) - } + # Single project repo - do not use project names as folders + $useProjectsAsFolders = $false } - else { - # Multi project repo add all apps - foreach($project in $allApps.Keys) { + foreach($project in $allApps.Keys) { + if ($useProjectsAsFolders) { $newTocYml += @( " - name: $project" " items:" ) - foreach($appFile in $allApps."$project") { - $apps += @($appFile) - $appName, $appFolder = GetAppNameAndFolder -appFile $appFile - $newTocYml += @( - " - name: $appName" - " href: reference/$appFolder/toc.yml" - ) - } + $indent = " " + } + else { + $indent = " " + } + foreach($appFile in $allApps."$project") { + $apps += @($appFile) + $appName, $appFolder = GetAppNameAndFolder -appFile $appFile + $newTocYml += @( + "$($indent)- name: $appName" + "$($indent) href: reference/$appFolder/toc.yml" + ) } } diff --git a/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.ps1 b/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.ps1 index f3e417e05..834859106 100644 --- a/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.ps1 +++ b/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.ps1 @@ -61,7 +61,7 @@ foreach($release in $releases) { $allApps, $allDependencies = CalculateProjectsAndApps -tempFolder $tempFolder -projects $projects -excludeProjects $excludeProjects $version = $release.Name $releaseNotes = $release.body - GenerateDocsSite -version $version -allVersions $versions -allApps $allApps -repoName $settings.repoName -releaseNotes $releaseNotes -header $header -footer $footer -defaultIndexMD $defaultIndexMD -defaultReleaseMD $defaultReleaseMD -docsPath $docsPath -logLevel $logLevel + GenerateDocsSite -version $version -allVersions $versions -allApps $allApps -repoName $settings.repoName -releaseNotes $releaseNotes -header $header -footer $footer -defaultIndexMD $defaultIndexMD -defaultReleaseMD $defaultReleaseMD -docsPath $docsPath -logLevel $logLevel -useProjectsAsFolders:$settings.ALDoc.useProjectsAsFolders do { try { $retry = $false @@ -98,7 +98,7 @@ if ($latestReleaseTag) { else { $releaseNotes = '' } -GenerateDocsSite -version '' -allVersions $versions -allApps $allApps -repoName $settings.repoName -releaseNotes $releaseNotes -header $header -footer $footer -defaultIndexMD $defaultIndexMD -defaultReleaseMD $defaultReleaseMD -docsPath $docsPath -logLevel $logLevel +GenerateDocsSite -version '' -allVersions $versions -allApps $allApps -repoName $settings.repoName -releaseNotes $releaseNotes -header $header -footer $footer -defaultIndexMD $defaultIndexMD -defaultReleaseMD $defaultReleaseMD -docsPath $docsPath -logLevel $logLevel -useProjectsAsFolders:$settings.ALDoc.useProjectsAsFolders if ($artifactsFolderCreated) { Remove-Item $artifactsFolder -Recurse -Force diff --git a/RELEASENOTES.md b/RELEASENOTES.md index e9195836c..306736000 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -14,6 +14,7 @@ Note that when using the preview version of AL-Go for GitHub, we recommend you U - **ContinuousDeployment** = Determines if reference documentation will be deployed continuously as part of CI/CD. You can run the **Deploy Reference Documentation** workflow to deploy manually or on a schedule. (Default false) - **DeployToGitHubPages** = Determines whether or not the reference documentation site should be deployed to GitHub Pages for the repository. In order to deploy to GitHub Pages, GitHub Pages must be enabled and set to GitHub Actuibs. (Default true) - **MaxReleases** = Maximum number of releases to include in the reference documentation. (Default 3) + - **useProjectsAsFolders** = Determines whether projects in multi-project repositories are used as folders in reference documentation - **Projects** = An array of projects to include in the reference documentation. (Default all) - **ExcludeProjects** = An array of projects to exclude in the reference documentation. (Default none)- - **Header** = Header for the documentation site. (Default: Documentation for...) diff --git a/Scenarios/settings.md b/Scenarios/settings.md index ca809656c..060afbf8f 100644 --- a/Scenarios/settings.md +++ b/Scenarios/settings.md @@ -59,7 +59,7 @@ The repository settings are only read from the repository settings file (.github | environments | Array of logical environment names. You can specify environments in GitHub environments or in the repo settings file. If you specify environments in the settings file, you can create your AUTHCONTEXT secret using **<environmentname>_AUTHCONTEXT**. You can specify additional information about environments in a setting called **DeployTo<environmentname>** | | DeliverTo<deliveryTarget> | Structure with additional properties for the deliveryTarget specified. Some properties are deliveryTarget specific. The structure can contain the following properties:
**Branches** = an array of branch patterns, which are allowed to deliver to this deliveryTarget. (Default main)
**CreateContainerIfNotExist** = *[Only for DeliverToStorage]* Create Blob Storage Container if it doesn't already exist. (Default false)
| | DeployTo<environmentname> | Structure with additional properties for the environment specified. The structure can contain the following properties:
**EnvironmentType** = specifies the type of environment. The environment type can be used to invoke a custom deployment. (Default SaaS)
**EnvironmentName** = specifies the "real" name of the environment if it differs from the GitHub environment.
**Branches** = an array of branch patterns, which are allowed to deploy to this environment. (Default main)
**Projects** = In multi-project repositories, this property can be a comma separated list of project patterns to deploy to this environment. (Default *)
**SyncMode** = ForceSync if deployment to this environment should happen with ForceSync, else Add. If deploying to the development endpoint you can also specify Development or Clean. (Default Add)
**ContinuousDeployment** = true if this environment should be used for continuous deployment, else false. (Default: AL-Go will continuously deploy to sandbox environments or environments, which doesn't end in (PROD) or (FAT)
**runs-on** = specifies which runner to use when deploying to this environment. (Default is settings.runs-on)
| -| ALDoc | Structure with properties for the aldoc reference document generation. The structure can contain the following properties:
**ContinuousDeployment** = Determines if reference documentation will be deployed continuously as part of CI/CD. You can run the **Deploy Reference Documentation** workflow to deploy manually or on a schedule. (Default false)
**DeployToGitHubPages** = Determines whether or not the reference documentation site should be deployed to GitHub Pages for the repository. In order to deploy to GitHub Pages, GitHub Pages must be enabled and set to GitHub Actuibs. (Default true)
**MaxReleases** = Maximum number of releases to include in the reference documentation. (Default 3)
**Projects** = An array of projects to include in the reference documentation. (Default all)
**ExcludeProjects** = An array of projects to exclude in the reference documentation. (Default none)
**Header** = Header for the documentation site. (Default: Documentation for...)
**Footer** = Footer for the documentation site. (Default: Made with...)
**DefaultIndexMD** = Markdown for the landing page of the documentation site. (Default: Reference documentation...)
**DefaultReleaseMD** = Markdown for the landing page of the release sites. (Default: Release reference documentation...)
*Note that in Header, Footer, DefaultIndexMD and DefaultReleaseMD you can use the following placeholders: {REPOSITORY}, {VERSION}, {INDEXTEMPLATERELATIVEPATH}, {RELEASENOTES}* | +| ALDoc | Structure with properties for the aldoc reference document generation. The structure can contain the following properties:
**ContinuousDeployment** = Determines if reference documentation will be deployed continuously as part of CI/CD. You can run the **Deploy Reference Documentation** workflow to deploy manually or on a schedule. (Default false)
**DeployToGitHubPages** = Determines whether or not the reference documentation site should be deployed to GitHub Pages for the repository. In order to deploy to GitHub Pages, GitHub Pages must be enabled and set to GitHub Actuibs. (Default true)
**MaxReleases** = Maximum number of releases to include in the reference documentation. (Default 3)
**useProjectsAsFolders** = Determines whether projects in multi-project repositories are used as folders in reference documentation
**Projects** = An array of projects to include in the reference documentation. (Default all)
**ExcludeProjects** = An array of projects to exclude in the reference documentation. (Default none)
**Header** = Header for the documentation site. (Default: Documentation for...)
**Footer** = Footer for the documentation site. (Default: Made with...)
**DefaultIndexMD** = Markdown for the landing page of the documentation site. (Default: Reference documentation...)
**DefaultReleaseMD** = Markdown for the landing page of the release sites. (Default: Release reference documentation...)
*Note that in Header, Footer, DefaultIndexMD and DefaultReleaseMD you can use the following placeholders: {REPOSITORY}, {VERSION}, {INDEXTEMPLATERELATIVEPATH}, {RELEASENOTES}* | | useProjectDependencies | Determines whether your projects are built using a multi-stage built workflow or single stage. After setting useProjectDependencies to true, you need to run Update AL-Go System Files and your workflows including a build job will change to have multiple build jobs, depending on each other. The number of build jobs will be determined by the dependency depth in your projects.
You can change dependencies between your projects, but if the dependency **depth** changes, AL-Go will warn you that updates for your AL-Go System Files are available and you will need to run the workflow. | | CICDPushBranches | CICDPushBranches can be specified as an array of branches, which triggers a CI/CD workflow on commit.
Default is [ "main", "release/\*", "feature/\*" ] | | CICDPullRequestBranches | CICDPullRequestBranches can be specified as an array of branches, which triggers a CI/CD workflow on a PR.
Default is [ "main" ] |