From 75b13ea09984bc84ca7e2014bffcbb36039efed3 Mon Sep 17 00:00:00 2001 From: freddydk Date: Tue, 3 Oct 2023 13:01:40 +0200 Subject: [PATCH 001/235] _ --- Scenarios/settings.md | 2 +- Tests/DetermineDeploymentEnvironments.Test.ps1 | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Scenarios/settings.md b/Scenarios/settings.md index b7c11cc46..bc904918f 100644 --- a/Scenarios/settings.md +++ b/Scenarios/settings.md @@ -103,7 +103,7 @@ The repository settings are only read from the repository settings file (.github | assignPremiumPlan | Setting assignPremiumPlan to true in your project setting file, causes the build container to be created with the AssignPremiumPlan set. This causes the auto-created user to have Premium Plan enabled. This setting is needed if your tests require premium plan enabled. | false | | enableTaskScheduler | Setting enableTaskScheduler to true in your project setting file, causes the build container to be created with the Task Scheduler running. | false | | useCompilerFolder | Setting useCompilerFolder to true causes your pipelines to use containerless compiling. Unless you also set **doNotPublishApps** to true, setting useCompilerFolder to true won't give you any performance advantage, since AL-Go for GitHub will still need to create a container in order to publish and test the apps. In the future, publishing and testing will be split from building and there will be other options for getting an instance of Business Central for publishing and testing. | false | -| excludeEnvironments | excludeEnvironments can be an array of GitHub Environments, which should be excluded from the list of environments considered for deployment. github_pages is automatically added to this array and cannot be used as environment for deployment of AL-Go for GitHub projects. | [ ] | +| excludeEnvironments | excludeEnvironments can be an array of GitHub Environments, which should be excluded from the list of environments considered for deployment. github-pages is automatically added to this array and cannot be used as environment for deployment of AL-Go for GitHub projects. | [ ] | ## AppSource specific advanced settings diff --git a/Tests/DetermineDeploymentEnvironments.Test.ps1 b/Tests/DetermineDeploymentEnvironments.Test.ps1 index e4046347c..071b821f0 100644 --- a/Tests/DetermineDeploymentEnvironments.Test.ps1 +++ b/Tests/DetermineDeploymentEnvironments.Test.ps1 @@ -54,7 +54,7 @@ Describe "DetermineDeploymentEnvironments Action Test" { return (ConvertTo-Json -Compress -Depth 99 -InputObject @{ "environments" = @( @{ "name" = "test"; "protection_rules" = @() }, @{ "name" = "another"; "protection_rules" = @() } ) }) } - $env:Settings = @{ "type" = "PTE"; "runs-on" = "ubuntu-latest"; "environments" = @(); "excludeEnvironments" = @( 'github_pages' ) } | ConvertTo-Json -Compress + $env:Settings = @{ "type" = "PTE"; "runs-on" = "ubuntu-latest"; "environments" = @(); "excludeEnvironments" = @( 'github-pages' ) } | ConvertTo-Json -Compress . (Join-Path $scriptRoot $scriptName) -getEnvironments '*' -type 'CD' PassGeneratedOutput $EnvironmentsMatrixJson | ConvertFrom-Json | ConvertTo-HashTable -recurse | Should -MatchHashtable @{"matrix"=@{"include"=@(@{"environment"="another";"os"="[""ubuntu-latest""]"};@{"environment"="test";"os"="[""ubuntu-latest""]"})};"fail-fast"=$false} @@ -77,7 +77,7 @@ Describe "DetermineDeploymentEnvironments Action Test" { return (ConvertTo-Json -Compress -Depth 99 -InputObject @( @{ "name" = "branch"; "protected" = $true }, @{ "name" = "main"; "protected" = $false } )) } - $env:Settings = @{ "type" = "PTE"; "runs-on" = "ubuntu-latest"; "environments" = @(); "excludeEnvironments" = @( 'github_pages' ) } | ConvertTo-Json -Compress + $env:Settings = @{ "type" = "PTE"; "runs-on" = "ubuntu-latest"; "environments" = @(); "excludeEnvironments" = @( 'github-pages' ) } | ConvertTo-Json -Compress . (Join-Path $scriptRoot $scriptName) -getEnvironments '*' -type 'CD' PassGeneratedOutput $EnvironmentsMatrixJson | ConvertFrom-Json | ConvertTo-HashTable -recurse | Should -MatchHashtable @{"matrix"=@{"include"=@(@{"environment"="another";"os"="[""ubuntu-latest""]"})};"fail-fast"=$false} @@ -102,7 +102,7 @@ Describe "DetermineDeploymentEnvironments Action Test" { return @{ "branch_policies" = @( @{ "name" = "branch" }, @{ "name" = "branch2" } ) } | ConvertTo-Json -Depth 99 -Compress } - $env:Settings = @{ "type" = "PTE"; "runs-on" = "ubuntu-latest"; "environments" = @(); "excludeEnvironments" = @( 'github_pages' ) } | ConvertTo-Json -Compress + $env:Settings = @{ "type" = "PTE"; "runs-on" = "ubuntu-latest"; "environments" = @(); "excludeEnvironments" = @( 'github-pages' ) } | ConvertTo-Json -Compress # Only another environment should be included when deploying from main . (Join-Path $scriptRoot $scriptName) -getEnvironments '*' -type 'CD' PassGeneratedOutput @@ -150,7 +150,7 @@ Describe "DetermineDeploymentEnvironments Action Test" { return (ConvertTo-Json -Compress -Depth 99 -InputObject @{ "environments" = @( @{ "name" = "test"; "protection_rules" = @() }; @{ "name" = "another"; "protection_rules" = @() } ) }) } - $settings = @{ "type" = "PTE"; "runs-on" = "ubuntu-latest"; "environments" = @("settingsenv"); "excludeEnvironments" = @( 'github_pages' ) } + $settings = @{ "type" = "PTE"; "runs-on" = "ubuntu-latest"; "environments" = @("settingsenv"); "excludeEnvironments" = @( 'github-pages' ) } $env:Settings = $settings | ConvertTo-Json -Compress . (Join-Path $scriptRoot $scriptName) -getEnvironments '*' -type 'CD' PassGeneratedOutput @@ -191,7 +191,7 @@ Describe "DetermineDeploymentEnvironments Action Test" { } # One PROD environment and one non-PROD environment - only non-PROD environment is selected for CD - $settings = @{ "type" = "PTE"; "runs-on" = "ubuntu-latest"; "environments" = @("test (PROD)","another"); "excludeEnvironments" = @( 'github_pages' ) } + $settings = @{ "type" = "PTE"; "runs-on" = "ubuntu-latest"; "environments" = @("test (PROD)","another"); "excludeEnvironments" = @( 'github-pages' ) } $env:Settings = $settings | ConvertTo-Json -Compress . (Join-Path $scriptRoot $scriptName) -getEnvironments '*' -type 'CD' PassGeneratedOutput @@ -208,7 +208,7 @@ Describe "DetermineDeploymentEnvironments Action Test" { # 2 environments defined in Settings - one PROD and one non-PROD (settings based) It 'Test calling action directly - 2 environments defined in Settings - one PROD and one non-PROD (settings based)' { - $settings = @{ "type" = "PTE"; "runs-on" = "ubuntu-latest"; "environments" = @("test (PROD)","another"); "excludeEnvironments" = @( 'github_pages' ) } + $settings = @{ "type" = "PTE"; "runs-on" = "ubuntu-latest"; "environments" = @("test (PROD)","another"); "excludeEnvironments" = @( 'github-pages' ) } Mock InvokeWebRequest -ParameterFilter { $uri -like '*/environments' } -MockWith { throw "Not supported" From 1cc7c9cfc006a205faff88f54db07cfbd5486fcc Mon Sep 17 00:00:00 2001 From: freddydk Date: Tue, 3 Oct 2023 13:29:42 +0200 Subject: [PATCH 002/235] add aldoc --- .../.github/workflows/CICD.yaml | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/Templates/Per Tenant Extension/.github/workflows/CICD.yaml b/Templates/Per Tenant Extension/.github/workflows/CICD.yaml index 6b4ff0e77..139a8fcd6 100644 --- a/Templates/Per Tenant Extension/.github/workflows/CICD.yaml +++ b/Templates/Per Tenant Extension/.github/workflows/CICD.yaml @@ -149,6 +149,37 @@ jobs: signArtifacts: true useArtifactCache: true + BuildALDoc: + needs: [ Initialization, Build ] + if: always() && needs.Build.result == 'Success' + runs-on: ubuntu-latest + name: Build ALDoc Documentation + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup Pages + uses: actions/configure-pages@v3 + + - name: Build ALDoc Documentation + uses: microsoft/AL-Go-Actions/BuildALDoc@main + with: + shell: powershell + + - name: Upload pages artifact + uses: actions/upload-pages-artifact@v2 + + DeployALDoc: + needs: BuildALDoc + runs-on: ubuntu-latest + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v2 + Deploy: needs: [ Initialization, Build ] if: always() && needs.Build.result == 'Success' && needs.Initialization.outputs.environmentCount > 0 From 2049e83cb25143f97618f163def35f0d7b8ef630 Mon Sep 17 00:00:00 2001 From: freddydk Date: Tue, 3 Oct 2023 13:42:40 +0200 Subject: [PATCH 003/235] deploy --- .../.github/workflows/CICD.yaml | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/Templates/Per Tenant Extension/.github/workflows/CICD.yaml b/Templates/Per Tenant Extension/.github/workflows/CICD.yaml index 139a8fcd6..f45c501dd 100644 --- a/Templates/Per Tenant Extension/.github/workflows/CICD.yaml +++ b/Templates/Per Tenant Extension/.github/workflows/CICD.yaml @@ -149,11 +149,14 @@ jobs: signArtifacts: true useArtifactCache: true - BuildALDoc: + DeployALDoc: needs: [ Initialization, Build ] if: always() && needs.Build.result == 'Success' runs-on: ubuntu-latest - name: Build ALDoc Documentation + name: Deploy ALDoc Documentation + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} steps: - name: Checkout uses: actions/checkout@v3 @@ -169,13 +172,6 @@ jobs: - name: Upload pages artifact uses: actions/upload-pages-artifact@v2 - DeployALDoc: - needs: BuildALDoc - runs-on: ubuntu-latest - environment: - name: github-pages - url: ${{ steps.deployment.outputs.page_url }} - steps: - name: Deploy to GitHub Pages id: deployment uses: actions/deploy-pages@v2 From 005b10933b861e2df9851a7942ff2bbd74840e77 Mon Sep 17 00:00:00 2001 From: freddydk Date: Tue, 3 Oct 2023 14:10:53 +0200 Subject: [PATCH 004/235] need --- Templates/Per Tenant Extension/.github/workflows/CICD.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Templates/Per Tenant Extension/.github/workflows/CICD.yaml b/Templates/Per Tenant Extension/.github/workflows/CICD.yaml index f45c501dd..ac9d5d4ec 100644 --- a/Templates/Per Tenant Extension/.github/workflows/CICD.yaml +++ b/Templates/Per Tenant Extension/.github/workflows/CICD.yaml @@ -271,7 +271,7 @@ jobs: PostProcess: if: (!cancelled()) runs-on: [ windows-latest ] - needs: [ Initialization, Build, Deploy, Deliver ] + needs: [ Initialization, Build, Deploy, Deliver, DeployALDoc ] steps: - name: Checkout uses: actions/checkout@v3 From a0371fe7baf4b40e91214b6ead8981540a5878a5 Mon Sep 17 00:00:00 2001 From: freddydk Date: Wed, 4 Oct 2023 04:40:26 +0200 Subject: [PATCH 005/235] add DeployALDoc action --- Actions/DeployALDoc/DeployALDoc.ps1 | 53 +++++++++++++++++++ Actions/DeployALDoc/README.md | 18 +++++++ Actions/DeployALDoc/action.yaml | 35 ++++++++++++ .../.github/workflows/CICD.yaml | 5 ++ 4 files changed, 111 insertions(+) create mode 100644 Actions/DeployALDoc/DeployALDoc.ps1 create mode 100644 Actions/DeployALDoc/README.md create mode 100644 Actions/DeployALDoc/action.yaml diff --git a/Actions/DeployALDoc/DeployALDoc.ps1 b/Actions/DeployALDoc/DeployALDoc.ps1 new file mode 100644 index 000000000..45d00f05a --- /dev/null +++ b/Actions/DeployALDoc/DeployALDoc.ps1 @@ -0,0 +1,53 @@ +Param( + [Parameter(HelpMessage = "The GitHub token running the action", Mandatory = $false)] + [string] $token +) + +. (Join-Path -Path $PSScriptRoot -ChildPath "..\AL-Go-Helper.ps1" -Resolve) +DownloadAndImportBcContainerHelper + +$projects = '*' +$maxReleases = 2 +$artifactsFolder = Join-Path $ENV:GITHUB_WORKSPACE ".artifacts" + +$apps = @() +$dependencies = @() +if (Test-Path $artifactsFolder -PathType Container) { + $projects.Split(',') | ForEach-Object { + $project = $_.Replace('\','_').Replace('/','_') + $refname = "$ENV:GITHUB_REF_NAME".Replace('/','_') + Write-Host "project '$project'" + $apps += @((Get-ChildItem -Path $artifactsFolder -Filter "$project-$refname-Apps-*.*.*.*") | ForEach-Object { $_.FullName }) + if (!($apps)) { + throw "There are no build artifacts present in .artifacts matching $project-$refname-Apps-." + } + $dependencies += @((Get-ChildItem -Path $artifactsFolder -Filter "$project-$refname-Dependencies-*.*.*.*") | ForEach-Object { $_.FullName }) + } +} +else { + throw "No build artifacts present in .artifacts." +} + +$releases = GetReleases -token $token -api_url $ENV:GITHUB_API_URL -repository $ENV:GITHUB_REPOSITORY | + Where-Object { -not ($_.prerelease -or $_.draft) } | + Select-Object -First $maxReleases + +# $artifactsFolderCreated = $true +# DownloadRelease -token $token -projects $deploymentSettings.Projects -api_url $ENV:GITHUB_API_URL -repository $ENV:GITHUB_REPOSITORY -release $release -path $artifactsFolder -mask "Apps" +# DownloadRelease -token $token -projects $deploymentSettings.Projects -api_url $ENV:GITHUB_API_URL -repository $ENV:GITHUB_REPOSITORY -release $release -path $artifactsFolder -mask "Dependencies" +# $apps = @((Get-ChildItem -Path $artifactsFolder) | ForEach-Object { $_.FullName }) +# if (!$apps) { +# throw "Artifact $artifacts was not found on any release. Make sure that the artifact files exist and files are not corrupted." +# } + +Write-Host "Apps to build documentation for" +$apps | Out-Host + +Write-Host "Dependencies" +$dependencies | Out-Host + +Write-Host "Releases" +$releases | Out-Host + + +throw "Not implemented" diff --git a/Actions/DeployALDoc/README.md b/Actions/DeployALDoc/README.md new file mode 100644 index 000000000..efd0bfd1c --- /dev/null +++ b/Actions/DeployALDoc/README.md @@ -0,0 +1,18 @@ +# Deploy +Deploy Apps to online environment + +## INPUT + +### ENV variables +| Name | Description | +| :-- | :-- | +| Settings | env.Settings must be set by a prior call to the ReadSettings Action | + +### Parameters +| Name | Required | Description | Default value | +| :-- | :-: | :-- | :-- | +| shell | | The shell (powershell or pwsh) in which the PowerShell script in this action should run | powershell | +| token | | The GitHub token running the action | github.token | + +## OUTPUT +none diff --git a/Actions/DeployALDoc/action.yaml b/Actions/DeployALDoc/action.yaml new file mode 100644 index 000000000..5b0061a16 --- /dev/null +++ b/Actions/DeployALDoc/action.yaml @@ -0,0 +1,35 @@ +name: PowerShell script +author: Freddy Kristiansen +inputs: + shell: + description: Shell in which you want to run the action (powershell or pwsh) + required: false + default: powershell + token: + description: The GitHub token running the action + required: false + default: ${{ github.token }} + projects: + description: The GitHub token running the action + required: false + default: ${{ github.token }} +runs: + using: composite + steps: + - name: run + shell: ${{ inputs.shell }} + id: DeployALDoc + env: + _token: ${{ inputs.token }} + run: | + $errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0 + try { + ${{ github.action_path }}/DeployALDoc.ps1 -token $ENV:_token + } + catch { + Write-Host "::ERROR::Unexpected error when running action. Error Message: $($_.Exception.Message.Replace("`r",'').Replace("`n",' ')), StackTrace: $($_.ScriptStackTrace.Replace("`r",'').Replace("`n",' <- '))"; + exit 1 + } +branding: + icon: terminal + color: blue diff --git a/Templates/Per Tenant Extension/.github/workflows/CICD.yaml b/Templates/Per Tenant Extension/.github/workflows/CICD.yaml index ac9d5d4ec..74862f2c7 100644 --- a/Templates/Per Tenant Extension/.github/workflows/CICD.yaml +++ b/Templates/Per Tenant Extension/.github/workflows/CICD.yaml @@ -161,6 +161,11 @@ jobs: - name: Checkout uses: actions/checkout@v3 + - name: Download artifacts + uses: actions/download-artifact@v3 + with: + path: '.artifacts' + - name: Setup Pages uses: actions/configure-pages@v3 From 8565233bb10c5114fdf08944fd85ed6dde2517cc Mon Sep 17 00:00:00 2001 From: freddydk Date: Wed, 4 Oct 2023 04:57:02 +0200 Subject: [PATCH 006/235] rename --- .../DeployALDoc.ps1 => BuildALDoc/BuildALDoc.ps1} | 0 Actions/{DeployALDoc => BuildALDoc}/README.md | 4 ++-- Actions/{DeployALDoc => BuildALDoc}/action.yaml | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) rename Actions/{DeployALDoc/DeployALDoc.ps1 => BuildALDoc/BuildALDoc.ps1} (100%) rename Actions/{DeployALDoc => BuildALDoc}/README.md (75%) rename Actions/{DeployALDoc => BuildALDoc}/action.yaml (91%) diff --git a/Actions/DeployALDoc/DeployALDoc.ps1 b/Actions/BuildALDoc/BuildALDoc.ps1 similarity index 100% rename from Actions/DeployALDoc/DeployALDoc.ps1 rename to Actions/BuildALDoc/BuildALDoc.ps1 diff --git a/Actions/DeployALDoc/README.md b/Actions/BuildALDoc/README.md similarity index 75% rename from Actions/DeployALDoc/README.md rename to Actions/BuildALDoc/README.md index efd0bfd1c..4321d7070 100644 --- a/Actions/DeployALDoc/README.md +++ b/Actions/BuildALDoc/README.md @@ -1,5 +1,5 @@ -# Deploy -Deploy Apps to online environment +# BuildALDoc +Build documentation using [ALDoc](https://go.microsoft.com/fwlink/?linkid=2247728) and [DocFx](https://dotnet.github.io/docfx) ## INPUT diff --git a/Actions/DeployALDoc/action.yaml b/Actions/BuildALDoc/action.yaml similarity index 91% rename from Actions/DeployALDoc/action.yaml rename to Actions/BuildALDoc/action.yaml index 5b0061a16..ff6e9fa73 100644 --- a/Actions/DeployALDoc/action.yaml +++ b/Actions/BuildALDoc/action.yaml @@ -18,13 +18,13 @@ runs: steps: - name: run shell: ${{ inputs.shell }} - id: DeployALDoc + id: BuildALDoc env: _token: ${{ inputs.token }} run: | $errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0 try { - ${{ github.action_path }}/DeployALDoc.ps1 -token $ENV:_token + ${{ github.action_path }}/BuildALDoc.ps1 -token $ENV:_token } catch { Write-Host "::ERROR::Unexpected error when running action. Error Message: $($_.Exception.Message.Replace("`r",'').Replace("`n",' ')), StackTrace: $($_.ScriptStackTrace.Replace("`r",'').Replace("`n",' <- '))"; From b6df0ec90fd4f49b3d6b7654950bf64bef6d1bb5 Mon Sep 17 00:00:00 2001 From: freddydk Date: Wed, 4 Oct 2023 05:00:36 +0200 Subject: [PATCH 007/235] read settings --- Templates/Per Tenant Extension/.github/workflows/CICD.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Templates/Per Tenant Extension/.github/workflows/CICD.yaml b/Templates/Per Tenant Extension/.github/workflows/CICD.yaml index 74862f2c7..56fe477e2 100644 --- a/Templates/Per Tenant Extension/.github/workflows/CICD.yaml +++ b/Templates/Per Tenant Extension/.github/workflows/CICD.yaml @@ -166,6 +166,11 @@ jobs: with: path: '.artifacts' + - name: Read settings + uses: microsoft/AL-Go-Actions/ReadSettings@main + with: + shell: powershell + - name: Setup Pages uses: actions/configure-pages@v3 From 4ce89c29c7e0846822b1b7a112953690a7f29260 Mon Sep 17 00:00:00 2001 From: freddydk Date: Wed, 4 Oct 2023 05:58:03 +0200 Subject: [PATCH 008/235] dump name --- Actions/BuildALDoc/BuildALDoc.ps1 | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/Actions/BuildALDoc/BuildALDoc.ps1 b/Actions/BuildALDoc/BuildALDoc.ps1 index 45d00f05a..e25ae1151 100644 --- a/Actions/BuildALDoc/BuildALDoc.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.ps1 @@ -10,6 +10,7 @@ $projects = '*' $maxReleases = 2 $artifactsFolder = Join-Path $ENV:GITHUB_WORKSPACE ".artifacts" +# locate all artifacts folders in .artifacts $apps = @() $dependencies = @() if (Test-Path $artifactsFolder -PathType Container) { @@ -28,17 +29,25 @@ else { throw "No build artifacts present in .artifacts." } +# locate all apps in the artifacts folders +$allApps = @{} +foreach($folder in $apps) { + $projectName = [System.IO.Path]::GetFileName($folder).Split("-$refname-Apps-")[0] + $allApps."$projectName" = @(Get-ChildItem -Path (Join-Path $folder '*.app') | Select-Object -ExpandProperty FullName) +} + $releases = GetReleases -token $token -api_url $ENV:GITHUB_API_URL -repository $ENV:GITHUB_REPOSITORY | Where-Object { -not ($_.prerelease -or $_.draft) } | Select-Object -First $maxReleases -# $artifactsFolderCreated = $true -# DownloadRelease -token $token -projects $deploymentSettings.Projects -api_url $ENV:GITHUB_API_URL -repository $ENV:GITHUB_REPOSITORY -release $release -path $artifactsFolder -mask "Apps" -# DownloadRelease -token $token -projects $deploymentSettings.Projects -api_url $ENV:GITHUB_API_URL -repository $ENV:GITHUB_REPOSITORY -release $release -path $artifactsFolder -mask "Dependencies" -# $apps = @((Get-ChildItem -Path $artifactsFolder) | ForEach-Object { $_.FullName }) -# if (!$apps) { -# throw "Artifact $artifacts was not found on any release. Make sure that the artifact files exist and files are not corrupted." -# } +foreach($release in $releases) { + Write-Hosty $release.Name + $tempFolder = Join-Path ([System.IO.Path]::GetTempPath()) ([Guid]::NewGuid().ToString()) + New-Item -Path $tempFolder -ItemType Directory | Out-Null + DownloadRelease -token $token -projects -api_url $ENV:GITHUB_API_URL -repository $ENV:GITHUB_REPOSITORY -release $release -path $tempFolder -mask "Apps" + DownloadRelease -token $token -projects $projects -api_url $ENV:GITHUB_API_URL -repository $ENV:GITHUB_REPOSITORY -release $release -path $tempFolder -mask "Dependencies" + Get-ChildItem -Path $tempFolder | ForEach-Object { $_.FullName } | Out-Host +} Write-Host "Apps to build documentation for" $apps | Out-Host From f76aff53697f6fb6b5eb9a1a7bc0192f12e295ba Mon Sep 17 00:00:00 2001 From: freddydk Date: Wed, 4 Oct 2023 06:00:48 +0200 Subject: [PATCH 009/235] spell --- Actions/BuildALDoc/BuildALDoc.ps1 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Actions/BuildALDoc/BuildALDoc.ps1 b/Actions/BuildALDoc/BuildALDoc.ps1 index e25ae1151..49cf2fd66 100644 --- a/Actions/BuildALDoc/BuildALDoc.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.ps1 @@ -41,7 +41,7 @@ $releases = GetReleases -token $token -api_url $ENV:GITHUB_API_URL -repository $ Select-Object -First $maxReleases foreach($release in $releases) { - Write-Hosty $release.Name + Write-Host $release.Name $tempFolder = Join-Path ([System.IO.Path]::GetTempPath()) ([Guid]::NewGuid().ToString()) New-Item -Path $tempFolder -ItemType Directory | Out-Null DownloadRelease -token $token -projects -api_url $ENV:GITHUB_API_URL -repository $ENV:GITHUB_REPOSITORY -release $release -path $tempFolder -mask "Apps" @@ -49,6 +49,8 @@ foreach($release in $releases) { Get-ChildItem -Path $tempFolder | ForEach-Object { $_.FullName } | Out-Host } +$allApps | Out-Host + Write-Host "Apps to build documentation for" $apps | Out-Host From 89a95ebce8332a0443d06f7499e83bdc0874cfb6 Mon Sep 17 00:00:00 2001 From: freddydk Date: Wed, 4 Oct 2023 06:08:01 +0200 Subject: [PATCH 010/235] projects --- Actions/BuildALDoc/BuildALDoc.ps1 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Actions/BuildALDoc/BuildALDoc.ps1 b/Actions/BuildALDoc/BuildALDoc.ps1 index 49cf2fd66..e099fc0f8 100644 --- a/Actions/BuildALDoc/BuildALDoc.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.ps1 @@ -44,8 +44,9 @@ foreach($release in $releases) { Write-Host $release.Name $tempFolder = Join-Path ([System.IO.Path]::GetTempPath()) ([Guid]::NewGuid().ToString()) New-Item -Path $tempFolder -ItemType Directory | Out-Null - DownloadRelease -token $token -projects -api_url $ENV:GITHUB_API_URL -repository $ENV:GITHUB_REPOSITORY -release $release -path $tempFolder -mask "Apps" - DownloadRelease -token $token -projects $projects -api_url $ENV:GITHUB_API_URL -repository $ENV:GITHUB_REPOSITORY -release $release -path $tempFolder -mask "Dependencies" + foreach($mask in 'Apps', 'Dependencies') { + DownloadRelease -token $token -projects $projects -api_url $ENV:GITHUB_API_URL -repository $ENV:GITHUB_REPOSITORY -release $release -path $tempFolder -mask $mask + } Get-ChildItem -Path $tempFolder | ForEach-Object { $_.FullName } | Out-Host } From c8cb219bba8b154f1c71368fa4924dfe5b15c2fa Mon Sep 17 00:00:00 2001 From: freddydk Date: Wed, 4 Oct 2023 06:13:17 +0200 Subject: [PATCH 011/235] dump assets --- Actions/Github-Helper.psm1 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Actions/Github-Helper.psm1 b/Actions/Github-Helper.psm1 index 66021e6d2..875b24f27 100644 --- a/Actions/Github-Helper.psm1 +++ b/Actions/Github-Helper.psm1 @@ -617,6 +617,10 @@ function DownloadRelease { $assetPattern1 = "$project-*-$mask-*.zip" $assetPattern2 = "$project-$mask-*.zip" Write-Host "AssetPatterns: '$assetPattern1' | '$assetPattern2'" + Write-Host "Assets:" + $release.assets | ForEach-Object { + Write-Host "- $($_.name)" + } $assets = @($release.assets | Where-Object { $_.name -like $assetPattern1 -or $_.name -like $assetPattern2 }) foreach($asset in $assets) { $uri = "$api_url/repos/$repository/releases/assets/$($asset.id)" From 1ea46f79b7aede76a3f47a557e10af797b64f9ac Mon Sep 17 00:00:00 2001 From: freddydk Date: Wed, 4 Oct 2023 06:15:56 +0200 Subject: [PATCH 012/235] don't return --- Actions/Github-Helper.psm1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Actions/Github-Helper.psm1 b/Actions/Github-Helper.psm1 index 875b24f27..6787a996e 100644 --- a/Actions/Github-Helper.psm1 +++ b/Actions/Github-Helper.psm1 @@ -627,7 +627,7 @@ function DownloadRelease { Write-Host $uri $filename = Join-Path $path $asset.name InvokeWebRequest -Headers $headers -Uri $uri -OutFile $filename - return $filename + $filename } } } From 2dd320c9e894d2b393dae2377460a8d09f01a33a Mon Sep 17 00:00:00 2001 From: freddydk Date: Wed, 4 Oct 2023 07:00:40 +0200 Subject: [PATCH 013/235] unpack --- Actions/BuildALDoc/BuildALDoc.ps1 | 4 ++-- Actions/Github-Helper.psm1 | 11 +++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/Actions/BuildALDoc/BuildALDoc.ps1 b/Actions/BuildALDoc/BuildALDoc.ps1 index e099fc0f8..1f01f7744 100644 --- a/Actions/BuildALDoc/BuildALDoc.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.ps1 @@ -45,9 +45,9 @@ foreach($release in $releases) { $tempFolder = Join-Path ([System.IO.Path]::GetTempPath()) ([Guid]::NewGuid().ToString()) New-Item -Path $tempFolder -ItemType Directory | Out-Null foreach($mask in 'Apps', 'Dependencies') { - DownloadRelease -token $token -projects $projects -api_url $ENV:GITHUB_API_URL -repository $ENV:GITHUB_REPOSITORY -release $release -path $tempFolder -mask $mask + DownloadRelease -token $token -projects $projects -api_url $ENV:GITHUB_API_URL -repository $ENV:GITHUB_REPOSITORY -release $release -path $tempFolder -mask $mask -unpack } - Get-ChildItem -Path $tempFolder | ForEach-Object { $_.FullName } | Out-Host + Get-ChildItem -Path $tempFolder -Recurse | ForEach-Object { $_.FullName } | Out-Host } $allApps | Out-Host diff --git a/Actions/Github-Helper.psm1 b/Actions/Github-Helper.psm1 index 6787a996e..b51273487 100644 --- a/Actions/Github-Helper.psm1 +++ b/Actions/Github-Helper.psm1 @@ -602,7 +602,9 @@ function DownloadRelease { [string] $repository = $ENV:GITHUB_REPOSITORY, [string] $path, [string] $mask = "Apps", + [switch] $unpack, $release + ) if ($projects -eq "") { $projects = "*" } @@ -627,6 +629,15 @@ function DownloadRelease { Write-Host $uri $filename = Join-Path $path $asset.name InvokeWebRequest -Headers $headers -Uri $uri -OutFile $filename + if ($unpack) { + $unzipPath = Join-Path $path $asset.name.Replace('.zip','') + if (Test-Path $unzipPath) { + Remove-Item $unzipPath -Recurse -Force + } + Expand-Archive -Path $filename -DestinationPath $unzipPath + Remove-Item $filename -Force + $filename = $unzipPath + } $filename } } From 6f01da949e66aee397970344f1a1439d0dcdca24 Mon Sep 17 00:00:00 2001 From: freddydk Date: Wed, 4 Oct 2023 07:06:32 +0200 Subject: [PATCH 014/235] dump --- Actions/BuildALDoc/BuildALDoc.ps1 | 4 +++- Actions/Github-Helper.psm1 | 4 ---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/Actions/BuildALDoc/BuildALDoc.ps1 b/Actions/BuildALDoc/BuildALDoc.ps1 index 1f01f7744..c5e13f7de 100644 --- a/Actions/BuildALDoc/BuildALDoc.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.ps1 @@ -11,6 +11,8 @@ $maxReleases = 2 $artifactsFolder = Join-Path $ENV:GITHUB_WORKSPACE ".artifacts" # locate all artifacts folders in .artifacts +Write-Host "CURRENT:" +Get-ChildItem -Path $artifactsFolder -Recurse -File | ForEach-Object { Write-Host "- $($_.FullName)" } $apps = @() $dependencies = @() if (Test-Path $artifactsFolder -PathType Container) { @@ -47,7 +49,7 @@ foreach($release in $releases) { foreach($mask in 'Apps', 'Dependencies') { DownloadRelease -token $token -projects $projects -api_url $ENV:GITHUB_API_URL -repository $ENV:GITHUB_REPOSITORY -release $release -path $tempFolder -mask $mask -unpack } - Get-ChildItem -Path $tempFolder -Recurse | ForEach-Object { $_.FullName } | Out-Host + Get-ChildItem -Path $tempFolder -Recurse -File | ForEach-Object { Write-Host "- $($_.FullName)" } } $allApps | Out-Host diff --git a/Actions/Github-Helper.psm1 b/Actions/Github-Helper.psm1 index b51273487..03ca7a48e 100644 --- a/Actions/Github-Helper.psm1 +++ b/Actions/Github-Helper.psm1 @@ -619,10 +619,6 @@ function DownloadRelease { $assetPattern1 = "$project-*-$mask-*.zip" $assetPattern2 = "$project-$mask-*.zip" Write-Host "AssetPatterns: '$assetPattern1' | '$assetPattern2'" - Write-Host "Assets:" - $release.assets | ForEach-Object { - Write-Host "- $($_.name)" - } $assets = @($release.assets | Where-Object { $_.name -like $assetPattern1 -or $_.name -like $assetPattern2 }) foreach($asset in $assets) { $uri = "$api_url/repos/$repository/releases/assets/$($asset.id)" From cf46a9b01843b58031b478256c20217be3ff0178 Mon Sep 17 00:00:00 2001 From: freddydk Date: Wed, 4 Oct 2023 07:10:17 +0200 Subject: [PATCH 015/235] dump --- Actions/BuildALDoc/BuildALDoc.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Actions/BuildALDoc/BuildALDoc.ps1 b/Actions/BuildALDoc/BuildALDoc.ps1 index c5e13f7de..897d03169 100644 --- a/Actions/BuildALDoc/BuildALDoc.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.ps1 @@ -43,12 +43,12 @@ $releases = GetReleases -token $token -api_url $ENV:GITHUB_API_URL -repository $ Select-Object -First $maxReleases foreach($release in $releases) { - Write-Host $release.Name $tempFolder = Join-Path ([System.IO.Path]::GetTempPath()) ([Guid]::NewGuid().ToString()) New-Item -Path $tempFolder -ItemType Directory | Out-Null foreach($mask in 'Apps', 'Dependencies') { DownloadRelease -token $token -projects $projects -api_url $ENV:GITHUB_API_URL -repository $ENV:GITHUB_REPOSITORY -release $release -path $tempFolder -mask $mask -unpack } + Write-Host $release.Name Get-ChildItem -Path $tempFolder -Recurse -File | ForEach-Object { Write-Host "- $($_.FullName)" } } From 249f79acf40ce324c0967d1e80eacf74f8a8cb8b Mon Sep 17 00:00:00 2001 From: freddydk Date: Wed, 4 Oct 2023 12:31:44 +0200 Subject: [PATCH 016/235] add build --- .../BuildALDoc/BuildALDoc.HelperFunctions.ps1 | 132 ++++++++++++++++ Actions/BuildALDoc/BuildALDoc.ps1 | 147 +++++++++++++----- 2 files changed, 240 insertions(+), 39 deletions(-) create mode 100644 Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 diff --git a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 new file mode 100644 index 000000000..7451c2a3b --- /dev/null +++ b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 @@ -0,0 +1,132 @@ +function DownloadAlDoc { + $artifactUrl = Get-BCArtifactUrl -storageAccount bcinsider -type sandbox -country core -select Latest -accept_insiderEula + $folder = Download-Artifacts $artifactUrl + $alLanguageVsix = Join-Path $folder '*.vsix' -Resolve + $tempFolder = Join-Path ([System.IO.Path]::GetTempPath()) ([Guid]::NewGuid().ToString()) + New-Item -Path $tempFolder -ItemType Directory | Out-Null + Expand-Archive -Path $alLanguageVsix -DestinationPath $tempFolder -Force + $isPsCore = $PSVersionTable.PSVersion -ge "6.0.0" + if ($isPsCore -and $isLinux) { + $script:aldocPath = Join-Path $tempFolder 'extension/bin/Linux/aldoc' + } + else { + $script:aldocPath = Join-Path $tempFolder 'extension/bin/win32/aldoc.exe' + } +} + +function SanitizeFileName([string] $filename) { + $filename.Replace('_','-').Replace('?','_').Replace('*','_').Replace(' ','-').Replace('\','-').Replace('/','-').Replace(':','-').Replace('<','-').Replace('>','-').Replace('|','-').Replace('%','pct') +} + +function GetAppNameAndFolder { + Param( + [string] $appFile + ) + + $tmpFolder = Join-Path ([System.IO.Path]::GetTempPath()) ([Guid]::NewGuid().ToString()) + Extract-AppFileToFolder -appFilename $appFile -appFolder $tmpFolder -generateAppJson + $appJson = Get-Content -Path (Join-Path $tmpFolder 'app.json') -Encoding utf8 | ConvertFrom-Json + $appJson.name + (SanitizeFileName -filename $appJson.name).ToLower() + Remove-Item -Path $tmpFolder -Recurse -Force +} + +function GenerateDocsSite { + Param( + [string] $version, + [string[]] $allVersions, + [hashtable] $allApps, + [string] $releaseNotes, + [string] $header = "Documentation", + [string] $footer = "Made with AL-Go for GitHub, ALDoc and DocFx", + [string] $docsPath, + [string] $logLevel, + [switch] $hostIt + ) + + $docfxPath = Join-Path ([System.IO.Path]::GetTempPath()) ([Guid]::NewGuid().ToString()) + New-Item -path $docfxPath -ItemType Directory | Out-Null + try { + $apps = @() + # Generate new toc.yml and calculate apps - releases and projects + $newTocYml = @('items:',' - name: Releases',' items:',' - name: main',' href: /') + foreach($ver in $allVersions) { + $newTocYml += @(" - name: $ver"," href: /releases/$ver") + } + if ($allApps.Keys.Count -eq 1 -and $allApps.Keys[0] -eq '.') { + # Single prokect repo + foreach($appFile in $allApps.".") { + $apps += @($appFile) + $appName, $appFolder = GetAppNameAndFolder -appFile $appFile + $newTocYml += @(" - name: $appName"," href: reference/$appFolder/toc.yml") + } + } + else { + # Multi project repo add all apps + foreach($project in $allApps.Keys) { + $newTocYml += @(" - name: $project",' items:') + foreach($appFile in $allApps."$project") { + $apps += @($appFile) + $appName, $appFolder = GetAppNameAndFolder -appFile $appFile + $newTocYml += @(" - name: $appName"," href: reference/$appFolder/toc.yml") + } + } + } + + CmdDo -command $script:aldocPath -arguments @("init","--output ""$docfxpath""","--loglevel $loglevel","--targetpackages ""$($apps -join '","')""") + + # Update docfx.json + $docfxJsonFile = Join-Path $docfxPath 'docfx.json' + $docfxJson = Get-Content -Encoding utf8 -Path $docfxJsonFile | ConvertFrom-Json + $docfxJson.build.globalMetadata._appName = $header + $docfxJson.build.globalMetadata._appFooter = $footer + $docfxJson | ConvertTo-Json -Depth 99 | Set-Content -Path $docfxJsonFile -Encoding utf8 + + # Create new toc.yml + $tocYmlFile = Join-Path $docfxpath 'toc.yml' + Set-Content -Path $tocYmlFile -Value ($newTocYml -join "`n") -Encoding utf8 + + $apps | ForEach-Object { + CmdDo -command $script:aldocPath -arguments @("build","--output ""$docfxpath""","--loglevel $loglevel","--source ""$_""") + } + + # Set release notes + Set-Content -path (Join-Path $docfxpath 'index.md') -value $releaseNotes -encoding utf8 + + $arguments = @("build", "--output ""$docsPath""", "--logLevel $loglevel", $docfxJsonFile) + if ($hostIt) { + $arguments += @('-s') + Write-Host "Generate and host site" + } + CmdDo -command docfx -arguments $arguments + } + finally { + Remove-Item -Path $docfxPath -Recurse -Force + } +} + +function CalculateProjectsAndApps { + Param( + [string] $tempFolder, + [string] $projects, + [string] $refname + ) + + if ($projects -eq "") { $projects = "*" } + $projectList = @($projects.Split(',') | ForEach-Object { $_.Replace('\','_').Replace('/','_') }) + foreach($mask in 'Apps','Dependencies') { + $allApps = @{} + Get-ChildItem -Path $tempFolder -Directory | ForEach-Object { + if ($_.Name -match "^(.*)-main-$mask-(\d*\.\d*\.\d*\.\d*)$") { + $project = $Matches[1] + if ($projectList -contains $project) { + $allApps.Add($project, @()) + Get-ChildItem -Path $_.FullName -Filter '*.app' -Recurse | ForEach-Object { + $allApps[$project] += @($_.FullName) + } + } + } + } + $allApps + } +} \ No newline at end of file diff --git a/Actions/BuildALDoc/BuildALDoc.ps1 b/Actions/BuildALDoc/BuildALDoc.ps1 index 897d03169..be2f00170 100644 --- a/Actions/BuildALDoc/BuildALDoc.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.ps1 @@ -4,64 +4,133 @@ ) . (Join-Path -Path $PSScriptRoot -ChildPath "..\AL-Go-Helper.ps1" -Resolve) +. (Join-Path -Path $PSScriptRoot -ChildPath "BuildALDoc.HelperFunctions.ps1" -Resolve) DownloadAndImportBcContainerHelper +$alDocPath = DownloadAlDoc + $projects = '*' $maxReleases = 2 $artifactsFolder = Join-Path $ENV:GITHUB_WORKSPACE ".artifacts" -# locate all artifacts folders in .artifacts -Write-Host "CURRENT:" -Get-ChildItem -Path $artifactsFolder -Recurse -File | ForEach-Object { Write-Host "- $($_.FullName)" } -$apps = @() -$dependencies = @() -if (Test-Path $artifactsFolder -PathType Container) { - $projects.Split(',') | ForEach-Object { - $project = $_.Replace('\','_').Replace('/','_') - $refname = "$ENV:GITHUB_REF_NAME".Replace('/','_') - Write-Host "project '$project'" - $apps += @((Get-ChildItem -Path $artifactsFolder -Filter "$project-$refname-Apps-*.*.*.*") | ForEach-Object { $_.FullName }) - if (!($apps)) { - throw "There are no build artifacts present in .artifacts matching $project-$refname-Apps-." - } - $dependencies += @((Get-ChildItem -Path $artifactsFolder -Filter "$project-$refname-Dependencies-*.*.*.*") | ForEach-Object { $_.FullName }) - } -} -else { - throw "No build artifacts present in .artifacts." +$releases = @() +if ($maxReleases -gt 0) { + $releases = GetReleases -token $token -api_url $ENV:GITHUB_API_URL -repository $ENV:GITHUB_REPOSITORY | Where-Object { -not ($_.prerelease -or $_.draft) } | Select-Object -First $maxReleases } -# locate all apps in the artifacts folders -$allApps = @{} -foreach($folder in $apps) { - $projectName = [System.IO.Path]::GetFileName($folder).Split("-$refname-Apps-")[0] - $allApps."$projectName" = @(Get-ChildItem -Path (Join-Path $folder '*.app') | Select-Object -ExpandProperty FullName) -} +#$docsPath = Join-Path $ENV:GITHUB_WORKSPACE ".aldoc" +#New-Item $docsPath -ItemType Directory | Out-Null -$releases = GetReleases -token $token -api_url $ENV:GITHUB_API_URL -repository $ENV:GITHUB_REPOSITORY | - Where-Object { -not ($_.prerelease -or $_.draft) } | - Select-Object -First $maxReleases +$docsPath = $ENV:GITHUB_WORKSPACE +$loglevel = 'Verbose' foreach($release in $releases) { $tempFolder = Join-Path ([System.IO.Path]::GetTempPath()) ([Guid]::NewGuid().ToString()) New-Item -Path $tempFolder -ItemType Directory | Out-Null - foreach($mask in 'Apps', 'Dependencies') { - DownloadRelease -token $token -projects $projects -api_url $ENV:GITHUB_API_URL -repository $ENV:GITHUB_REPOSITORY -release $release -path $tempFolder -mask $mask -unpack + try { + foreach($mask in 'Apps', 'Dependencies') { + DownloadRelease -token $token -projects $projects -api_url $ENV:GITHUB_API_URL -repository $ENV:GITHUB_REPOSITORY -release $release -path $tempFolder -mask $mask -unpack + } + Write-Host "$($release.Name):" + Get-ChildItem -Path $tempFolder -Recurse -File | ForEach-Object { Write-Host "- $($_.FullName.Substring($tempFolder.Length))" } + $allApps,$allDependencies = CalculateProjectsAndApps -tempFolder $tempFolder -projects $projects -refname $ENV:GITHUB_REF_NAME + Write-Host "-------------------------" + $allApps | Out-Host + Write-Host "-------------------------" + $allDependencies | Out-Host + Write-Host "-------------------------" + } + finally { + Remove-Item -Path $tempFolder -Recurse -Force } - Write-Host $release.Name - Get-ChildItem -Path $tempFolder -Recurse -File | ForEach-Object { Write-Host "- $($_.FullName)" } + $version = $release.Name + $header = "Documentation for $ENV:GITHUB_REPOSITORY $version" + $releaseNotes = $release.body + GenerateDocsSite -version $version -allVersions $versions -allApps $allApps -releaseNotes $releaseNotes -header $header -docsPath $docsPath -logLevel $logLevel + do { + try { + $retry = $false + Start-Sleep -Seconds 2 + Rename-Item -Path (join-Path $docsPath "_site") -NewName $version + } + catch { + $retry = $true + } + } while ($retry) } -$allApps | Out-Host +$releasesPath = Join-Path $docsPath "_site/releases" +New-Item -Path $releasesPath -ItemType Directory | Out-Null +foreach($version in $versions) { + Move-Item -Path (join-Path $docsPath $version) -Destination $releasesPath +} -Write-Host "Apps to build documentation for" -$apps | Out-Host +Write-Host "main:" +Get-ChildItem -Path $artifactsFolder -Recurse -File | ForEach-Object { Write-Host "- $($_.FullName.Substring($artifactsFolder.Length))" } +$allApps,$allDependencies = CalculateProjectsAndApps -tempFolder $artifactsFolder -projects $projects -refname $ENV:GITHUB_REF_NAME -Write-Host "Dependencies" -$dependencies | Out-Host +Write-Host "-------------------------" +$allApps | Out-Host +Write-Host "-------------------------" +$allDependencies | Out-Host +Write-Host "-------------------------" + +$version = 'main' +$header = "Documentation for $ENV:GITHUB_REPOSITORY" +$releaseNotes = "Documentation for current branch" +GenerateDocsSite -version $version -allVersions $versions -allApps $allApps -releaseNotes $releaseNotes -header $header -docsPath $docsPath -logLevel $logLevel -Write-Host "Releases" -$releases | Out-Host +## locate all artifacts folders in .artifacts +#Write-Host "CURRENT:" +#Get-ChildItem -Path $artifactsFolder -Recurse -File | ForEach-Object { Write-Host "- $($_.FullName)" } +#$apps = @() +#$dependencies = @() +#if (Test-Path $artifactsFolder -PathType Container) { +# $projects.Split(',') | ForEach-Object { +# $project = $_.Replace('\','_').Replace('/','_') +# $refname = "$ENV:GITHUB_REF_NAME".Replace('/','_') +# Write-Host "project '$project'" +# $apps += @((Get-ChildItem -Path $artifactsFolder -Filter "$project-$refname-Apps-*.*.*.*") | ForEach-Object { $_.FullName }) +# if (!($apps)) { +# throw "There are no build artifacts present in .artifacts matching $project-$refname-Apps-." +# } +# $dependencies += @((Get-ChildItem -Path $artifactsFolder -Filter "$project-$refname-Dependencies-*.*.*.*") | ForEach-Object { $_.FullName }) +# } +#} +#else { +# throw "No build artifacts present in .artifacts." +#} +# locate all apps in the artifacts folders +#$allApps = @{} +#foreach($folder in $apps) { +# $projectName = [System.IO.Path]::GetFileName($folder).Split("-$refname-Apps-")[0] +# $allApps."$projectName" = @(Get-ChildItem -Path (Join-Path $folder '*.app') | Select-Object -ExpandProperty FullName) +#} +# +#$releases = GetReleases -token $token -api_url $ENV:GITHUB_API_URL -repository $ENV:GITHUB_REPOSITORY | +# Where-Object { -not ($_.prerelease -or $_.draft) } | +# Select-Object -First $maxReleases +# +#foreach($release in $releases) { +# $tempFolder = Join-Path ([System.IO.Path]::GetTempPath()) ([Guid]::NewGuid().ToString()) +# New-Item -Path $tempFolder -ItemType Directory | Out-Null +# foreach($mask in 'Apps', 'Dependencies') { +# DownloadRelease -token $token -projects $projects -api_url $ENV:GITHUB_API_URL -repository $ENV:GITHUB_REPOSITORY -release $release -path $tempFolder -mask $mask -unpack +# } +# Write-Host $release.Name +# Get-ChildItem -Path $tempFolder -Recurse -File | ForEach-Object { Write-Host "- $($_.FullName)" } +#} +# +#$allApps | Out-Host +# +#Write-Host "Apps to build documentation for" +#$apps | Out-Host +# +#Write-Host "Dependencies" +#$dependencies | Out-Host +# +#Write-Host "Releases" +#$releases | Out-Host throw "Not implemented" From bffb17b25be97f469797ea2dafd5fd071f51ca93 Mon Sep 17 00:00:00 2001 From: freddydk Date: Wed, 4 Oct 2023 12:34:00 +0200 Subject: [PATCH 017/235] versions --- Actions/BuildALDoc/BuildALDoc.ps1 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Actions/BuildALDoc/BuildALDoc.ps1 b/Actions/BuildALDoc/BuildALDoc.ps1 index be2f00170..cda46f512 100644 --- a/Actions/BuildALDoc/BuildALDoc.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.ps1 @@ -24,6 +24,8 @@ if ($maxReleases -gt 0) { $docsPath = $ENV:GITHUB_WORKSPACE $loglevel = 'Verbose' +$versions = @($releases.Name) + foreach($release in $releases) { $tempFolder = Join-Path ([System.IO.Path]::GetTempPath()) ([Guid]::NewGuid().ToString()) New-Item -Path $tempFolder -ItemType Directory | Out-Null From 8706e891dadc1f85e977bf837ac2260b756f6a47 Mon Sep 17 00:00:00 2001 From: freddydk Date: Wed, 4 Oct 2023 12:37:38 +0200 Subject: [PATCH 018/235] dump --- Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 index 7451c2a3b..44ed4cee2 100644 --- a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 @@ -117,8 +117,10 @@ function CalculateProjectsAndApps { foreach($mask in 'Apps','Dependencies') { $allApps = @{} Get-ChildItem -Path $tempFolder -Directory | ForEach-Object { + Write-Host $_.Name if ($_.Name -match "^(.*)-main-$mask-(\d*\.\d*\.\d*\.\d*)$") { $project = $Matches[1] + Write-Host $project if ($projectList -contains $project) { $allApps.Add($project, @()) Get-ChildItem -Path $_.FullName -Filter '*.app' -Recurse | ForEach-Object { @@ -127,6 +129,7 @@ function CalculateProjectsAndApps { } } } + $allApps | Out-Host $allApps } } \ No newline at end of file From c08db7606c27cbb34308792644c1433431f9ddc4 Mon Sep 17 00:00:00 2001 From: freddydk Date: Wed, 4 Oct 2023 12:41:24 +0200 Subject: [PATCH 019/235] ht --- Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 index 44ed4cee2..58652879e 100644 --- a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 @@ -122,9 +122,9 @@ function CalculateProjectsAndApps { $project = $Matches[1] Write-Host $project if ($projectList -contains $project) { - $allApps.Add($project, @()) + $allApps."$project" = @() Get-ChildItem -Path $_.FullName -Filter '*.app' -Recurse | ForEach-Object { - $allApps[$project] += @($_.FullName) + $allApps."$project" += @($_.FullName) } } } From 872052c94be89cbf4541b26721d23e2f8b70e06e Mon Sep 17 00:00:00 2001 From: freddydk Date: Wed, 4 Oct 2023 12:45:38 +0200 Subject: [PATCH 020/235] wild --- Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 index 58652879e..4a6595ac1 100644 --- a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 @@ -121,7 +121,7 @@ function CalculateProjectsAndApps { if ($_.Name -match "^(.*)-main-$mask-(\d*\.\d*\.\d*\.\d*)$") { $project = $Matches[1] Write-Host $project - if ($projectList -contains $project) { + if ($projectList | Where-Object { $_ -like $project }) { $allApps."$project" = @() Get-ChildItem -Path $_.FullName -Filter '*.app' -Recurse | ForEach-Object { $allApps."$project" += @($_.FullName) From a03cfce5f030f63ee4597f31037ef0e49af5fd3a Mon Sep 17 00:00:00 2001 From: freddydk Date: Wed, 4 Oct 2023 12:59:28 +0200 Subject: [PATCH 021/235] fix --- Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 index 4a6595ac1..71acec880 100644 --- a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 @@ -120,8 +120,7 @@ function CalculateProjectsAndApps { Write-Host $_.Name if ($_.Name -match "^(.*)-main-$mask-(\d*\.\d*\.\d*\.\d*)$") { $project = $Matches[1] - Write-Host $project - if ($projectList | Where-Object { $_ -like $project }) { + if ($projectList | Where-Object { $project -like $_ }) { $allApps."$project" = @() Get-ChildItem -Path $_.FullName -Filter '*.app' -Recurse | ForEach-Object { $allApps."$project" += @($_.FullName) From a36b89541a940266d0fe1fced0d5f39cb234524f Mon Sep 17 00:00:00 2001 From: freddydk Date: Wed, 4 Oct 2023 13:03:01 +0200 Subject: [PATCH 022/235] delete --- Actions/BuildALDoc/BuildALDoc.ps1 | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/Actions/BuildALDoc/BuildALDoc.ps1 b/Actions/BuildALDoc/BuildALDoc.ps1 index cda46f512..5c9bd2544 100644 --- a/Actions/BuildALDoc/BuildALDoc.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.ps1 @@ -41,24 +41,24 @@ foreach($release in $releases) { Write-Host "-------------------------" $allDependencies | Out-Host Write-Host "-------------------------" + $version = $release.Name + $header = "Documentation for $ENV:GITHUB_REPOSITORY $version" + $releaseNotes = $release.body + GenerateDocsSite -version $version -allVersions $versions -allApps $allApps -releaseNotes $releaseNotes -header $header -docsPath $docsPath -logLevel $logLevel + do { + try { + $retry = $false + Start-Sleep -Seconds 2 + Rename-Item -Path (join-Path $docsPath "_site") -NewName $version + } + catch { + $retry = $true + } + } while ($retry) } finally { Remove-Item -Path $tempFolder -Recurse -Force } - $version = $release.Name - $header = "Documentation for $ENV:GITHUB_REPOSITORY $version" - $releaseNotes = $release.body - GenerateDocsSite -version $version -allVersions $versions -allApps $allApps -releaseNotes $releaseNotes -header $header -docsPath $docsPath -logLevel $logLevel - do { - try { - $retry = $false - Start-Sleep -Seconds 2 - Rename-Item -Path (join-Path $docsPath "_site") -NewName $version - } - catch { - $retry = $true - } - } while ($retry) } $releasesPath = Join-Path $docsPath "_site/releases" From edd6fd88c5d77ca6ff16aaf64c48569d72485394 Mon Sep 17 00:00:00 2001 From: freddydk Date: Wed, 4 Oct 2023 13:06:26 +0200 Subject: [PATCH 023/235] global --- Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 | 8 ++++---- Actions/BuildALDoc/BuildALDoc.ps1 | 3 +-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 index 71acec880..d54778bce 100644 --- a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 @@ -7,10 +7,10 @@ Expand-Archive -Path $alLanguageVsix -DestinationPath $tempFolder -Force $isPsCore = $PSVersionTable.PSVersion -ge "6.0.0" if ($isPsCore -and $isLinux) { - $script:aldocPath = Join-Path $tempFolder 'extension/bin/Linux/aldoc' + $global:aldocPath = Join-Path $tempFolder 'extension/bin/Linux/aldoc' } else { - $script:aldocPath = Join-Path $tempFolder 'extension/bin/win32/aldoc.exe' + $global:aldocPath = Join-Path $tempFolder 'extension/bin/win32/aldoc.exe' } } @@ -73,7 +73,7 @@ function GenerateDocsSite { } } - CmdDo -command $script:aldocPath -arguments @("init","--output ""$docfxpath""","--loglevel $loglevel","--targetpackages ""$($apps -join '","')""") + CmdDo -command $global:aldocPath -arguments @("init","--output ""$docfxpath""","--loglevel $loglevel","--targetpackages ""$($apps -join '","')""") # Update docfx.json $docfxJsonFile = Join-Path $docfxPath 'docfx.json' @@ -87,7 +87,7 @@ function GenerateDocsSite { Set-Content -Path $tocYmlFile -Value ($newTocYml -join "`n") -Encoding utf8 $apps | ForEach-Object { - CmdDo -command $script:aldocPath -arguments @("build","--output ""$docfxpath""","--loglevel $loglevel","--source ""$_""") + CmdDo -command $global:aldocPath -arguments @("build","--output ""$docfxpath""","--loglevel $loglevel","--source ""$_""") } # Set release notes diff --git a/Actions/BuildALDoc/BuildALDoc.ps1 b/Actions/BuildALDoc/BuildALDoc.ps1 index 5c9bd2544..c71d6921f 100644 --- a/Actions/BuildALDoc/BuildALDoc.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.ps1 @@ -6,8 +6,7 @@ . (Join-Path -Path $PSScriptRoot -ChildPath "..\AL-Go-Helper.ps1" -Resolve) . (Join-Path -Path $PSScriptRoot -ChildPath "BuildALDoc.HelperFunctions.ps1" -Resolve) DownloadAndImportBcContainerHelper - -$alDocPath = DownloadAlDoc +DownloadAlDoc $projects = '*' $maxReleases = 2 From 6c3a0dfc77b8cabd19d99a607675654073e40a38 Mon Sep 17 00:00:00 2001 From: freddydk Date: Wed, 4 Oct 2023 13:13:19 +0200 Subject: [PATCH 024/235] set loc --- Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 | 2 -- Actions/BuildALDoc/BuildALDoc.ps1 | 6 +----- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 index d54778bce..bb58a34ec 100644 --- a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 @@ -117,7 +117,6 @@ function CalculateProjectsAndApps { foreach($mask in 'Apps','Dependencies') { $allApps = @{} Get-ChildItem -Path $tempFolder -Directory | ForEach-Object { - Write-Host $_.Name if ($_.Name -match "^(.*)-main-$mask-(\d*\.\d*\.\d*\.\d*)$") { $project = $Matches[1] if ($projectList | Where-Object { $project -like $_ }) { @@ -128,7 +127,6 @@ function CalculateProjectsAndApps { } } } - $allApps | Out-Host $allApps } } \ No newline at end of file diff --git a/Actions/BuildALDoc/BuildALDoc.ps1 b/Actions/BuildALDoc/BuildALDoc.ps1 index c71d6921f..6b394df15 100644 --- a/Actions/BuildALDoc/BuildALDoc.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.ps1 @@ -21,6 +21,7 @@ if ($maxReleases -gt 0) { #New-Item $docsPath -ItemType Directory | Out-Null $docsPath = $ENV:GITHUB_WORKSPACE +Set-Location $docsPath $loglevel = 'Verbose' $versions = @($releases.Name) @@ -35,11 +36,6 @@ foreach($release in $releases) { Write-Host "$($release.Name):" Get-ChildItem -Path $tempFolder -Recurse -File | ForEach-Object { Write-Host "- $($_.FullName.Substring($tempFolder.Length))" } $allApps,$allDependencies = CalculateProjectsAndApps -tempFolder $tempFolder -projects $projects -refname $ENV:GITHUB_REF_NAME - Write-Host "-------------------------" - $allApps | Out-Host - Write-Host "-------------------------" - $allDependencies | Out-Host - Write-Host "-------------------------" $version = $release.Name $header = "Documentation for $ENV:GITHUB_REPOSITORY $version" $releaseNotes = $release.body From 4fcfa386d9ecaca4fa97d2fa4ac86f8be0c33985 Mon Sep 17 00:00:00 2001 From: freddydk Date: Wed, 4 Oct 2023 13:19:51 +0200 Subject: [PATCH 025/235] dump --- Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 | 3 +++ Actions/BuildALDoc/BuildALDoc.ps1 | 3 +++ 2 files changed, 6 insertions(+) diff --git a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 index bb58a34ec..97d798065 100644 --- a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 @@ -44,6 +44,9 @@ function GenerateDocsSite { [switch] $hostIt ) + Write-Host (Get-Location) + Write-Host (Get-Location) + $docfxPath = Join-Path ([System.IO.Path]::GetTempPath()) ([Guid]::NewGuid().ToString()) New-Item -path $docfxPath -ItemType Directory | Out-Null try { diff --git a/Actions/BuildALDoc/BuildALDoc.ps1 b/Actions/BuildALDoc/BuildALDoc.ps1 index 6b394df15..54129d5d2 100644 --- a/Actions/BuildALDoc/BuildALDoc.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.ps1 @@ -22,6 +22,9 @@ if ($maxReleases -gt 0) { $docsPath = $ENV:GITHUB_WORKSPACE Set-Location $docsPath + +Write-Host $docsPath + $loglevel = 'Verbose' $versions = @($releases.Name) From edac7b5632d4bf99ac310e34df68c866d1f78e8a Mon Sep 17 00:00:00 2001 From: freddydk Date: Wed, 4 Oct 2023 13:30:36 +0200 Subject: [PATCH 026/235] loc --- .../BuildALDoc/BuildALDoc.HelperFunctions.ps1 | 34 +++++++++++-------- Actions/BuildALDoc/BuildALDoc.ps1 | 18 +++++----- 2 files changed, 27 insertions(+), 25 deletions(-) diff --git a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 index 97d798065..f2e6db179 100644 --- a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 @@ -1,17 +1,20 @@ function DownloadAlDoc { - $artifactUrl = Get-BCArtifactUrl -storageAccount bcinsider -type sandbox -country core -select Latest -accept_insiderEula - $folder = Download-Artifacts $artifactUrl - $alLanguageVsix = Join-Path $folder '*.vsix' -Resolve - $tempFolder = Join-Path ([System.IO.Path]::GetTempPath()) ([Guid]::NewGuid().ToString()) - New-Item -Path $tempFolder -ItemType Directory | Out-Null - Expand-Archive -Path $alLanguageVsix -DestinationPath $tempFolder -Force - $isPsCore = $PSVersionTable.PSVersion -ge "6.0.0" - if ($isPsCore -and $isLinux) { - $global:aldocPath = Join-Path $tempFolder 'extension/bin/Linux/aldoc' - } - else { - $global:aldocPath = Join-Path $tempFolder 'extension/bin/win32/aldoc.exe' + if ("$ENV:aldocPath" -eq "") { + $artifactUrl = Get-BCArtifactUrl -storageAccount bcinsider -type sandbox -country core -select Latest -accept_insiderEula + $folder = Download-Artifacts $artifactUrl + $alLanguageVsix = Join-Path $folder '*.vsix' -Resolve + $tempFolder = Join-Path ([System.IO.Path]::GetTempPath()) ([Guid]::NewGuid().ToString()) + New-Item -Path $tempFolder -ItemType Directory | Out-Null + Expand-Archive -Path $alLanguageVsix -DestinationPath $tempFolder -Force + $isPsCore = $PSVersionTable.PSVersion -ge "6.0.0" + if ($isPsCore -and $isLinux) { + $ENV:aldocPath = Join-Path $tempFolder 'extension/bin/Linux/aldoc' + } + else { + $ENV:aldocPath = Join-Path $tempFolder 'extension/bin/win32/aldoc.exe' + } } + $ENV:aldocPath } function SanitizeFileName([string] $filename) { @@ -44,8 +47,9 @@ function GenerateDocsSite { [switch] $hostIt ) + $alDocPath = DownloadAlDoc Write-Host (Get-Location) - Write-Host (Get-Location) + Write-Host (Test-Path -Path (Get-Location)) $docfxPath = Join-Path ([System.IO.Path]::GetTempPath()) ([Guid]::NewGuid().ToString()) New-Item -path $docfxPath -ItemType Directory | Out-Null @@ -76,7 +80,7 @@ function GenerateDocsSite { } } - CmdDo -command $global:aldocPath -arguments @("init","--output ""$docfxpath""","--loglevel $loglevel","--targetpackages ""$($apps -join '","')""") + CmdDo -command $aldocPath -arguments @("init","--output ""$docfxpath""","--loglevel $loglevel","--targetpackages ""$($apps -join '","')""") # Update docfx.json $docfxJsonFile = Join-Path $docfxPath 'docfx.json' @@ -90,7 +94,7 @@ function GenerateDocsSite { Set-Content -Path $tocYmlFile -Value ($newTocYml -join "`n") -Encoding utf8 $apps | ForEach-Object { - CmdDo -command $global:aldocPath -arguments @("build","--output ""$docfxpath""","--loglevel $loglevel","--source ""$_""") + CmdDo -command $aldocPath -arguments @("build","--output ""$docfxpath""","--loglevel $loglevel","--source ""$_""") } # Set release notes diff --git a/Actions/BuildALDoc/BuildALDoc.ps1 b/Actions/BuildALDoc/BuildALDoc.ps1 index 54129d5d2..ff72f2bbe 100644 --- a/Actions/BuildALDoc/BuildALDoc.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.ps1 @@ -6,12 +6,14 @@ . (Join-Path -Path $PSScriptRoot -ChildPath "..\AL-Go-Helper.ps1" -Resolve) . (Join-Path -Path $PSScriptRoot -ChildPath "BuildALDoc.HelperFunctions.ps1" -Resolve) DownloadAndImportBcContainerHelper -DownloadAlDoc $projects = '*' $maxReleases = 2 $artifactsFolder = Join-Path $ENV:GITHUB_WORKSPACE ".artifacts" +Write-Host $artifactsFolder +Write-Host (Test-Path $artifactsFolder) + $releases = @() if ($maxReleases -gt 0) { $releases = GetReleases -token $token -api_url $ENV:GITHUB_API_URL -repository $ENV:GITHUB_REPOSITORY | Where-Object { -not ($_.prerelease -or $_.draft) } | Select-Object -First $maxReleases @@ -21,7 +23,9 @@ if ($maxReleases -gt 0) { #New-Item $docsPath -ItemType Directory | Out-Null $docsPath = $ENV:GITHUB_WORKSPACE -Set-Location $docsPath + +Write-Host (Get-Location) +Write-Host (Test-Path -Path (Get-Location)) Write-Host $docsPath @@ -37,7 +41,7 @@ foreach($release in $releases) { DownloadRelease -token $token -projects $projects -api_url $ENV:GITHUB_API_URL -repository $ENV:GITHUB_REPOSITORY -release $release -path $tempFolder -mask $mask -unpack } Write-Host "$($release.Name):" - Get-ChildItem -Path $tempFolder -Recurse -File | ForEach-Object { Write-Host "- $($_.FullName.Substring($tempFolder.Length))" } + Get-ChildItem -Path $tempFolder -Recurse -File | ForEach-Object { Write-Host "- $($_.FullName.Substring($tempFolder.Length+1))" } $allApps,$allDependencies = CalculateProjectsAndApps -tempFolder $tempFolder -projects $projects -refname $ENV:GITHUB_REF_NAME $version = $release.Name $header = "Documentation for $ENV:GITHUB_REPOSITORY $version" @@ -62,19 +66,13 @@ foreach($release in $releases) { $releasesPath = Join-Path $docsPath "_site/releases" New-Item -Path $releasesPath -ItemType Directory | Out-Null foreach($version in $versions) { - Move-Item -Path (join-Path $docsPath $version) -Destination $releasesPath + Move-Item -Path (join-Path $docsPath $version) -Destination $releasesPath } Write-Host "main:" Get-ChildItem -Path $artifactsFolder -Recurse -File | ForEach-Object { Write-Host "- $($_.FullName.Substring($artifactsFolder.Length))" } $allApps,$allDependencies = CalculateProjectsAndApps -tempFolder $artifactsFolder -projects $projects -refname $ENV:GITHUB_REF_NAME -Write-Host "-------------------------" -$allApps | Out-Host -Write-Host "-------------------------" -$allDependencies | Out-Host -Write-Host "-------------------------" - $version = 'main' $header = "Documentation for $ENV:GITHUB_REPOSITORY" $releaseNotes = "Documentation for current branch" From 8aab60511047bb2cb9ada84c379c0b7627dc8292 Mon Sep 17 00:00:00 2001 From: freddydk Date: Wed, 4 Oct 2023 13:31:24 +0200 Subject: [PATCH 027/235] use .aldoc --- Actions/BuildALDoc/BuildALDoc.ps1 | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Actions/BuildALDoc/BuildALDoc.ps1 b/Actions/BuildALDoc/BuildALDoc.ps1 index ff72f2bbe..ec93113a4 100644 --- a/Actions/BuildALDoc/BuildALDoc.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.ps1 @@ -19,10 +19,8 @@ if ($maxReleases -gt 0) { $releases = GetReleases -token $token -api_url $ENV:GITHUB_API_URL -repository $ENV:GITHUB_REPOSITORY | Where-Object { -not ($_.prerelease -or $_.draft) } | Select-Object -First $maxReleases } -#$docsPath = Join-Path $ENV:GITHUB_WORKSPACE ".aldoc" -#New-Item $docsPath -ItemType Directory | Out-Null - -$docsPath = $ENV:GITHUB_WORKSPACE +$docsPath = Join-Path $ENV:GITHUB_WORKSPACE ".aldoc" +New-Item $docsPath -ItemType Directory | Out-Null Write-Host (Get-Location) Write-Host (Test-Path -Path (Get-Location)) From 469cf5dcb0f33522fbf0342886d676e6ab97e822 Mon Sep 17 00:00:00 2001 From: freddydk Date: Wed, 4 Oct 2023 13:36:51 +0200 Subject: [PATCH 028/235] hmm --- Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 index f2e6db179..d4eedffc4 100644 --- a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 @@ -80,6 +80,9 @@ function GenerateDocsSite { } } + Write-Host (Get-Location) + Write-Host (Test-Path -Path (Get-Location)) + CmdDo -command $aldocPath -arguments @("init","--output ""$docfxpath""","--loglevel $loglevel","--targetpackages ""$($apps -join '","')""") # Update docfx.json From 20cf760df98d05078095ab7a491164c666a8a19a Mon Sep 17 00:00:00 2001 From: freddydk Date: Wed, 4 Oct 2023 13:55:48 +0200 Subject: [PATCH 029/235] fix --- Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 index d4eedffc4..cefbcc5bb 100644 --- a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 @@ -103,7 +103,13 @@ function GenerateDocsSite { # Set release notes Set-Content -path (Join-Path $docfxpath 'index.md') -value $releaseNotes -encoding utf8 - $arguments = @("build", "--output ""$docsPath""", "--logLevel $loglevel", $docfxJsonFile) + Write-Host $docsPath + Write-Host (Test-Path $docsPath) + Write-Host $docfxJsonFile + Write-Host (Test-Path $docfxJsonFile) + + + $arguments = @("build", "--output ""$docsPath""", "--logLevel $loglevel", """$docfxJsonFile""") if ($hostIt) { $arguments += @('-s') Write-Host "Generate and host site" From da03827f323e40ea42fa22cc474ca7728b0ab92b Mon Sep 17 00:00:00 2001 From: freddydk Date: Wed, 4 Oct 2023 13:59:19 +0200 Subject: [PATCH 030/235] install docfx --- Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 index cefbcc5bb..d7bc52542 100644 --- a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 @@ -13,6 +13,8 @@ else { $ENV:aldocPath = Join-Path $tempFolder 'extension/bin/win32/aldoc.exe' } + + dotnet tool update -g docfx } $ENV:aldocPath } From e1f96e34a223b0345d77fd1bfc34c2f6a032e2d6 Mon Sep 17 00:00:00 2001 From: freddydk Date: Wed, 4 Oct 2023 14:00:35 +0200 Subject: [PATCH 031/235] remove dumps --- Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 | 12 ------------ Actions/BuildALDoc/BuildALDoc.ps1 | 9 --------- 2 files changed, 21 deletions(-) diff --git a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 index d7bc52542..d2063fa0d 100644 --- a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 @@ -50,9 +50,6 @@ function GenerateDocsSite { ) $alDocPath = DownloadAlDoc - Write-Host (Get-Location) - Write-Host (Test-Path -Path (Get-Location)) - $docfxPath = Join-Path ([System.IO.Path]::GetTempPath()) ([Guid]::NewGuid().ToString()) New-Item -path $docfxPath -ItemType Directory | Out-Null try { @@ -82,9 +79,6 @@ function GenerateDocsSite { } } - Write-Host (Get-Location) - Write-Host (Test-Path -Path (Get-Location)) - CmdDo -command $aldocPath -arguments @("init","--output ""$docfxpath""","--loglevel $loglevel","--targetpackages ""$($apps -join '","')""") # Update docfx.json @@ -105,12 +99,6 @@ function GenerateDocsSite { # Set release notes Set-Content -path (Join-Path $docfxpath 'index.md') -value $releaseNotes -encoding utf8 - Write-Host $docsPath - Write-Host (Test-Path $docsPath) - Write-Host $docfxJsonFile - Write-Host (Test-Path $docfxJsonFile) - - $arguments = @("build", "--output ""$docsPath""", "--logLevel $loglevel", """$docfxJsonFile""") if ($hostIt) { $arguments += @('-s') diff --git a/Actions/BuildALDoc/BuildALDoc.ps1 b/Actions/BuildALDoc/BuildALDoc.ps1 index ec93113a4..22267b4eb 100644 --- a/Actions/BuildALDoc/BuildALDoc.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.ps1 @@ -11,9 +11,6 @@ $projects = '*' $maxReleases = 2 $artifactsFolder = Join-Path $ENV:GITHUB_WORKSPACE ".artifacts" -Write-Host $artifactsFolder -Write-Host (Test-Path $artifactsFolder) - $releases = @() if ($maxReleases -gt 0) { $releases = GetReleases -token $token -api_url $ENV:GITHUB_API_URL -repository $ENV:GITHUB_REPOSITORY | Where-Object { -not ($_.prerelease -or $_.draft) } | Select-Object -First $maxReleases @@ -21,12 +18,6 @@ if ($maxReleases -gt 0) { $docsPath = Join-Path $ENV:GITHUB_WORKSPACE ".aldoc" New-Item $docsPath -ItemType Directory | Out-Null - -Write-Host (Get-Location) -Write-Host (Test-Path -Path (Get-Location)) - -Write-Host $docsPath - $loglevel = 'Verbose' $versions = @($releases.Name) From d3b6c6dec0524b1914ca0c23442cd3bfd5021414 Mon Sep 17 00:00:00 2001 From: freddydk Date: Wed, 4 Oct 2023 14:03:57 +0200 Subject: [PATCH 032/235] use cmddo --- Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 index d2063fa0d..fc772a24c 100644 --- a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 @@ -14,7 +14,7 @@ $ENV:aldocPath = Join-Path $tempFolder 'extension/bin/win32/aldoc.exe' } - dotnet tool update -g docfx + CmdDo -command dotnet -arguments @('tool','update','-g docfx') } $ENV:aldocPath } From d2ec79d10b36a7433cde840362bff31022fa8cf1 Mon Sep 17 00:00:00 2001 From: freddydk Date: Wed, 4 Oct 2023 14:04:41 +0200 Subject: [PATCH 033/235] test --- Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 | 1 + 1 file changed, 1 insertion(+) diff --git a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 index fc772a24c..0a5bc01f8 100644 --- a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 @@ -16,6 +16,7 @@ CmdDo -command dotnet -arguments @('tool','update','-g docfx') } + Write-Host (Test-Path $ENV:aldocPath) $ENV:aldocPath } From 2fa6db119cab17ac0052af422fb4993031c8f49b Mon Sep 17 00:00:00 2001 From: freddydk Date: Wed, 4 Oct 2023 14:09:22 +0200 Subject: [PATCH 034/235] impl --- Actions/BuildALDoc/BuildALDoc.ps1 | 55 ------------------------------- 1 file changed, 55 deletions(-) diff --git a/Actions/BuildALDoc/BuildALDoc.ps1 b/Actions/BuildALDoc/BuildALDoc.ps1 index 22267b4eb..34976e985 100644 --- a/Actions/BuildALDoc/BuildALDoc.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.ps1 @@ -66,58 +66,3 @@ $version = 'main' $header = "Documentation for $ENV:GITHUB_REPOSITORY" $releaseNotes = "Documentation for current branch" GenerateDocsSite -version $version -allVersions $versions -allApps $allApps -releaseNotes $releaseNotes -header $header -docsPath $docsPath -logLevel $logLevel - -## locate all artifacts folders in .artifacts -#Write-Host "CURRENT:" -#Get-ChildItem -Path $artifactsFolder -Recurse -File | ForEach-Object { Write-Host "- $($_.FullName)" } -#$apps = @() -#$dependencies = @() -#if (Test-Path $artifactsFolder -PathType Container) { -# $projects.Split(',') | ForEach-Object { -# $project = $_.Replace('\','_').Replace('/','_') -# $refname = "$ENV:GITHUB_REF_NAME".Replace('/','_') -# Write-Host "project '$project'" -# $apps += @((Get-ChildItem -Path $artifactsFolder -Filter "$project-$refname-Apps-*.*.*.*") | ForEach-Object { $_.FullName }) -# if (!($apps)) { -# throw "There are no build artifacts present in .artifacts matching $project-$refname-Apps-." -# } -# $dependencies += @((Get-ChildItem -Path $artifactsFolder -Filter "$project-$refname-Dependencies-*.*.*.*") | ForEach-Object { $_.FullName }) -# } -#} -#else { -# throw "No build artifacts present in .artifacts." -#} - -# locate all apps in the artifacts folders -#$allApps = @{} -#foreach($folder in $apps) { -# $projectName = [System.IO.Path]::GetFileName($folder).Split("-$refname-Apps-")[0] -# $allApps."$projectName" = @(Get-ChildItem -Path (Join-Path $folder '*.app') | Select-Object -ExpandProperty FullName) -#} -# -#$releases = GetReleases -token $token -api_url $ENV:GITHUB_API_URL -repository $ENV:GITHUB_REPOSITORY | -# Where-Object { -not ($_.prerelease -or $_.draft) } | -# Select-Object -First $maxReleases -# -#foreach($release in $releases) { -# $tempFolder = Join-Path ([System.IO.Path]::GetTempPath()) ([Guid]::NewGuid().ToString()) -# New-Item -Path $tempFolder -ItemType Directory | Out-Null -# foreach($mask in 'Apps', 'Dependencies') { -# DownloadRelease -token $token -projects $projects -api_url $ENV:GITHUB_API_URL -repository $ENV:GITHUB_REPOSITORY -release $release -path $tempFolder -mask $mask -unpack -# } -# Write-Host $release.Name -# Get-ChildItem -Path $tempFolder -Recurse -File | ForEach-Object { Write-Host "- $($_.FullName)" } -#} -# -#$allApps | Out-Host -# -#Write-Host "Apps to build documentation for" -#$apps | Out-Host -# -#Write-Host "Dependencies" -#$dependencies | Out-Host -# -#Write-Host "Releases" -#$releases | Out-Host - -throw "Not implemented" From a112abd3e8b552a7d383db18814c90e939b1aba9 Mon Sep 17 00:00:00 2001 From: freddydk Date: Wed, 4 Oct 2023 14:37:19 +0200 Subject: [PATCH 035/235] chmod --- Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 | 1 + 1 file changed, 1 insertion(+) diff --git a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 index 0a5bc01f8..8665fdf69 100644 --- a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 @@ -9,6 +9,7 @@ $isPsCore = $PSVersionTable.PSVersion -ge "6.0.0" if ($isPsCore -and $isLinux) { $ENV:aldocPath = Join-Path $tempFolder 'extension/bin/Linux/aldoc' + & /usr/bin/env sudo pwsh -command "& chmod +x $ENV:aldocPath" } else { $ENV:aldocPath = Join-Path $tempFolder 'extension/bin/win32/aldoc.exe' From fda0f2e74c40b8317b63b20b4626c878a883235f Mon Sep 17 00:00:00 2001 From: freddydk Date: Wed, 4 Oct 2023 14:41:31 +0200 Subject: [PATCH 036/235] l --- Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 index 8665fdf69..aab16fdfd 100644 --- a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 @@ -8,7 +8,7 @@ Expand-Archive -Path $alLanguageVsix -DestinationPath $tempFolder -Force $isPsCore = $PSVersionTable.PSVersion -ge "6.0.0" if ($isPsCore -and $isLinux) { - $ENV:aldocPath = Join-Path $tempFolder 'extension/bin/Linux/aldoc' + $ENV:aldocPath = Join-Path $tempFolder 'extension/bin/linux/aldoc' & /usr/bin/env sudo pwsh -command "& chmod +x $ENV:aldocPath" } else { From 23cd1fe0fbafb205791338818192dbd213dca622 Mon Sep 17 00:00:00 2001 From: freddydk Date: Wed, 4 Oct 2023 14:50:57 +0200 Subject: [PATCH 037/235] relative --- Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 index aab16fdfd..d7e4fc102 100644 --- a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 @@ -17,7 +17,6 @@ CmdDo -command dotnet -arguments @('tool','update','-g docfx') } - Write-Host (Test-Path $ENV:aldocPath) $ENV:aldocPath } @@ -59,7 +58,7 @@ function GenerateDocsSite { # Generate new toc.yml and calculate apps - releases and projects $newTocYml = @('items:',' - name: Releases',' items:',' - name: main',' href: /') foreach($ver in $allVersions) { - $newTocYml += @(" - name: $ver"," href: /releases/$ver") + $newTocYml += @(" - name: $ver"," href: releases/$ver") } if ($allApps.Keys.Count -eq 1 -and $allApps.Keys[0] -eq '.') { # Single prokect repo From 19dd85eeeee7909bb07de83ed37836cf6acbae57 Mon Sep 17 00:00:00 2001 From: freddydk Date: Wed, 4 Oct 2023 23:34:05 +0200 Subject: [PATCH 038/235] dumps --- Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 index d7e4fc102..61a38a335 100644 --- a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 @@ -89,17 +89,27 @@ function GenerateDocsSite { $docfxJson.build.globalMetadata._appFooter = $footer $docfxJson | ConvertTo-Json -Depth 99 | Set-Content -Path $docfxJsonFile -Encoding utf8 + Write-Host "-----------------------JSON-----------------------" + Get-Content $docfxJsonFile -Encoding utf8 | Out-Host + # Create new toc.yml $tocYmlFile = Join-Path $docfxpath 'toc.yml' Set-Content -Path $tocYmlFile -Value ($newTocYml -join "`n") -Encoding utf8 + Write-Host "-----------------------TOC-----------------------" + Get-Content $tocYmlFile -Encoding utf8 | Out-Host + $apps | ForEach-Object { + Write-Host "Build $_ $(Test-Path $_))" CmdDo -command $aldocPath -arguments @("build","--output ""$docfxpath""","--loglevel $loglevel","--source ""$_""") } # Set release notes Set-Content -path (Join-Path $docfxpath 'index.md') -value $releaseNotes -encoding utf8 + Write-Host "CALL DOCFX with this:" + get-childitem -path "$docfxPath/*" -Recurse | % { Write-Host $_.FullName } + $arguments = @("build", "--output ""$docsPath""", "--logLevel $loglevel", """$docfxJsonFile""") if ($hostIt) { $arguments += @('-s') From 3a845bcaf9f5cdee81423e7d5ac7a3fd30e421f3 Mon Sep 17 00:00:00 2001 From: freddydk Date: Thu, 5 Oct 2023 00:02:03 +0200 Subject: [PATCH 039/235] dumps --- Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 index 61a38a335..b4882ee8a 100644 --- a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 @@ -82,6 +82,9 @@ function GenerateDocsSite { CmdDo -command $aldocPath -arguments @("init","--output ""$docfxpath""","--loglevel $loglevel","--targetpackages ""$($apps -join '","')""") + Write-Host "Back from aldoc init:" + get-childitem -path "$docfxPath/*" -Recurse -File | % { Write-Host $_.FullName } + # Update docfx.json $docfxJsonFile = Join-Path $docfxPath 'docfx.json' $docfxJson = Get-Content -Encoding utf8 -Path $docfxJsonFile | ConvertFrom-Json @@ -92,11 +95,14 @@ function GenerateDocsSite { Write-Host "-----------------------JSON-----------------------" Get-Content $docfxJsonFile -Encoding utf8 | Out-Host + Write-Host "-----------------------ORGTOC-----------------------" + Get-Content $tocYmlFile -Encoding utf8 | Out-Host + # Create new toc.yml $tocYmlFile = Join-Path $docfxpath 'toc.yml' Set-Content -Path $tocYmlFile -Value ($newTocYml -join "`n") -Encoding utf8 - Write-Host "-----------------------TOC-----------------------" + Write-Host "-----------------------NEWTOC-----------------------" Get-Content $tocYmlFile -Encoding utf8 | Out-Host $apps | ForEach-Object { @@ -108,7 +114,7 @@ function GenerateDocsSite { Set-Content -path (Join-Path $docfxpath 'index.md') -value $releaseNotes -encoding utf8 Write-Host "CALL DOCFX with this:" - get-childitem -path "$docfxPath/*" -Recurse | % { Write-Host $_.FullName } + get-childitem -path "$docfxPath/*" -Recurse -File | % { Write-Host $_.FullName } $arguments = @("build", "--output ""$docsPath""", "--logLevel $loglevel", """$docfxJsonFile""") if ($hostIt) { From d42f86923b6868fc47c2e26461475467272716a0 Mon Sep 17 00:00:00 2001 From: freddydk Date: Thu, 5 Oct 2023 00:08:56 +0200 Subject: [PATCH 040/235] toc --- Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 index b4882ee8a..8483e6a8e 100644 --- a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 @@ -95,11 +95,10 @@ function GenerateDocsSite { Write-Host "-----------------------JSON-----------------------" Get-Content $docfxJsonFile -Encoding utf8 | Out-Host - Write-Host "-----------------------ORGTOC-----------------------" - Get-Content $tocYmlFile -Encoding utf8 | Out-Host - # Create new toc.yml $tocYmlFile = Join-Path $docfxpath 'toc.yml' + Write-Host "-----------------------ORGTOC-----------------------" + Get-Content $tocYmlFile -Encoding utf8 | Out-Host Set-Content -Path $tocYmlFile -Value ($newTocYml -join "`n") -Encoding utf8 Write-Host "-----------------------NEWTOC-----------------------" From bc2bed366f16dfbd412046e2db49b75c99ee1eb4 Mon Sep 17 00:00:00 2001 From: freddydk Date: Thu, 5 Oct 2023 06:37:08 +0200 Subject: [PATCH 041/235] dumps --- Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 index 8483e6a8e..035ea8c86 100644 --- a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 @@ -83,7 +83,7 @@ function GenerateDocsSite { CmdDo -command $aldocPath -arguments @("init","--output ""$docfxpath""","--loglevel $loglevel","--targetpackages ""$($apps -join '","')""") Write-Host "Back from aldoc init:" - get-childitem -path "$docfxPath/*" -Recurse -File | % { Write-Host $_.FullName } + get-childitem -path "$docfxPath/*" -Recurse | % { Write-Host "$($_.FullName) ($($_.Attributes))" } # Update docfx.json $docfxJsonFile = Join-Path $docfxPath 'docfx.json' @@ -107,6 +107,9 @@ function GenerateDocsSite { $apps | ForEach-Object { Write-Host "Build $_ $(Test-Path $_))" CmdDo -command $aldocPath -arguments @("build","--output ""$docfxpath""","--loglevel $loglevel","--source ""$_""") + + Write-Host "Back from aldoc build:" + get-childitem -path "$docfxPath/*" -Recurse | % { Write-Host "$($_.FullName) ($($_.Attributes))" } } # Set release notes From 990febe917fcb65ecc02ae0da8b6f92567fd461f Mon Sep 17 00:00:00 2001 From: freddydk Date: Thu, 5 Oct 2023 06:54:25 +0200 Subject: [PATCH 042/235] dirname --- Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 index 035ea8c86..3ed334a7a 100644 --- a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 @@ -83,7 +83,7 @@ function GenerateDocsSite { CmdDo -command $aldocPath -arguments @("init","--output ""$docfxpath""","--loglevel $loglevel","--targetpackages ""$($apps -join '","')""") Write-Host "Back from aldoc init:" - get-childitem -path "$docfxPath/*" -Recurse | % { Write-Host "$($_.FullName) ($($_.Attributes))" } + get-childitem -path "$docfxPath/*" -Recurse -File | % { Write-Host "$($_.Directory.Name) [$($_.Name)]" } # Update docfx.json $docfxJsonFile = Join-Path $docfxPath 'docfx.json' @@ -109,14 +109,14 @@ function GenerateDocsSite { CmdDo -command $aldocPath -arguments @("build","--output ""$docfxpath""","--loglevel $loglevel","--source ""$_""") Write-Host "Back from aldoc build:" - get-childitem -path "$docfxPath/*" -Recurse | % { Write-Host "$($_.FullName) ($($_.Attributes))" } + get-childitem -path "$docfxPath/*" -Recurse -File | % { Write-Host "$($_.Directory.Name) [$($_.Name)]" } } # Set release notes Set-Content -path (Join-Path $docfxpath 'index.md') -value $releaseNotes -encoding utf8 Write-Host "CALL DOCFX with this:" - get-childitem -path "$docfxPath/*" -Recurse -File | % { Write-Host $_.FullName } + get-childitem -path "$docfxPath/*" -Recurse -File | % { Write-Host "$($_.Directory.Name) [$($_.Name)]" } $arguments = @("build", "--output ""$docsPath""", "--logLevel $loglevel", """$docfxJsonFile""") if ($hostIt) { From ae06d2d0030b8c31737781262e290398a0d7a993 Mon Sep 17 00:00:00 2001 From: freddydk Date: Thu, 5 Oct 2023 07:25:37 +0200 Subject: [PATCH 043/235] fullnames --- Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 index 3ed334a7a..c270779c0 100644 --- a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 @@ -83,7 +83,7 @@ function GenerateDocsSite { CmdDo -command $aldocPath -arguments @("init","--output ""$docfxpath""","--loglevel $loglevel","--targetpackages ""$($apps -join '","')""") Write-Host "Back from aldoc init:" - get-childitem -path "$docfxPath/*" -Recurse -File | % { Write-Host "$($_.Directory.Name) [$($_.Name)]" } + get-childitem -path "$docfxPath/*" -Recurse -File | % { Write-Host "$($_.Directory.FullName) [$($_.Name)]" } # Update docfx.json $docfxJsonFile = Join-Path $docfxPath 'docfx.json' @@ -109,14 +109,14 @@ function GenerateDocsSite { CmdDo -command $aldocPath -arguments @("build","--output ""$docfxpath""","--loglevel $loglevel","--source ""$_""") Write-Host "Back from aldoc build:" - get-childitem -path "$docfxPath/*" -Recurse -File | % { Write-Host "$($_.Directory.Name) [$($_.Name)]" } + get-childitem -path "$docfxPath/*" -Recurse -File | % { Write-Host "$($_.Directory.FullName) [$($_.Name)]" } } # Set release notes Set-Content -path (Join-Path $docfxpath 'index.md') -value $releaseNotes -encoding utf8 Write-Host "CALL DOCFX with this:" - get-childitem -path "$docfxPath/*" -Recurse -File | % { Write-Host "$($_.Directory.Name) [$($_.Name)]" } + get-childitem -path "$docfxPath/*" -Recurse -File | % { Write-Host "$($_.Directory.FullName) [$($_.Name)]" } $arguments = @("build", "--output ""$docsPath""", "--logLevel $loglevel", """$docfxJsonFile""") if ($hostIt) { From b70a88adf79e5aa887c4ae75c3ca8ddd64775092 Mon Sep 17 00:00:00 2001 From: freddydk Date: Thu, 5 Oct 2023 07:45:39 +0200 Subject: [PATCH 044/235] rename --- .../BuildALDoc/BuildALDoc.HelperFunctions.ps1 | 24 +++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 index c270779c0..67dfe3955 100644 --- a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 @@ -83,7 +83,17 @@ function GenerateDocsSite { CmdDo -command $aldocPath -arguments @("init","--output ""$docfxpath""","--loglevel $loglevel","--targetpackages ""$($apps -join '","')""") Write-Host "Back from aldoc init:" - get-childitem -path "$docfxPath/*" -Recurse -File | % { Write-Host "$($_.Directory.FullName) [$($_.Name)]" } + $allFiles = @(get-childitem -path "$docfxPath/*" -Recurse -File | ForEach-Object { Write-Host "$($_.Directory.FullName) [$($_.Name)]"; $_.FullName }) + $allFiles | Where-Object { $_.Contains('\') } | ForEach-Object { + $newName = $_.Replace('\','/') + $folder = Split-Path -Path $newName -Parent + if (-not (Test-Path $folder -PathType Container)) { + New-Item -Path $folder -ItemType Directory | Out-Null + } + Write-Host "Fix: $_ -> $newName" + Copy-Item $_ $newName -Force + Remove-Item $_ -Force + } # Update docfx.json $docfxJsonFile = Join-Path $docfxPath 'docfx.json' @@ -109,7 +119,17 @@ function GenerateDocsSite { CmdDo -command $aldocPath -arguments @("build","--output ""$docfxpath""","--loglevel $loglevel","--source ""$_""") Write-Host "Back from aldoc build:" - get-childitem -path "$docfxPath/*" -Recurse -File | % { Write-Host "$($_.Directory.FullName) [$($_.Name)]" } + $allFiles = @(get-childitem -path "$docfxPath/*" -Recurse -File | ForEach-Object { Write-Host "$($_.Directory.FullName) [$($_.Name)]"; $_.FullName }) + $allFiles | Where-Object { $_.Contains('\') } | ForEach-Object { + $newName = $_.Replace('\','/') + $folder = Split-Path -Path $newName -Parent + if (-not (Test-Path $folder -PathType Container)) { + New-Item -Path $folder -ItemType Directory | Out-Null + } + Write-Host "Fix: $_ -> $newName" + Copy-Item $_ $newName -Force + Remove-Item $_ -Force + } } # Set release notes From 6dcd15d1f0620c68c30a5a251946097d16500239 Mon Sep 17 00:00:00 2001 From: freddydk Date: Thu, 5 Oct 2023 07:57:41 +0200 Subject: [PATCH 045/235] dump --- Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 index 67dfe3955..d29dc99e0 100644 --- a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 @@ -87,11 +87,13 @@ function GenerateDocsSite { $allFiles | Where-Object { $_.Contains('\') } | ForEach-Object { $newName = $_.Replace('\','/') $folder = Split-Path -Path $newName -Parent + Write-Host "Folder: $folder" if (-not (Test-Path $folder -PathType Container)) { + Write-Host "Create folder" New-Item -Path $folder -ItemType Directory | Out-Null } Write-Host "Fix: $_ -> $newName" - Copy-Item $_ $newName -Force + Copy-Item -Path $_ -Destination $newName -Force Remove-Item $_ -Force } From 05445de9cc791c99f0e344ab68e5ec628ce62dbb Mon Sep 17 00:00:00 2001 From: freddydk Date: Thu, 5 Oct 2023 08:02:02 +0200 Subject: [PATCH 046/235] use linux cp and rm --- Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 index d29dc99e0..984f0b43f 100644 --- a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 @@ -93,8 +93,8 @@ function GenerateDocsSite { New-Item -Path $folder -ItemType Directory | Out-Null } Write-Host "Fix: $_ -> $newName" - Copy-Item -Path $_ -Destination $newName -Force - Remove-Item $_ -Force + & cp $_ $newName + & rm $_ } # Update docfx.json @@ -125,12 +125,14 @@ function GenerateDocsSite { $allFiles | Where-Object { $_.Contains('\') } | ForEach-Object { $newName = $_.Replace('\','/') $folder = Split-Path -Path $newName -Parent + Write-Host "Folder: $folder" if (-not (Test-Path $folder -PathType Container)) { + Write-Host "Create folder" New-Item -Path $folder -ItemType Directory | Out-Null } Write-Host "Fix: $_ -> $newName" - Copy-Item $_ $newName -Force - Remove-Item $_ -Force + & cp $_ $newName + & rm $_ } } From 5c82eb37b09ac75f14d03b9174af1b44d0054d3a Mon Sep 17 00:00:00 2001 From: freddydk Date: Thu, 5 Oct 2023 08:19:35 +0200 Subject: [PATCH 047/235] fix --- .../BuildALDoc/BuildALDoc.HelperFunctions.ps1 | 36 +++++++------------ 1 file changed, 12 insertions(+), 24 deletions(-) diff --git a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 index 984f0b43f..e35f9c418 100644 --- a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 @@ -80,73 +80,61 @@ function GenerateDocsSite { } } - CmdDo -command $aldocPath -arguments @("init","--output ""$docfxpath""","--loglevel $loglevel","--targetpackages ""$($apps -join '","')""") + $arguments = @("init","--output ""$docfxpath""","--loglevel $loglevel","--targetpackages ""$($apps -join '","')""") + Write-Host "aldoc init $arguments" + CmdDo -command $aldocPath -arguments $arguments - Write-Host "Back from aldoc init:" - $allFiles = @(get-childitem -path "$docfxPath/*" -Recurse -File | ForEach-Object { Write-Host "$($_.Directory.FullName) [$($_.Name)]"; $_.FullName }) + $allFiles = @(get-childitem -path "$docfxPath/*" -Recurse -File | ForEach-Object { $_.FullName }) $allFiles | Where-Object { $_.Contains('\') } | ForEach-Object { $newName = $_.Replace('\','/') $folder = Split-Path -Path $newName -Parent - Write-Host "Folder: $folder" if (-not (Test-Path $folder -PathType Container)) { - Write-Host "Create folder" New-Item -Path $folder -ItemType Directory | Out-Null } - Write-Host "Fix: $_ -> $newName" & cp $_ $newName & rm $_ } # Update docfx.json + Write-Host "Update docfx.json" $docfxJsonFile = Join-Path $docfxPath 'docfx.json' $docfxJson = Get-Content -Encoding utf8 -Path $docfxJsonFile | ConvertFrom-Json $docfxJson.build.globalMetadata._appName = $header $docfxJson.build.globalMetadata._appFooter = $footer $docfxJson | ConvertTo-Json -Depth 99 | Set-Content -Path $docfxJsonFile -Encoding utf8 - Write-Host "-----------------------JSON-----------------------" - Get-Content $docfxJsonFile -Encoding utf8 | Out-Host - # Create new toc.yml + Write-Host "Create new toc.yml" $tocYmlFile = Join-Path $docfxpath 'toc.yml' - Write-Host "-----------------------ORGTOC-----------------------" - Get-Content $tocYmlFile -Encoding utf8 | Out-Host Set-Content -Path $tocYmlFile -Value ($newTocYml -join "`n") -Encoding utf8 - Write-Host "-----------------------NEWTOC-----------------------" - Get-Content $tocYmlFile -Encoding utf8 | Out-Host - $apps | ForEach-Object { - Write-Host "Build $_ $(Test-Path $_))" - CmdDo -command $aldocPath -arguments @("build","--output ""$docfxpath""","--loglevel $loglevel","--source ""$_""") + $arguments = @("build","--output ""$docfxpath""","--loglevel $loglevel","--source ""$_""") + Write-Host "aldoc build $arguments" + CmdDo -command $aldocPath -arguments $arguments - Write-Host "Back from aldoc build:" - $allFiles = @(get-childitem -path "$docfxPath/*" -Recurse -File | ForEach-Object { Write-Host "$($_.Directory.FullName) [$($_.Name)]"; $_.FullName }) + $allFiles = @(get-childitem -path "$docfxPath/*" -Recurse -File | ForEach-Object { $_.FullName }) $allFiles | Where-Object { $_.Contains('\') } | ForEach-Object { $newName = $_.Replace('\','/') $folder = Split-Path -Path $newName -Parent - Write-Host "Folder: $folder" if (-not (Test-Path $folder -PathType Container)) { - Write-Host "Create folder" New-Item -Path $folder -ItemType Directory | Out-Null } - Write-Host "Fix: $_ -> $newName" & cp $_ $newName & rm $_ } } # Set release notes + Write-Host "Update index.md" Set-Content -path (Join-Path $docfxpath 'index.md') -value $releaseNotes -encoding utf8 - Write-Host "CALL DOCFX with this:" - get-childitem -path "$docfxPath/*" -Recurse -File | % { Write-Host "$($_.Directory.FullName) [$($_.Name)]" } - $arguments = @("build", "--output ""$docsPath""", "--logLevel $loglevel", """$docfxJsonFile""") if ($hostIt) { $arguments += @('-s') Write-Host "Generate and host site" } + Write-Host "invoke doxfx $arguments" CmdDo -command docfx -arguments $arguments } finally { From cc467b78ef29d3bba0a98a7959c6ab4b377470bf Mon Sep 17 00:00:00 2001 From: freddydk Date: Thu, 5 Oct 2023 08:21:25 +0200 Subject: [PATCH 048/235] info --- Actions/BuildALDoc/BuildALDoc.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Actions/BuildALDoc/BuildALDoc.ps1 b/Actions/BuildALDoc/BuildALDoc.ps1 index 34976e985..5b63f6175 100644 --- a/Actions/BuildALDoc/BuildALDoc.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.ps1 @@ -18,7 +18,7 @@ if ($maxReleases -gt 0) { $docsPath = Join-Path $ENV:GITHUB_WORKSPACE ".aldoc" New-Item $docsPath -ItemType Directory | Out-Null -$loglevel = 'Verbose' +$loglevel = 'Info' $versions = @($releases.Name) From 7e1f1852310d65496007a9ec2605f8d36f758695 Mon Sep 17 00:00:00 2001 From: freddydk Date: Thu, 5 Oct 2023 08:30:50 +0200 Subject: [PATCH 049/235] fix info --- Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 index e35f9c418..2d8ed33ac 100644 --- a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 @@ -81,7 +81,7 @@ function GenerateDocsSite { } $arguments = @("init","--output ""$docfxpath""","--loglevel $loglevel","--targetpackages ""$($apps -join '","')""") - Write-Host "aldoc init $arguments" + Write-Host "invoke aldoc $arguments" CmdDo -command $aldocPath -arguments $arguments $allFiles = @(get-childitem -path "$docfxPath/*" -Recurse -File | ForEach-Object { $_.FullName }) @@ -110,7 +110,7 @@ function GenerateDocsSite { $apps | ForEach-Object { $arguments = @("build","--output ""$docfxpath""","--loglevel $loglevel","--source ""$_""") - Write-Host "aldoc build $arguments" + Write-Host "invoke aldoc $arguments" CmdDo -command $aldocPath -arguments $arguments $allFiles = @(get-childitem -path "$docfxPath/*" -Recurse -File | ForEach-Object { $_.FullName }) From e43c1a3e4dd741285c6004a84fd8365bc8534aa0 Mon Sep 17 00:00:00 2001 From: freddydk Date: Thu, 5 Oct 2023 10:03:51 +0200 Subject: [PATCH 050/235] fix --- .../BuildALDoc/BuildALDoc.HelperFunctions.ps1 | 53 ++++++++++--------- 1 file changed, 28 insertions(+), 25 deletions(-) diff --git a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 index 2d8ed33ac..bfa0124dc 100644 --- a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 @@ -1,4 +1,28 @@ -function DownloadAlDoc { +function RunningOnLinux { + $isPsCore = $PSVersionTable.PSVersion -ge "6.0.0" + return ($isPsCore -and $isLinux) +} + +function FixBackslashes { + Param( + [string] $docfxPath + ) + + if (-not (RunningOnLinux)) { + return + } + $allFiles = @(get-childitem -path "$docfxPath/*" -Recurse -File | ForEach-Object { $_.FullName }) + $allFiles | Where-Object { $_.Contains('\') } | ForEach-Object { + $newName = $_.Replace('\','/') + $folder = Split-Path -Path $newName -Parent + if (-not (Test-Path $folder -PathType Container)) { + New-Item -Path $folder -ItemType Directory | Out-Null + } + & cp $_ $newName + & rm $_ + } +} +function DownloadAlDoc { if ("$ENV:aldocPath" -eq "") { $artifactUrl = Get-BCArtifactUrl -storageAccount bcinsider -type sandbox -country core -select Latest -accept_insiderEula $folder = Download-Artifacts $artifactUrl @@ -6,8 +30,7 @@ $tempFolder = Join-Path ([System.IO.Path]::GetTempPath()) ([Guid]::NewGuid().ToString()) New-Item -Path $tempFolder -ItemType Directory | Out-Null Expand-Archive -Path $alLanguageVsix -DestinationPath $tempFolder -Force - $isPsCore = $PSVersionTable.PSVersion -ge "6.0.0" - if ($isPsCore -and $isLinux) { + if (RunningOnLinux) { $ENV:aldocPath = Join-Path $tempFolder 'extension/bin/linux/aldoc' & /usr/bin/env sudo pwsh -command "& chmod +x $ENV:aldocPath" } @@ -83,17 +106,7 @@ function GenerateDocsSite { $arguments = @("init","--output ""$docfxpath""","--loglevel $loglevel","--targetpackages ""$($apps -join '","')""") Write-Host "invoke aldoc $arguments" CmdDo -command $aldocPath -arguments $arguments - - $allFiles = @(get-childitem -path "$docfxPath/*" -Recurse -File | ForEach-Object { $_.FullName }) - $allFiles | Where-Object { $_.Contains('\') } | ForEach-Object { - $newName = $_.Replace('\','/') - $folder = Split-Path -Path $newName -Parent - if (-not (Test-Path $folder -PathType Container)) { - New-Item -Path $folder -ItemType Directory | Out-Null - } - & cp $_ $newName - & rm $_ - } + FixBackslashes -docfxPath $docfxPath # Update docfx.json Write-Host "Update docfx.json" @@ -112,17 +125,7 @@ function GenerateDocsSite { $arguments = @("build","--output ""$docfxpath""","--loglevel $loglevel","--source ""$_""") Write-Host "invoke aldoc $arguments" CmdDo -command $aldocPath -arguments $arguments - - $allFiles = @(get-childitem -path "$docfxPath/*" -Recurse -File | ForEach-Object { $_.FullName }) - $allFiles | Where-Object { $_.Contains('\') } | ForEach-Object { - $newName = $_.Replace('\','/') - $folder = Split-Path -Path $newName -Parent - if (-not (Test-Path $folder -PathType Container)) { - New-Item -Path $folder -ItemType Directory | Out-Null - } - & cp $_ $newName - & rm $_ - } + FixBackslashes -docfxPath $docfxPath } # Set release notes From 312d914a1c9de6bb96dd1ebdc79240218ec1c4f0 Mon Sep 17 00:00:00 2001 From: freddydk Date: Thu, 5 Oct 2023 11:03:30 +0200 Subject: [PATCH 051/235] add settings --- Actions/AL-Go-Helper.ps1 | 2 ++ .../DetermineDeploymentEnvironments.ps1 | 6 ++++++ Actions/DetermineDeploymentEnvironments/README.md | 2 ++ Actions/DetermineDeploymentEnvironments/action.yaml | 6 ++++++ Templates/Per Tenant Extension/.github/workflows/CICD.yaml | 6 +++++- Tests/DetermineDeploymentEnvironments.Test.ps1 | 2 ++ 6 files changed, 23 insertions(+), 1 deletion(-) diff --git a/Actions/AL-Go-Helper.ps1 b/Actions/AL-Go-Helper.ps1 index 417080b33..98e0b898d 100644 --- a/Actions/AL-Go-Helper.ps1 +++ b/Actions/AL-Go-Helper.ps1 @@ -622,6 +622,8 @@ function ReadSettings { "PullRequestTrigger" = "pull_request_target" "fullBuildPatterns" = @() "excludeEnvironments" = @() + "generateALDocArtifact" = $false + "deployALDocArtifact" = $false } # Read settings from files and merge them into the settings object diff --git a/Actions/DetermineDeploymentEnvironments/DetermineDeploymentEnvironments.ps1 b/Actions/DetermineDeploymentEnvironments/DetermineDeploymentEnvironments.ps1 index 0779d8417..db28b6ef1 100644 --- a/Actions/DetermineDeploymentEnvironments/DetermineDeploymentEnvironments.ps1 +++ b/Actions/DetermineDeploymentEnvironments/DetermineDeploymentEnvironments.ps1 @@ -184,3 +184,9 @@ Write-Host "EnvironmentCount=$($deploymentEnvironments.Keys.Count)" Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "UnknownEnvironment=$unknownEnvironment" Write-Host "UnknownEnvironment=$unknownEnvironment" + +Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "GenerateALDocArtifact=$([int]$settings.generateALDocArtifact)" +Write-Host "GenerateALDocArtifact=$([int]$settings.generateALDocArtifact)" + +Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "DeployALDocArtifact=$([int]$settings.deployALDocArtifact)" +Write-Host "DeployALDocArtifact=$([int]$settings.deployALDocArtifact)" diff --git a/Actions/DetermineDeploymentEnvironments/README.md b/Actions/DetermineDeploymentEnvironments/README.md index 154556b0a..3216c571f 100644 --- a/Actions/DetermineDeploymentEnvironments/README.md +++ b/Actions/DetermineDeploymentEnvironments/README.md @@ -21,5 +21,7 @@ Determines the environments to be used for a build or a publish | DeploymentEnvironmentsJson | Deployment Environments with settings in compressed JSON format | | EnvironmentCount | Number of Deployment Environments | | UnknownEnvironment | Flag determining whether we try to publish to an unknown environment (invoke device code flow) | +| GenerateALDocArtifact | Flag determining whether to generate the ALDoc artifact | +| DeployALDocArtifact | Flag determining whether to deploy the ALDoc artifact to GitHub Pages | ### ENV variables diff --git a/Actions/DetermineDeploymentEnvironments/action.yaml b/Actions/DetermineDeploymentEnvironments/action.yaml index 202df8e58..6cfecd0c7 100644 --- a/Actions/DetermineDeploymentEnvironments/action.yaml +++ b/Actions/DetermineDeploymentEnvironments/action.yaml @@ -24,6 +24,12 @@ outputs: UnknownEnvironment: description: Flag determining whether the environment is unknown value: ${{ steps.determineDeploymentEnvironments.outputs.UnknownEnvironment }} + GenerateALDocArtifact: + description: Flag determining whether to generate the ALDoc artifact + value: ${{ steps.determineDeploymentEnvironments.outputs.GenerateALDocArtifact }} + DeployALDocArtifact: + description: Flag determining whether to deploy the ALDoc artifact to GitHub Pages + value: ${{ steps.determineDeploymentEnvironments.outputs.DeployALDocArtifact }} runs: using: composite steps: diff --git a/Templates/Per Tenant Extension/.github/workflows/CICD.yaml b/Templates/Per Tenant Extension/.github/workflows/CICD.yaml index 56fe477e2..f3d0a3593 100644 --- a/Templates/Per Tenant Extension/.github/workflows/CICD.yaml +++ b/Templates/Per Tenant Extension/.github/workflows/CICD.yaml @@ -30,6 +30,8 @@ jobs: environmentsMatrixJson: ${{ steps.DetermineDeploymentEnvironments.outputs.EnvironmentsMatrixJson }} environmentCount: ${{ steps.DetermineDeploymentEnvironments.outputs.EnvironmentCount }} deploymentEnvironmentsJson: ${{ steps.DetermineDeploymentEnvironments.outputs.DeploymentEnvironmentsJson }} + generateALDocArtifact: ${{ steps.DetermineDeploymentEnvironments.outputs.GenerateALDocArtifact }} + deployALDocArtifact: ${{ steps.DetermineDeploymentEnvironments.outputs.DeployALDocArtifact }} deliveryTargetsJson: ${{ steps.DetermineDeliveryTargets.outputs.DeliveryTargetsJson }} githubRunner: ${{ steps.ReadSettings.outputs.GitHubRunnerJson }} githubRunnerShell: ${{ steps.ReadSettings.outputs.GitHubRunnerShell }} @@ -151,7 +153,7 @@ jobs: DeployALDoc: needs: [ Initialization, Build ] - if: always() && needs.Build.result == 'Success' + if: always() && needs.Build.result == 'Success' && needs.Initialization.outputs.generateALDocArtifact == 'true' runs-on: ubuntu-latest name: Deploy ALDoc Documentation environment: @@ -172,6 +174,7 @@ jobs: shell: powershell - name: Setup Pages + if: needs.Initialization.outputs.deployALDocArtifact == 'true' uses: actions/configure-pages@v3 - name: Build ALDoc Documentation @@ -183,6 +186,7 @@ jobs: uses: actions/upload-pages-artifact@v2 - name: Deploy to GitHub Pages + if: needs.Initialization.outputs.deployALDocArtifact == 'true' id: deployment uses: actions/deploy-pages@v2 diff --git a/Tests/DetermineDeploymentEnvironments.Test.ps1 b/Tests/DetermineDeploymentEnvironments.Test.ps1 index 071b821f0..5083732d9 100644 --- a/Tests/DetermineDeploymentEnvironments.Test.ps1 +++ b/Tests/DetermineDeploymentEnvironments.Test.ps1 @@ -44,6 +44,8 @@ Describe "DetermineDeploymentEnvironments Action Test" { "DeploymentEnvironmentsJson" = "Deployment Environments with settings in compressed JSON format" "EnvironmentCount" = "Number of Deployment Environments" "UnknownEnvironment" = "Flag determining whether the environment is unknown" + "GenerateALDocArtifact" = "Flag determining whether to generate the ALDoc artifact" + "DeployALDocArtifact" = "Flag determining whether to deploy the ALDoc artifact to GitHub Pages" } YamlTest -scriptRoot $scriptRoot -actionName $actionName -actionScript $actionScript -permissions $permissions -outputs $outputs } From fe456bf1311a3fb479a7d0a59ee875d84bdebc7c Mon Sep 17 00:00:00 2001 From: freddydk Date: Thu, 5 Oct 2023 11:32:21 +0200 Subject: [PATCH 052/235] or --- .../DetermineDeploymentEnvironments.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Actions/DetermineDeploymentEnvironments/DetermineDeploymentEnvironments.ps1 b/Actions/DetermineDeploymentEnvironments/DetermineDeploymentEnvironments.ps1 index db28b6ef1..e193e4590 100644 --- a/Actions/DetermineDeploymentEnvironments/DetermineDeploymentEnvironments.ps1 +++ b/Actions/DetermineDeploymentEnvironments/DetermineDeploymentEnvironments.ps1 @@ -186,7 +186,7 @@ Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "UnknownEnvironment=$ Write-Host "UnknownEnvironment=$unknownEnvironment" Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "GenerateALDocArtifact=$([int]$settings.generateALDocArtifact)" -Write-Host "GenerateALDocArtifact=$([int]$settings.generateALDocArtifact)" +Write-Host "GenerateALDocArtifact=$([int]($settings.generateALDocArtifact -or $settings.deployALDocArtifact))" Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "DeployALDocArtifact=$([int]$settings.deployALDocArtifact)" Write-Host "DeployALDocArtifact=$([int]$settings.deployALDocArtifact)" From 5aed8f8cb6668752da7dc5b1a72a511658cd6a7c Mon Sep 17 00:00:00 2001 From: freddydk Date: Thu, 5 Oct 2023 11:55:19 +0200 Subject: [PATCH 053/235] 1 --- Templates/Per Tenant Extension/.github/workflows/CICD.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Templates/Per Tenant Extension/.github/workflows/CICD.yaml b/Templates/Per Tenant Extension/.github/workflows/CICD.yaml index f3d0a3593..20b56524f 100644 --- a/Templates/Per Tenant Extension/.github/workflows/CICD.yaml +++ b/Templates/Per Tenant Extension/.github/workflows/CICD.yaml @@ -153,7 +153,7 @@ jobs: DeployALDoc: needs: [ Initialization, Build ] - if: always() && needs.Build.result == 'Success' && needs.Initialization.outputs.generateALDocArtifact == 'true' + if: always() && needs.Build.result == 'Success' && needs.Initialization.outputs.generateALDocArtifact == 1 runs-on: ubuntu-latest name: Deploy ALDoc Documentation environment: @@ -174,7 +174,7 @@ jobs: shell: powershell - name: Setup Pages - if: needs.Initialization.outputs.deployALDocArtifact == 'true' + if: needs.Initialization.outputs.deployALDocArtifact == 1 uses: actions/configure-pages@v3 - name: Build ALDoc Documentation @@ -186,7 +186,7 @@ jobs: uses: actions/upload-pages-artifact@v2 - name: Deploy to GitHub Pages - if: needs.Initialization.outputs.deployALDocArtifact == 'true' + if: needs.Initialization.outputs.deployALDocArtifact == 1 id: deployment uses: actions/deploy-pages@v2 From 770f5a8c297dbf26b78fd5ca444c8bec87fdd013 Mon Sep 17 00:00:00 2001 From: freddydk Date: Thu, 5 Oct 2023 12:08:07 +0200 Subject: [PATCH 054/235] or2 --- .../DetermineDeploymentEnvironments.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Actions/DetermineDeploymentEnvironments/DetermineDeploymentEnvironments.ps1 b/Actions/DetermineDeploymentEnvironments/DetermineDeploymentEnvironments.ps1 index e193e4590..bf71e2ae9 100644 --- a/Actions/DetermineDeploymentEnvironments/DetermineDeploymentEnvironments.ps1 +++ b/Actions/DetermineDeploymentEnvironments/DetermineDeploymentEnvironments.ps1 @@ -185,7 +185,7 @@ Write-Host "EnvironmentCount=$($deploymentEnvironments.Keys.Count)" Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "UnknownEnvironment=$unknownEnvironment" Write-Host "UnknownEnvironment=$unknownEnvironment" -Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "GenerateALDocArtifact=$([int]$settings.generateALDocArtifact)" +Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "GenerateALDocArtifact=$([int]($settings.generateALDocArtifact -or $settings.deployALDocArtifact))" Write-Host "GenerateALDocArtifact=$([int]($settings.generateALDocArtifact -or $settings.deployALDocArtifact))" Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "DeployALDocArtifact=$([int]$settings.deployALDocArtifact)" From 3404182eedca4c04c7030902a75db67dfeabc7da Mon Sep 17 00:00:00 2001 From: freddydk Date: Thu, 5 Oct 2023 12:09:41 +0200 Subject: [PATCH 055/235] default windows --- Templates/Per Tenant Extension/.github/workflows/CICD.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Templates/Per Tenant Extension/.github/workflows/CICD.yaml b/Templates/Per Tenant Extension/.github/workflows/CICD.yaml index 20b56524f..a608e11a5 100644 --- a/Templates/Per Tenant Extension/.github/workflows/CICD.yaml +++ b/Templates/Per Tenant Extension/.github/workflows/CICD.yaml @@ -154,7 +154,7 @@ jobs: DeployALDoc: needs: [ Initialization, Build ] if: always() && needs.Build.result == 'Success' && needs.Initialization.outputs.generateALDocArtifact == 1 - runs-on: ubuntu-latest + runs-on: windows-latest name: Deploy ALDoc Documentation environment: name: github-pages From 57f31832b4096ab55a153d793d77d007e309a291 Mon Sep 17 00:00:00 2001 From: freddydk Date: Thu, 5 Oct 2023 13:35:17 +0200 Subject: [PATCH 056/235] test obj --- Actions/BuildALDoc/BuildALDoc.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Actions/BuildALDoc/BuildALDoc.ps1 b/Actions/BuildALDoc/BuildALDoc.ps1 index 5b63f6175..46de39fdb 100644 --- a/Actions/BuildALDoc/BuildALDoc.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.ps1 @@ -13,7 +13,7 @@ $artifactsFolder = Join-Path $ENV:GITHUB_WORKSPACE ".artifacts" $releases = @() if ($maxReleases -gt 0) { - $releases = GetReleases -token $token -api_url $ENV:GITHUB_API_URL -repository $ENV:GITHUB_REPOSITORY | Where-Object { -not ($_.prerelease -or $_.draft) } | Select-Object -First $maxReleases + $releases = GetReleases -token $token -api_url $ENV:GITHUB_API_URL -repository $ENV:GITHUB_REPOSITORY | Where-Object { $_ -and (-not ($_.prerelease -or $_.draft)) } | Select-Object -First $maxReleases } $docsPath = Join-Path $ENV:GITHUB_WORKSPACE ".aldoc" From a9ac64df8e509d5ab2f4428c262b8f3e10638b2c Mon Sep 17 00:00:00 2001 From: freddydk Date: Thu, 5 Oct 2023 14:22:20 +0200 Subject: [PATCH 057/235] dump releases --- Actions/BuildALDoc/BuildALDoc.ps1 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Actions/BuildALDoc/BuildALDoc.ps1 b/Actions/BuildALDoc/BuildALDoc.ps1 index 46de39fdb..abe7d0d7f 100644 --- a/Actions/BuildALDoc/BuildALDoc.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.ps1 @@ -13,14 +13,15 @@ $artifactsFolder = Join-Path $ENV:GITHUB_WORKSPACE ".artifacts" $releases = @() if ($maxReleases -gt 0) { - $releases = GetReleases -token $token -api_url $ENV:GITHUB_API_URL -repository $ENV:GITHUB_REPOSITORY | Where-Object { $_ -and (-not ($_.prerelease -or $_.draft)) } | Select-Object -First $maxReleases + $releases = GetReleases -token $token -api_url $ENV:GITHUB_API_URL -repository $ENV:GITHUB_REPOSITORY | Where-Object { $_ } | Where-Object { -not ($_.prerelease -or $_.draft) } | Select-Object -First $maxReleases + $releases | Out-Host } $docsPath = Join-Path $ENV:GITHUB_WORKSPACE ".aldoc" New-Item $docsPath -ItemType Directory | Out-Null $loglevel = 'Info' -$versions = @($releases.Name) +$versions = @($releases | ForEach-Object { $_.Name }) foreach($release in $releases) { $tempFolder = Join-Path ([System.IO.Path]::GetTempPath()) ([Guid]::NewGuid().ToString()) From 76a20be1cdbf9e99c0d9819cd9dc327e3c0d0e14 Mon Sep 17 00:00:00 2001 From: freddydk Date: Thu, 5 Oct 2023 14:24:02 +0200 Subject: [PATCH 058/235] x --- Templates/Per Tenant Extension/.github/workflows/CICD.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Templates/Per Tenant Extension/.github/workflows/CICD.yaml b/Templates/Per Tenant Extension/.github/workflows/CICD.yaml index a608e11a5..ea06cf762 100644 --- a/Templates/Per Tenant Extension/.github/workflows/CICD.yaml +++ b/Templates/Per Tenant Extension/.github/workflows/CICD.yaml @@ -184,6 +184,8 @@ jobs: - name: Upload pages artifact uses: actions/upload-pages-artifact@v2 + with: + path: .aldoc - name: Deploy to GitHub Pages if: needs.Initialization.outputs.deployALDocArtifact == 1 From 3719f4e62654415e844fae018b5d2a01e90b5ae3 Mon Sep 17 00:00:00 2001 From: freddydk Date: Thu, 5 Oct 2023 14:25:08 +0200 Subject: [PATCH 059/235] permissions --- Templates/Per Tenant Extension/.github/workflows/CICD.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Templates/Per Tenant Extension/.github/workflows/CICD.yaml b/Templates/Per Tenant Extension/.github/workflows/CICD.yaml index ea06cf762..9f85da499 100644 --- a/Templates/Per Tenant Extension/.github/workflows/CICD.yaml +++ b/Templates/Per Tenant Extension/.github/workflows/CICD.yaml @@ -16,6 +16,8 @@ defaults: permissions: contents: read actions: read + pages: write + id-token: write env: workflowDepth: 1 From e910f44e94b4a68f0f6475cfe0e20a62e9f16a79 Mon Sep 17 00:00:00 2001 From: freddydk Date: Thu, 5 Oct 2023 14:25:56 +0200 Subject: [PATCH 060/235] path --- Templates/Per Tenant Extension/.github/workflows/CICD.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Templates/Per Tenant Extension/.github/workflows/CICD.yaml b/Templates/Per Tenant Extension/.github/workflows/CICD.yaml index 9f85da499..260e2e054 100644 --- a/Templates/Per Tenant Extension/.github/workflows/CICD.yaml +++ b/Templates/Per Tenant Extension/.github/workflows/CICD.yaml @@ -187,7 +187,7 @@ jobs: - name: Upload pages artifact uses: actions/upload-pages-artifact@v2 with: - path: .aldoc + path: ".aldoc/_site/" - name: Deploy to GitHub Pages if: needs.Initialization.outputs.deployALDocArtifact == 1 From 8a172dd246aab39dc16c6464e2f43fd5d6054836 Mon Sep 17 00:00:00 2001 From: freddydk Date: Thu, 5 Oct 2023 14:48:48 +0200 Subject: [PATCH 061/235] zip --- Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 index bfa0124dc..e23aee874 100644 --- a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 @@ -28,8 +28,10 @@ function DownloadAlDoc { $folder = Download-Artifacts $artifactUrl $alLanguageVsix = Join-Path $folder '*.vsix' -Resolve $tempFolder = Join-Path ([System.IO.Path]::GetTempPath()) ([Guid]::NewGuid().ToString()) + Copy-Item -Path $alLanguageVsix -Destination "$($tempFolder).zip" New-Item -Path $tempFolder -ItemType Directory | Out-Null - Expand-Archive -Path $alLanguageVsix -DestinationPath $tempFolder -Force + Expand-Archive -Path "$($tempFolder).zip" -DestinationPath $tempFolder -Force + Remove-Item -Path "$($tempFolder).zip" -Force if (RunningOnLinux) { $ENV:aldocPath = Join-Path $tempFolder 'extension/bin/linux/aldoc' & /usr/bin/env sudo pwsh -command "& chmod +x $ENV:aldocPath" From 2a0a49058a14eb41b21ef70ab2c4374552edbbbf Mon Sep 17 00:00:00 2001 From: freddydk Date: Thu, 5 Oct 2023 21:41:29 +0200 Subject: [PATCH 062/235] add failure --- Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 | 9 ++++++--- .../Per Tenant Extension/.github/workflows/CICD.yaml | 5 +++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 index e23aee874..118980c51 100644 --- a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 @@ -81,9 +81,12 @@ function GenerateDocsSite { try { $apps = @() # Generate new toc.yml and calculate apps - releases and projects - $newTocYml = @('items:',' - name: Releases',' items:',' - name: main',' href: /') - foreach($ver in $allVersions) { - $newTocYml += @(" - name: $ver"," href: releases/$ver") + $newTocYml = @('items:') + if ($allVersions.Count -gt 0) { + $newTocYml += @(' - name: Releases',' items:',' - name: main',' href: index.html') + foreach($ver in $allVersions) { + $newTocYml += @(" - name: $ver"," href: releases/$ver") + } } if ($allApps.Keys.Count -eq 1 -and $allApps.Keys[0] -eq '.') { # Single prokect repo diff --git a/Templates/Per Tenant Extension/.github/workflows/CICD.yaml b/Templates/Per Tenant Extension/.github/workflows/CICD.yaml index 260e2e054..f962b9be8 100644 --- a/Templates/Per Tenant Extension/.github/workflows/CICD.yaml +++ b/Templates/Per Tenant Extension/.github/workflows/CICD.yaml @@ -194,6 +194,11 @@ jobs: id: deployment uses: actions/deploy-pages@v2 + - name: fail + run: | + $erroractionpreference = "Stop" + throw "FAIL" + Deploy: needs: [ Initialization, Build ] if: always() && needs.Build.result == 'Success' && needs.Initialization.outputs.environmentCount > 0 From 50992bfc635a2821f390c56654206191dc7f4268 Mon Sep 17 00:00:00 2001 From: freddydk Date: Thu, 5 Oct 2023 21:54:23 +0200 Subject: [PATCH 063/235] downloadandbuild --- Actions/BuildALDoc/BuildALDoc.ps1 | 38 +++++++++++++++++++++++++------ Actions/Github-Helper.psm1 | 5 ++-- 2 files changed, 34 insertions(+), 9 deletions(-) diff --git a/Actions/BuildALDoc/BuildALDoc.ps1 b/Actions/BuildALDoc/BuildALDoc.ps1 index abe7d0d7f..ba87c56ed 100644 --- a/Actions/BuildALDoc/BuildALDoc.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.ps1 @@ -59,11 +59,35 @@ foreach($version in $versions) { Move-Item -Path (join-Path $docsPath $version) -Destination $releasesPath } -Write-Host "main:" -Get-ChildItem -Path $artifactsFolder -Recurse -File | ForEach-Object { Write-Host "- $($_.FullName.Substring($artifactsFolder.Length))" } -$allApps,$allDependencies = CalculateProjectsAndApps -tempFolder $artifactsFolder -projects $projects -refname $ENV:GITHUB_REF_NAME -$version = 'main' -$header = "Documentation for $ENV:GITHUB_REPOSITORY" -$releaseNotes = "Documentation for current branch" -GenerateDocsSite -version $version -allVersions $versions -allApps $allApps -releaseNotes $releaseNotes -header $header -docsPath $docsPath -logLevel $logLevel +$dependeciesProbingPaths = @(@{ + "release_status" = "thisbuild" + "version" = "latest" + "buildMode" = 'default' + "projects" = $projects + "repo" = "$ENV:GITHUB_SERVER_URL/$ENV:GITHUB_REPOSITORY" + "branch" = $ENV:GITHUB_REF_NAME + "baseBranch" = $ENV:GITHUB_REF_NAME + "authTokenSecret" = $token +}) +$tempFolder = Join-Path ([System.IO.Path]::GetTempPath()) ([Guid]::NewGuid().ToString()) +New-Item -Path $tempFolder -ItemType Directory | Out-Null +try { + $allApps = GetDependencies -probingPathsJson $dependeciesProbingPaths -saveToPath $tempFolder -masks @('Apps') + $allDependencies = GetDependencies -probingPathsJson $dependeciesProbingPaths -saveToPath $tempFolder -masks @('Dependencies') + $version = 'main' + $header = "Documentation for $ENV:GITHUB_REPOSITORY" + $releaseNotes = "Documentation for current branch" + GenerateDocsSite -version $version -allVersions $versions -allApps $allApps -releaseNotes $releaseNotes -header $header -docsPath $docsPath -logLevel $logLevel +} +finally { + Remove-Item -Path $tempFolder -Recurse -Force +} + +#Write-Host "main:" +#Get-ChildItem -Path $artifactsFolder -Recurse -File | ForEach-Object { Write-Host "- $($_.FullName.Substring($artifactsFolder.Length))" } +#$allApps,$allDependencies = CalculateProjectsAndApps -tempFolder $artifactsFolder -projects $projects -refname $ENV:GITHUB_REF_NAME +#$version = 'main' +#$header = "Documentation for $ENV:GITHUB_REPOSITORY" +#$releaseNotes = "Documentation for current branch" +#GenerateDocsSite -version $version -allVersions $versions -allApps $allApps -releaseNotes $releaseNotes -header $header -docsPath $docsPath -logLevel $logLevel diff --git a/Actions/Github-Helper.psm1 b/Actions/Github-Helper.psm1 index 03ca7a48e..ac0950163 100644 --- a/Actions/Github-Helper.psm1 +++ b/Actions/Github-Helper.psm1 @@ -123,7 +123,8 @@ function GetDependencies { Param( $probingPathsJson, [string] $api_url = $ENV:GITHUB_API_URL, - [string] $saveToPath = (Join-Path $ENV:GITHUB_WORKSPACE ".dependencies") + [string] $saveToPath = (Join-Path $ENV:GITHUB_WORKSPACE ".dependencies"), + [string[]] $masks = @('Apps','TestApps') ) if (!(Test-Path $saveToPath)) { @@ -131,7 +132,7 @@ function GetDependencies { } $downloadedList = @() - foreach($mask in 'Apps','TestApps') { + foreach($mask in $masks) { foreach($dependency in $probingPathsJson) { $projects = $dependency.projects $buildMode = $dependency.buildMode From 98d15e419763c0144787ad0f9c0bc854a01477ef Mon Sep 17 00:00:00 2001 From: freddydk Date: Thu, 5 Oct 2023 21:56:19 +0200 Subject: [PATCH 064/235] thisbuild --- Templates/Per Tenant Extension/.github/workflows/CICD.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Templates/Per Tenant Extension/.github/workflows/CICD.yaml b/Templates/Per Tenant Extension/.github/workflows/CICD.yaml index f962b9be8..6a809952d 100644 --- a/Templates/Per Tenant Extension/.github/workflows/CICD.yaml +++ b/Templates/Per Tenant Extension/.github/workflows/CICD.yaml @@ -148,7 +148,7 @@ jobs: buildMode: ${{ matrix.buildMode }} projectDependenciesJson: ${{ needs.Initialization.outputs.projectDependenciesJson }} secrets: 'licenseFileUrl,codeSignCertificateUrl,*codeSignCertificatePassword,keyVaultCertificateUrl,*keyVaultCertificatePassword,keyVaultClientId,gitHubPackagesContext,applicationInsightsConnectionString' - publishThisBuildArtifacts: ${{ needs.Initialization.outputs.workflowDepth > 1 }} + publishThisBuildArtifacts: true publishArtifacts: ${{ github.ref_name == 'main' || startswith(github.ref_name, 'release/') || needs.Initialization.outputs.deliveryTargetsJson != '[]' || needs.Initialization.outputs.environmentCount > 0 }} signArtifacts: true useArtifactCache: true From 1a3c0d07c57e43bdcaec5e28fe82b9b395d23112 Mon Sep 17 00:00:00 2001 From: freddydk Date: Fri, 6 Oct 2023 05:48:00 +0200 Subject: [PATCH 065/235] depth 1 --- .../BuildALDoc/BuildALDoc.HelperFunctions.ps1 | 2 +- Actions/BuildALDoc/BuildALDoc.ps1 | 39 ++++--------------- 2 files changed, 9 insertions(+), 32 deletions(-) diff --git a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 index 118980c51..081a7dc6b 100644 --- a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 @@ -166,7 +166,7 @@ function CalculateProjectsAndApps { $project = $Matches[1] if ($projectList | Where-Object { $project -like $_ }) { $allApps."$project" = @() - Get-ChildItem -Path $_.FullName -Filter '*.app' -Recurse | ForEach-Object { + Get-ChildItem -Path $_.FullName -Filter '*.app' | ForEach-Object { $allApps."$project" += @($_.FullName) } } diff --git a/Actions/BuildALDoc/BuildALDoc.ps1 b/Actions/BuildALDoc/BuildALDoc.ps1 index ba87c56ed..b2758fb53 100644 --- a/Actions/BuildALDoc/BuildALDoc.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.ps1 @@ -14,7 +14,6 @@ $artifactsFolder = Join-Path $ENV:GITHUB_WORKSPACE ".artifacts" $releases = @() if ($maxReleases -gt 0) { $releases = GetReleases -token $token -api_url $ENV:GITHUB_API_URL -repository $ENV:GITHUB_REPOSITORY | Where-Object { $_ } | Where-Object { -not ($_.prerelease -or $_.draft) } | Select-Object -First $maxReleases - $releases | Out-Host } $docsPath = Join-Path $ENV:GITHUB_WORKSPACE ".aldoc" @@ -59,35 +58,13 @@ foreach($version in $versions) { Move-Item -Path (join-Path $docsPath $version) -Destination $releasesPath } +Write-Host "main:" + -$dependeciesProbingPaths = @(@{ - "release_status" = "thisbuild" - "version" = "latest" - "buildMode" = 'default' - "projects" = $projects - "repo" = "$ENV:GITHUB_SERVER_URL/$ENV:GITHUB_REPOSITORY" - "branch" = $ENV:GITHUB_REF_NAME - "baseBranch" = $ENV:GITHUB_REF_NAME - "authTokenSecret" = $token -}) -$tempFolder = Join-Path ([System.IO.Path]::GetTempPath()) ([Guid]::NewGuid().ToString()) -New-Item -Path $tempFolder -ItemType Directory | Out-Null -try { - $allApps = GetDependencies -probingPathsJson $dependeciesProbingPaths -saveToPath $tempFolder -masks @('Apps') - $allDependencies = GetDependencies -probingPathsJson $dependeciesProbingPaths -saveToPath $tempFolder -masks @('Dependencies') - $version = 'main' - $header = "Documentation for $ENV:GITHUB_REPOSITORY" - $releaseNotes = "Documentation for current branch" - GenerateDocsSite -version $version -allVersions $versions -allApps $allApps -releaseNotes $releaseNotes -header $header -docsPath $docsPath -logLevel $logLevel -} -finally { - Remove-Item -Path $tempFolder -Recurse -Force -} -#Write-Host "main:" -#Get-ChildItem -Path $artifactsFolder -Recurse -File | ForEach-Object { Write-Host "- $($_.FullName.Substring($artifactsFolder.Length))" } -#$allApps,$allDependencies = CalculateProjectsAndApps -tempFolder $artifactsFolder -projects $projects -refname $ENV:GITHUB_REF_NAME -#$version = 'main' -#$header = "Documentation for $ENV:GITHUB_REPOSITORY" -#$releaseNotes = "Documentation for current branch" -#GenerateDocsSite -version $version -allVersions $versions -allApps $allApps -releaseNotes $releaseNotes -header $header -docsPath $docsPath -logLevel $logLevel +Get-ChildItem -Path $artifactsFolder -Depth 1 -File | ForEach-Object { Write-Host "- $($_.FullName.Substring($artifactsFolder.Length))" } +$allApps,$allDependencies = CalculateProjectsAndApps -tempFolder $artifactsFolder -projects $projects -refname $ENV:GITHUB_REF_NAME +$version = 'main' +$header = "Documentation for $ENV:GITHUB_REPOSITORY" +$releaseNotes = "Documentation for current branch" +GenerateDocsSite -version $version -allVersions $versions -allApps $allApps -releaseNotes $releaseNotes -header $header -docsPath $docsPath -logLevel $logLevel From 6b59a77b93ab9a753b2643b45d2d8b58215baf7c Mon Sep 17 00:00:00 2001 From: freddydk Date: Fri, 6 Oct 2023 06:38:09 +0200 Subject: [PATCH 066/235] .. --- Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 | 8 ++++++-- Actions/BuildALDoc/BuildALDoc.ps1 | 9 ++------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 index 081a7dc6b..242b2c051 100644 --- a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 @@ -81,11 +81,15 @@ function GenerateDocsSite { try { $apps = @() # Generate new toc.yml and calculate apps - releases and projects + $prefix = '' + if ($version) { + $prefix = "../../" + } $newTocYml = @('items:') if ($allVersions.Count -gt 0) { - $newTocYml += @(' - name: Releases',' items:',' - name: main',' href: index.html') + $newTocYml += @(" - name: Releases"," items:"," - name: main"," href: $($prefix)index.html") foreach($ver in $allVersions) { - $newTocYml += @(" - name: $ver"," href: releases/$ver") + $newTocYml += @(" - name: $ver"," href: $($prefix)releases/$ver/index.html") } } if ($allApps.Keys.Count -eq 1 -and $allApps.Keys[0] -eq '.') { diff --git a/Actions/BuildALDoc/BuildALDoc.ps1 b/Actions/BuildALDoc/BuildALDoc.ps1 index b2758fb53..d924a5a9f 100644 --- a/Actions/BuildALDoc/BuildALDoc.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.ps1 @@ -29,7 +29,7 @@ foreach($release in $releases) { foreach($mask in 'Apps', 'Dependencies') { DownloadRelease -token $token -projects $projects -api_url $ENV:GITHUB_API_URL -repository $ENV:GITHUB_REPOSITORY -release $release -path $tempFolder -mask $mask -unpack } - Write-Host "$($release.Name):" + Write-Host "Version: $($release.Name):" Get-ChildItem -Path $tempFolder -Recurse -File | ForEach-Object { Write-Host "- $($_.FullName.Substring($tempFolder.Length+1))" } $allApps,$allDependencies = CalculateProjectsAndApps -tempFolder $tempFolder -projects $projects -refname $ENV:GITHUB_REF_NAME $version = $release.Name @@ -58,13 +58,8 @@ foreach($version in $versions) { Move-Item -Path (join-Path $docsPath $version) -Destination $releasesPath } -Write-Host "main:" - - - Get-ChildItem -Path $artifactsFolder -Depth 1 -File | ForEach-Object { Write-Host "- $($_.FullName.Substring($artifactsFolder.Length))" } $allApps,$allDependencies = CalculateProjectsAndApps -tempFolder $artifactsFolder -projects $projects -refname $ENV:GITHUB_REF_NAME -$version = 'main' $header = "Documentation for $ENV:GITHUB_REPOSITORY" $releaseNotes = "Documentation for current branch" -GenerateDocsSite -version $version -allVersions $versions -allApps $allApps -releaseNotes $releaseNotes -header $header -docsPath $docsPath -logLevel $logLevel +GenerateDocsSite -version '' -allVersions $versions -allApps $allApps -releaseNotes $releaseNotes -header $header -docsPath $docsPath -logLevel $logLevel From 6cbe653c934200a773c92304af17baff5f419b51 Mon Sep 17 00:00:00 2001 From: freddydk Date: Fri, 6 Oct 2023 07:49:12 +0200 Subject: [PATCH 067/235] releasenotes --- Actions/BuildALDoc/BuildALDoc.ps1 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Actions/BuildALDoc/BuildALDoc.ps1 b/Actions/BuildALDoc/BuildALDoc.ps1 index d924a5a9f..135737683 100644 --- a/Actions/BuildALDoc/BuildALDoc.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.ps1 @@ -21,6 +21,7 @@ New-Item $docsPath -ItemType Directory | Out-Null $loglevel = 'Info' $versions = @($releases | ForEach-Object { $_.Name }) +$latestReleaseTag = $releases | Select-Object -First 1 -ExpandProperty tag_name foreach($release in $releases) { $tempFolder = Join-Path ([System.IO.Path]::GetTempPath()) ([Guid]::NewGuid().ToString()) @@ -61,5 +62,6 @@ foreach($version in $versions) { Get-ChildItem -Path $artifactsFolder -Depth 1 -File | ForEach-Object { Write-Host "- $($_.FullName.Substring($artifactsFolder.Length))" } $allApps,$allDependencies = CalculateProjectsAndApps -tempFolder $artifactsFolder -projects $projects -refname $ENV:GITHUB_REF_NAME $header = "Documentation for $ENV:GITHUB_REPOSITORY" -$releaseNotes = "Documentation for current branch" +$releaseNotes = GetReleaseNotes -token $token -tag_name 'main' -previous_tag_name $latestReleaseTag -target_commitish $ENV:GITHUB_SHA | ConvertFrom-Json +$releaseNotes = $releaseNotes.body -replace '%','%25' -replace '\n','%0A' -replace '\r','%0D' # supports a multiline text GenerateDocsSite -version '' -allVersions $versions -allApps $allApps -releaseNotes $releaseNotes -header $header -docsPath $docsPath -logLevel $logLevel From c45db67de824f847a28ae3c283eba2bf1f3d8cff Mon Sep 17 00:00:00 2001 From: freddydk Date: Fri, 6 Oct 2023 08:05:45 +0200 Subject: [PATCH 068/235] vn --- Actions/BuildALDoc/BuildALDoc.ps1 | 4 +++- Actions/Github-Helper.psm1 | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Actions/BuildALDoc/BuildALDoc.ps1 b/Actions/BuildALDoc/BuildALDoc.ps1 index 135737683..c5f6c5773 100644 --- a/Actions/BuildALDoc/BuildALDoc.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.ps1 @@ -62,6 +62,8 @@ foreach($version in $versions) { Get-ChildItem -Path $artifactsFolder -Depth 1 -File | ForEach-Object { Write-Host "- $($_.FullName.Substring($artifactsFolder.Length))" } $allApps,$allDependencies = CalculateProjectsAndApps -tempFolder $artifactsFolder -projects $projects -refname $ENV:GITHUB_REF_NAME $header = "Documentation for $ENV:GITHUB_REPOSITORY" -$releaseNotes = GetReleaseNotes -token $token -tag_name 'main' -previous_tag_name $latestReleaseTag -target_commitish $ENV:GITHUB_SHA | ConvertFrom-Json +Write-Host "Latest release tag: $latestReleaseTag" +Write-Host "Commitish: $ENV:GITHUB_SHA" +$releaseNotes = GetReleaseNotes -token $token -tag_name 'vnext' -previous_tag_name $latestReleaseTag -target_commitish $ENV:GITHUB_SHA | ConvertFrom-Json $releaseNotes = $releaseNotes.body -replace '%','%25' -replace '\n','%0A' -replace '\r','%0D' # supports a multiline text GenerateDocsSite -version '' -allVersions $versions -allApps $allApps -releaseNotes $releaseNotes -header $header -docsPath $docsPath -logLevel $logLevel diff --git a/Actions/Github-Helper.psm1 b/Actions/Github-Helper.psm1 index ac0950163..8854a6e1a 100644 --- a/Actions/Github-Helper.psm1 +++ b/Actions/Github-Helper.psm1 @@ -582,7 +582,7 @@ function GetReleaseNotes { Write-Host "Generating release note $api_url/repos/$repository/releases/generate-notes" $postParams = @{ - tag_name = $tag_name; + tag_name = $tag_name } if ($previous_tag_name) { From 1a09ce3364919c855acc724e57ad0f4c660d5d8c Mon Sep 17 00:00:00 2001 From: freddydk Date: Fri, 6 Oct 2023 08:25:11 +0200 Subject: [PATCH 069/235] allow generate release notes --- Actions/BuildALDoc/BuildALDoc.ps1 | 5 +++-- Actions/BuildALDoc/action.yaml | 7 ++++--- Templates/Per Tenant Extension/.github/workflows/CICD.yaml | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Actions/BuildALDoc/BuildALDoc.ps1 b/Actions/BuildALDoc/BuildALDoc.ps1 index c5f6c5773..16575004a 100644 --- a/Actions/BuildALDoc/BuildALDoc.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.ps1 @@ -1,13 +1,14 @@ Param( [Parameter(HelpMessage = "The GitHub token running the action", Mandatory = $false)] - [string] $token + [string] $token, + [Parameter(HelpMessage = "Projects to include in the documentation", Mandatory = $false)] + [string] $projects = '*' ) . (Join-Path -Path $PSScriptRoot -ChildPath "..\AL-Go-Helper.ps1" -Resolve) . (Join-Path -Path $PSScriptRoot -ChildPath "BuildALDoc.HelperFunctions.ps1" -Resolve) DownloadAndImportBcContainerHelper -$projects = '*' $maxReleases = 2 $artifactsFolder = Join-Path $ENV:GITHUB_WORKSPACE ".artifacts" diff --git a/Actions/BuildALDoc/action.yaml b/Actions/BuildALDoc/action.yaml index ff6e9fa73..cdcfb3264 100644 --- a/Actions/BuildALDoc/action.yaml +++ b/Actions/BuildALDoc/action.yaml @@ -10,9 +10,9 @@ inputs: required: false default: ${{ github.token }} projects: - description: The GitHub token running the action + description: Projects to include in the documentation required: false - default: ${{ github.token }} + default: '*' runs: using: composite steps: @@ -21,10 +21,11 @@ runs: id: BuildALDoc env: _token: ${{ inputs.token }} + _projects: ${{ inputs.projects }} run: | $errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0 try { - ${{ github.action_path }}/BuildALDoc.ps1 -token $ENV:_token + ${{ github.action_path }}/BuildALDoc.ps1 -token $ENV:_token -projects $ENV:_projects } catch { Write-Host "::ERROR::Unexpected error when running action. Error Message: $($_.Exception.Message.Replace("`r",'').Replace("`n",' ')), StackTrace: $($_.ScriptStackTrace.Replace("`r",'').Replace("`n",' <- '))"; diff --git a/Templates/Per Tenant Extension/.github/workflows/CICD.yaml b/Templates/Per Tenant Extension/.github/workflows/CICD.yaml index 6a809952d..b1f07078c 100644 --- a/Templates/Per Tenant Extension/.github/workflows/CICD.yaml +++ b/Templates/Per Tenant Extension/.github/workflows/CICD.yaml @@ -14,7 +14,7 @@ defaults: shell: powershell permissions: - contents: read + contents: write actions: read pages: write id-token: write From d4cfae6dabcd2381afa1203c4e74c7ba13cd5455 Mon Sep 17 00:00:00 2001 From: freddydk Date: Fri, 6 Oct 2023 08:45:41 +0200 Subject: [PATCH 070/235] dump --- Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 index 242b2c051..3a317602e 100644 --- a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 @@ -75,6 +75,8 @@ function GenerateDocsSite { [switch] $hostIt ) + Write-Host "Release Notes: '$releaseNotes'" + $alDocPath = DownloadAlDoc $docfxPath = Join-Path ([System.IO.Path]::GetTempPath()) ([Guid]::NewGuid().ToString()) New-Item -path $docfxPath -ItemType Directory | Out-Null From 8d2b56e4bdf92ee639ff540de341b536a0c670d0 Mon Sep 17 00:00:00 2001 From: freddydk Date: Fri, 6 Oct 2023 08:53:18 +0200 Subject: [PATCH 071/235] do not modify --- Actions/BuildALDoc/BuildALDoc.ps1 | 1 - 1 file changed, 1 deletion(-) diff --git a/Actions/BuildALDoc/BuildALDoc.ps1 b/Actions/BuildALDoc/BuildALDoc.ps1 index 16575004a..57a087153 100644 --- a/Actions/BuildALDoc/BuildALDoc.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.ps1 @@ -66,5 +66,4 @@ $header = "Documentation for $ENV:GITHUB_REPOSITORY" Write-Host "Latest release tag: $latestReleaseTag" Write-Host "Commitish: $ENV:GITHUB_SHA" $releaseNotes = GetReleaseNotes -token $token -tag_name 'vnext' -previous_tag_name $latestReleaseTag -target_commitish $ENV:GITHUB_SHA | ConvertFrom-Json -$releaseNotes = $releaseNotes.body -replace '%','%25' -replace '\n','%0A' -replace '\r','%0D' # supports a multiline text GenerateDocsSite -version '' -allVersions $versions -allApps $allApps -releaseNotes $releaseNotes -header $header -docsPath $docsPath -logLevel $logLevel From 8af02da4b18a523a1d29fbaee897bdd05ca9a00f Mon Sep 17 00:00:00 2001 From: freddydk Date: Fri, 6 Oct 2023 09:12:57 +0200 Subject: [PATCH 072/235] body --- Actions/BuildALDoc/BuildALDoc.ps1 | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Actions/BuildALDoc/BuildALDoc.ps1 b/Actions/BuildALDoc/BuildALDoc.ps1 index 57a087153..531033003 100644 --- a/Actions/BuildALDoc/BuildALDoc.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.ps1 @@ -65,5 +65,10 @@ $allApps,$allDependencies = CalculateProjectsAndApps -tempFolder $artifactsFolde $header = "Documentation for $ENV:GITHUB_REPOSITORY" Write-Host "Latest release tag: $latestReleaseTag" Write-Host "Commitish: $ENV:GITHUB_SHA" -$releaseNotes = GetReleaseNotes -token $token -tag_name 'vnext' -previous_tag_name $latestReleaseTag -target_commitish $ENV:GITHUB_SHA | ConvertFrom-Json +try { + $releaseNotes = GetReleaseNotes -token $token -tag_name 'main' -previous_tag_name $latestReleaseTag -target_commitish $ENV:GITHUB_SHA | ConvertFrom-Json).body +} +catch { + $releaseNotes = $header +} GenerateDocsSite -version '' -allVersions $versions -allApps $allApps -releaseNotes $releaseNotes -header $header -docsPath $docsPath -logLevel $logLevel From 987cb14f28ac65db87715f8ca7d806dd7deb37e5 Mon Sep 17 00:00:00 2001 From: freddydk Date: Fri, 6 Oct 2023 09:14:02 +0200 Subject: [PATCH 073/235] p --- Actions/BuildALDoc/BuildALDoc.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Actions/BuildALDoc/BuildALDoc.ps1 b/Actions/BuildALDoc/BuildALDoc.ps1 index 531033003..221358bc2 100644 --- a/Actions/BuildALDoc/BuildALDoc.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.ps1 @@ -66,7 +66,7 @@ $header = "Documentation for $ENV:GITHUB_REPOSITORY" Write-Host "Latest release tag: $latestReleaseTag" Write-Host "Commitish: $ENV:GITHUB_SHA" try { - $releaseNotes = GetReleaseNotes -token $token -tag_name 'main' -previous_tag_name $latestReleaseTag -target_commitish $ENV:GITHUB_SHA | ConvertFrom-Json).body + $releaseNotes = (GetReleaseNotes -token $token -tag_name 'main' -previous_tag_name $latestReleaseTag -target_commitish $ENV:GITHUB_SHA | ConvertFrom-Json).body } catch { $releaseNotes = $header From 13dbb28b509a4d6a877d4fe2fbb596d58726cb02 Mon Sep 17 00:00:00 2001 From: freddydk Date: Fri, 6 Oct 2023 09:38:24 +0200 Subject: [PATCH 074/235] dumps --- Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 index 3a317602e..7c3d4b94b 100644 --- a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 @@ -24,12 +24,15 @@ function FixBackslashes { } function DownloadAlDoc { if ("$ENV:aldocPath" -eq "") { + Write-Host "Locating aldoc" $artifactUrl = Get-BCArtifactUrl -storageAccount bcinsider -type sandbox -country core -select Latest -accept_insiderEula + Write-Host "Downloading aldoc" $folder = Download-Artifacts $artifactUrl $alLanguageVsix = Join-Path $folder '*.vsix' -Resolve $tempFolder = Join-Path ([System.IO.Path]::GetTempPath()) ([Guid]::NewGuid().ToString()) Copy-Item -Path $alLanguageVsix -Destination "$($tempFolder).zip" New-Item -Path $tempFolder -ItemType Directory | Out-Null + Write-Host "Extracting aldoc" Expand-Archive -Path "$($tempFolder).zip" -DestinationPath $tempFolder -Force Remove-Item -Path "$($tempFolder).zip" -Force if (RunningOnLinux) { @@ -40,6 +43,7 @@ function DownloadAlDoc { $ENV:aldocPath = Join-Path $tempFolder 'extension/bin/win32/aldoc.exe' } + Write-Host "Installing/Updating docfx" CmdDo -command dotnet -arguments @('tool','update','-g docfx') } $ENV:aldocPath From 101cf2db904d5ab05a8cc65b3cb4d7a9f4ce8a13 Mon Sep 17 00:00:00 2001 From: freddydk Date: Fri, 6 Oct 2023 09:47:07 +0200 Subject: [PATCH 075/235] update --- .../AppSource App/.github/workflows/CICD.yaml | 56 ++++++++++++++++++- 1 file changed, 53 insertions(+), 3 deletions(-) diff --git a/Templates/AppSource App/.github/workflows/CICD.yaml b/Templates/AppSource App/.github/workflows/CICD.yaml index 6b4ff0e77..b1f07078c 100644 --- a/Templates/AppSource App/.github/workflows/CICD.yaml +++ b/Templates/AppSource App/.github/workflows/CICD.yaml @@ -14,8 +14,10 @@ defaults: shell: powershell permissions: - contents: read + contents: write actions: read + pages: write + id-token: write env: workflowDepth: 1 @@ -30,6 +32,8 @@ jobs: environmentsMatrixJson: ${{ steps.DetermineDeploymentEnvironments.outputs.EnvironmentsMatrixJson }} environmentCount: ${{ steps.DetermineDeploymentEnvironments.outputs.EnvironmentCount }} deploymentEnvironmentsJson: ${{ steps.DetermineDeploymentEnvironments.outputs.DeploymentEnvironmentsJson }} + generateALDocArtifact: ${{ steps.DetermineDeploymentEnvironments.outputs.GenerateALDocArtifact }} + deployALDocArtifact: ${{ steps.DetermineDeploymentEnvironments.outputs.DeployALDocArtifact }} deliveryTargetsJson: ${{ steps.DetermineDeliveryTargets.outputs.DeliveryTargetsJson }} githubRunner: ${{ steps.ReadSettings.outputs.GitHubRunnerJson }} githubRunnerShell: ${{ steps.ReadSettings.outputs.GitHubRunnerShell }} @@ -144,11 +148,57 @@ jobs: buildMode: ${{ matrix.buildMode }} projectDependenciesJson: ${{ needs.Initialization.outputs.projectDependenciesJson }} secrets: 'licenseFileUrl,codeSignCertificateUrl,*codeSignCertificatePassword,keyVaultCertificateUrl,*keyVaultCertificatePassword,keyVaultClientId,gitHubPackagesContext,applicationInsightsConnectionString' - publishThisBuildArtifacts: ${{ needs.Initialization.outputs.workflowDepth > 1 }} + publishThisBuildArtifacts: true publishArtifacts: ${{ github.ref_name == 'main' || startswith(github.ref_name, 'release/') || needs.Initialization.outputs.deliveryTargetsJson != '[]' || needs.Initialization.outputs.environmentCount > 0 }} signArtifacts: true useArtifactCache: true + DeployALDoc: + needs: [ Initialization, Build ] + if: always() && needs.Build.result == 'Success' && needs.Initialization.outputs.generateALDocArtifact == 1 + runs-on: windows-latest + name: Deploy ALDoc Documentation + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Download artifacts + uses: actions/download-artifact@v3 + with: + path: '.artifacts' + + - name: Read settings + uses: microsoft/AL-Go-Actions/ReadSettings@main + with: + shell: powershell + + - name: Setup Pages + if: needs.Initialization.outputs.deployALDocArtifact == 1 + uses: actions/configure-pages@v3 + + - name: Build ALDoc Documentation + uses: microsoft/AL-Go-Actions/BuildALDoc@main + with: + shell: powershell + + - name: Upload pages artifact + uses: actions/upload-pages-artifact@v2 + with: + path: ".aldoc/_site/" + + - name: Deploy to GitHub Pages + if: needs.Initialization.outputs.deployALDocArtifact == 1 + id: deployment + uses: actions/deploy-pages@v2 + + - name: fail + run: | + $erroractionpreference = "Stop" + throw "FAIL" + Deploy: needs: [ Initialization, Build ] if: always() && needs.Build.result == 'Success' && needs.Initialization.outputs.environmentCount > 0 @@ -244,7 +294,7 @@ jobs: PostProcess: if: (!cancelled()) runs-on: [ windows-latest ] - needs: [ Initialization, Build, Deploy, Deliver ] + needs: [ Initialization, Build, Deploy, Deliver, DeployALDoc ] steps: - name: Checkout uses: actions/checkout@v3 From d8e1e43dc17c0e0f21470748683eb8c3f0090e8c Mon Sep 17 00:00:00 2001 From: freddydk Date: Fri, 6 Oct 2023 09:57:41 +0200 Subject: [PATCH 076/235] remove dumps --- Actions/BuildALDoc/BuildALDoc.ps1 | 2 -- 1 file changed, 2 deletions(-) diff --git a/Actions/BuildALDoc/BuildALDoc.ps1 b/Actions/BuildALDoc/BuildALDoc.ps1 index 221358bc2..365c46f5a 100644 --- a/Actions/BuildALDoc/BuildALDoc.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.ps1 @@ -63,8 +63,6 @@ foreach($version in $versions) { Get-ChildItem -Path $artifactsFolder -Depth 1 -File | ForEach-Object { Write-Host "- $($_.FullName.Substring($artifactsFolder.Length))" } $allApps,$allDependencies = CalculateProjectsAndApps -tempFolder $artifactsFolder -projects $projects -refname $ENV:GITHUB_REF_NAME $header = "Documentation for $ENV:GITHUB_REPOSITORY" -Write-Host "Latest release tag: $latestReleaseTag" -Write-Host "Commitish: $ENV:GITHUB_SHA" try { $releaseNotes = (GetReleaseNotes -token $token -tag_name 'main' -previous_tag_name $latestReleaseTag -target_commitish $ENV:GITHUB_SHA | ConvertFrom-Json).body } From 5c9f0d417f9ab54fd54c83161363b81fd912b58e Mon Sep 17 00:00:00 2001 From: freddydk Date: Fri, 6 Oct 2023 10:40:14 +0200 Subject: [PATCH 077/235] add template --- .../BuildALDoc/BuildALDoc.HelperFunctions.ps1 | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 index 7c3d4b94b..37a60ad7d 100644 --- a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 @@ -79,7 +79,24 @@ function GenerateDocsSite { [switch] $hostIt ) - Write-Host "Release Notes: '$releaseNotes'" + $indexTemplateRelativePath = '.aldoc/index.md' + if ($version) { + $thisTemplateRelativePath = '.aldoc/release.md' + } + else { + $thisTemplateRelativePath = $indexTemplateRelativePath + } + $indexTemplatePath = Join-Path $ENV:GITHUB_WORKSPACE $thisTemplateRelativePath + if (-not (Test-Path $indexTemplatePath)) { + $indexTemplatePath = Join-Path $ENV:GITHUB_WORKSPACE $indexTemplateRelativePath + } + if (Test-Path (Join-Path $indexTemplatePath)) { + $indexTemplate = Get-Content -Encoding utf8 -Path $indexTemplatePath -Raw + } + else { + $indexTemplate = "## ALDoc Documentation`n`n{RELEASENOTES}`n`n**Create a file named {INDEXTEMPLATERELATIVEPATH} in your repository to customize this page.**" + } + $indexContent = $indexTemplate.Replace('{RELEASENOTES}',$releaseNotes).Replace('{VERSION}',$version).Replace('{REPOSITORY}',$ENV:GITHUB_REPOSITORY).Replace('{INDEXTEMPLATERELATIVEPATH}',$thisTemplateRelativePath) $alDocPath = DownloadAlDoc $docfxPath = Join-Path ([System.IO.Path]::GetTempPath()) ([Guid]::NewGuid().ToString()) @@ -145,7 +162,7 @@ function GenerateDocsSite { # Set release notes Write-Host "Update index.md" - Set-Content -path (Join-Path $docfxpath 'index.md') -value $releaseNotes -encoding utf8 + Set-Content -path (Join-Path $docfxpath 'index.md') -value $indexContent -encoding utf8 $arguments = @("build", "--output ""$docsPath""", "--logLevel $loglevel", """$docfxJsonFile""") if ($hostIt) { From d003128be013579a18d8289f684808af5a7c626a Mon Sep 17 00:00:00 2001 From: freddydk Date: Fri, 6 Oct 2023 10:46:55 +0200 Subject: [PATCH 078/235] update index --- Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 index 37a60ad7d..502779dbe 100644 --- a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 @@ -94,7 +94,7 @@ function GenerateDocsSite { $indexTemplate = Get-Content -Encoding utf8 -Path $indexTemplatePath -Raw } else { - $indexTemplate = "## ALDoc Documentation`n`n{RELEASENOTES}`n`n**Create a file named {INDEXTEMPLATERELATIVEPATH} in your repository to customize this page.**" + $indexTemplate = "## Welcome to your new reference documentation`n`nThis is the landing page for your generated reference documentation.`n`nYou can use the navigation bar at the top and the table of contents to the left to navigate your documentation.`n`nYou can change this content by editing the {INDEXTEMPLATERELATIVEPATH} file in your repository`n`n{RELEASENOTES}" } $indexContent = $indexTemplate.Replace('{RELEASENOTES}',$releaseNotes).Replace('{VERSION}',$version).Replace('{REPOSITORY}',$ENV:GITHUB_REPOSITORY).Replace('{INDEXTEMPLATERELATIVEPATH}',$thisTemplateRelativePath) From d657eefd7a31559e92c32755a4faff63bfc736ec Mon Sep 17 00:00:00 2001 From: freddydk Date: Fri, 6 Oct 2023 10:49:25 +0200 Subject: [PATCH 079/235] -join --- Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 index 502779dbe..eabed0e98 100644 --- a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 @@ -90,7 +90,7 @@ function GenerateDocsSite { if (-not (Test-Path $indexTemplatePath)) { $indexTemplatePath = Join-Path $ENV:GITHUB_WORKSPACE $indexTemplateRelativePath } - if (Test-Path (Join-Path $indexTemplatePath)) { + if (Test-Path $indexTemplatePath) { $indexTemplate = Get-Content -Encoding utf8 -Path $indexTemplatePath -Raw } else { From e04d65da32740182cab83b70a60b63b939994f50 Mon Sep 17 00:00:00 2001 From: freddydk Date: Fri, 6 Oct 2023 10:56:26 +0200 Subject: [PATCH 080/235] bold --- Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 index eabed0e98..bdb17b20e 100644 --- a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 @@ -94,7 +94,7 @@ function GenerateDocsSite { $indexTemplate = Get-Content -Encoding utf8 -Path $indexTemplatePath -Raw } else { - $indexTemplate = "## Welcome to your new reference documentation`n`nThis is the landing page for your generated reference documentation.`n`nYou can use the navigation bar at the top and the table of contents to the left to navigate your documentation.`n`nYou can change this content by editing the {INDEXTEMPLATERELATIVEPATH} file in your repository`n`n{RELEASENOTES}" + $indexTemplate = "## Welcome to your new reference documentation`n`nThis is the landing page for your generated reference documentation.`n`nYou can use the navigation bar at the top and the table of contents to the left to navigate your documentation.`n`nYou can change this content by editing the **{INDEXTEMPLATERELATIVEPATH}** file in your repository`n`n{RELEASENOTES}" } $indexContent = $indexTemplate.Replace('{RELEASENOTES}',$releaseNotes).Replace('{VERSION}',$version).Replace('{REPOSITORY}',$ENV:GITHUB_REPOSITORY).Replace('{INDEXTEMPLATERELATIVEPATH}',$thisTemplateRelativePath) From 712fed91ed0708dd4dfe8d79e7a51442093182b3 Mon Sep 17 00:00:00 2001 From: freddydk Date: Fri, 6 Oct 2023 11:09:38 +0200 Subject: [PATCH 081/235] update --- Actions/BuildALDoc/BuildALDoc.ps1 | 14 ++++++++++---- .../AppSource App/.github/workflows/CICD.yaml | 5 ----- .../.github/workflows/CICD.yaml | 5 ----- 3 files changed, 10 insertions(+), 14 deletions(-) diff --git a/Actions/BuildALDoc/BuildALDoc.ps1 b/Actions/BuildALDoc/BuildALDoc.ps1 index 365c46f5a..c13eb930e 100644 --- a/Actions/BuildALDoc/BuildALDoc.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.ps1 @@ -63,10 +63,16 @@ foreach($version in $versions) { Get-ChildItem -Path $artifactsFolder -Depth 1 -File | ForEach-Object { Write-Host "- $($_.FullName.Substring($artifactsFolder.Length))" } $allApps,$allDependencies = CalculateProjectsAndApps -tempFolder $artifactsFolder -projects $projects -refname $ENV:GITHUB_REF_NAME $header = "Documentation for $ENV:GITHUB_REPOSITORY" -try { - $releaseNotes = (GetReleaseNotes -token $token -tag_name 'main' -previous_tag_name $latestReleaseTag -target_commitish $ENV:GITHUB_SHA | ConvertFrom-Json).body +releaseNotes = '' +if ($latestReleaseTag) { + try { + $releaseNotes = (GetReleaseNotes -token $token -tag_name 'main' -previous_tag_name $latestReleaseTag -target_commitish $ENV:GITHUB_SHA | ConvertFrom-Json).body + } + catch { + releaseNotes = "## What's new`n`nError creating release notes" + } } -catch { - $releaseNotes = $header +else { + releaseNotes = '' } GenerateDocsSite -version '' -allVersions $versions -allApps $allApps -releaseNotes $releaseNotes -header $header -docsPath $docsPath -logLevel $logLevel diff --git a/Templates/AppSource App/.github/workflows/CICD.yaml b/Templates/AppSource App/.github/workflows/CICD.yaml index b1f07078c..7815882f1 100644 --- a/Templates/AppSource App/.github/workflows/CICD.yaml +++ b/Templates/AppSource App/.github/workflows/CICD.yaml @@ -194,11 +194,6 @@ jobs: id: deployment uses: actions/deploy-pages@v2 - - name: fail - run: | - $erroractionpreference = "Stop" - throw "FAIL" - Deploy: needs: [ Initialization, Build ] if: always() && needs.Build.result == 'Success' && needs.Initialization.outputs.environmentCount > 0 diff --git a/Templates/Per Tenant Extension/.github/workflows/CICD.yaml b/Templates/Per Tenant Extension/.github/workflows/CICD.yaml index b1f07078c..7815882f1 100644 --- a/Templates/Per Tenant Extension/.github/workflows/CICD.yaml +++ b/Templates/Per Tenant Extension/.github/workflows/CICD.yaml @@ -194,11 +194,6 @@ jobs: id: deployment uses: actions/deploy-pages@v2 - - name: fail - run: | - $erroractionpreference = "Stop" - throw "FAIL" - Deploy: needs: [ Initialization, Build ] if: always() && needs.Build.result == 'Success' && needs.Initialization.outputs.environmentCount > 0 From 7d6e8558533caa7e25ab463086e3b1a0d94cfd67 Mon Sep 17 00:00:00 2001 From: freddydk Date: Fri, 6 Oct 2023 11:57:42 +0200 Subject: [PATCH 082/235] dollar --- Actions/BuildALDoc/BuildALDoc.ps1 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Actions/BuildALDoc/BuildALDoc.ps1 b/Actions/BuildALDoc/BuildALDoc.ps1 index c13eb930e..fea699c39 100644 --- a/Actions/BuildALDoc/BuildALDoc.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.ps1 @@ -63,16 +63,16 @@ foreach($version in $versions) { Get-ChildItem -Path $artifactsFolder -Depth 1 -File | ForEach-Object { Write-Host "- $($_.FullName.Substring($artifactsFolder.Length))" } $allApps,$allDependencies = CalculateProjectsAndApps -tempFolder $artifactsFolder -projects $projects -refname $ENV:GITHUB_REF_NAME $header = "Documentation for $ENV:GITHUB_REPOSITORY" -releaseNotes = '' +$releaseNotes = '' if ($latestReleaseTag) { try { $releaseNotes = (GetReleaseNotes -token $token -tag_name 'main' -previous_tag_name $latestReleaseTag -target_commitish $ENV:GITHUB_SHA | ConvertFrom-Json).body } catch { - releaseNotes = "## What's new`n`nError creating release notes" + $releaseNotes = "## What's new`n`nError creating release notes" } } else { - releaseNotes = '' + $releaseNotes = '' } GenerateDocsSite -version '' -allVersions $versions -allApps $allApps -releaseNotes $releaseNotes -header $header -docsPath $docsPath -logLevel $logLevel From 20b2da780304b4332e91e057f05fd41da90c6e81 Mon Sep 17 00:00:00 2001 From: freddydk Date: Sun, 8 Oct 2023 06:41:14 +0200 Subject: [PATCH 083/235] include repo --- Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 index bdb17b20e..926fe7fc8 100644 --- a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 @@ -94,7 +94,7 @@ function GenerateDocsSite { $indexTemplate = Get-Content -Encoding utf8 -Path $indexTemplatePath -Raw } else { - $indexTemplate = "## Welcome to your new reference documentation`n`nThis is the landing page for your generated reference documentation.`n`nYou can use the navigation bar at the top and the table of contents to the left to navigate your documentation.`n`nYou can change this content by editing the **{INDEXTEMPLATERELATIVEPATH}** file in your repository`n`n{RELEASENOTES}" + $indexTemplate = "## [{REPOSITORY}](https://github.com/{REPOSITORY}) reference documentation`n`nThis is the landing page for your generated reference documentation.`n`nYou can use the navigation bar at the top and the table of contents to the left to navigate your documentation.`n`nYou can change this content by editing the **{INDEXTEMPLATERELATIVEPATH}** file in your repository`n`n{RELEASENOTES}" } $indexContent = $indexTemplate.Replace('{RELEASENOTES}',$releaseNotes).Replace('{VERSION}',$version).Replace('{REPOSITORY}',$ENV:GITHUB_REPOSITORY).Replace('{INDEXTEMPLATERELATIVEPATH}',$thisTemplateRelativePath) From 02e0fe63ba5231ae4b947065c1a496c5c59646b7 Mon Sep 17 00:00:00 2001 From: freddydk Date: Sun, 8 Oct 2023 06:54:42 +0200 Subject: [PATCH 084/235] check single repo --- Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 index 926fe7fc8..676e280c3 100644 --- a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 @@ -79,6 +79,7 @@ function GenerateDocsSite { [switch] $hostIt ) + $settings = $env:Settings | ConvertFrom-Json $indexTemplateRelativePath = '.aldoc/index.md' if ($version) { $thisTemplateRelativePath = '.aldoc/release.md' @@ -115,7 +116,8 @@ function GenerateDocsSite { $newTocYml += @(" - name: $ver"," href: $($prefix)releases/$ver/index.html") } } - if ($allApps.Keys.Count -eq 1 -and $allApps.Keys[0] -eq '.') { + $allApps | ConvertTo-Json -Depth 99 | Out-Host + if ($allApps.Keys.Count -eq 1 -and $allApps.Keys[0] -eq $settings.repoName) { # Single prokect repo foreach($appFile in $allApps.".") { $apps += @($appFile) From 46b50513b636b11e6d01de9f1923dff818c097f7 Mon Sep 17 00:00:00 2001 From: freddydk Date: Sun, 8 Oct 2023 07:01:39 +0200 Subject: [PATCH 085/235] setting for maxreleases --- Actions/AL-Go-Helper.ps1 | 3 ++- Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 | 4 ++-- Actions/BuildALDoc/BuildALDoc.ps1 | 8 +++++--- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/Actions/AL-Go-Helper.ps1 b/Actions/AL-Go-Helper.ps1 index 98e0b898d..497cb29e1 100644 --- a/Actions/AL-Go-Helper.ps1 +++ b/Actions/AL-Go-Helper.ps1 @@ -622,8 +622,9 @@ function ReadSettings { "PullRequestTrigger" = "pull_request_target" "fullBuildPatterns" = @() "excludeEnvironments" = @() - "generateALDocArtifact" = $false + "generateALDocArtifact" = $false "deployALDocArtifact" = $false + "ALDocMaxReleases" = 3 } # Read settings from files and merge them into the settings object diff --git a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 index 676e280c3..cff39e538 100644 --- a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 @@ -71,6 +71,7 @@ function GenerateDocsSite { [string] $version, [string[]] $allVersions, [hashtable] $allApps, + [string] $repoName, [string] $releaseNotes, [string] $header = "Documentation", [string] $footer = "Made with AL-Go for GitHub, ALDoc and DocFx", @@ -79,7 +80,6 @@ function GenerateDocsSite { [switch] $hostIt ) - $settings = $env:Settings | ConvertFrom-Json $indexTemplateRelativePath = '.aldoc/index.md' if ($version) { $thisTemplateRelativePath = '.aldoc/release.md' @@ -117,7 +117,7 @@ function GenerateDocsSite { } } $allApps | ConvertTo-Json -Depth 99 | Out-Host - if ($allApps.Keys.Count -eq 1 -and $allApps.Keys[0] -eq $settings.repoName) { + if ($allApps.Keys.Count -eq 1 -and $allApps.Keys[0] -eq $repoName) { # Single prokect repo foreach($appFile in $allApps.".") { $apps += @($appFile) diff --git a/Actions/BuildALDoc/BuildALDoc.ps1 b/Actions/BuildALDoc/BuildALDoc.ps1 index fea699c39..cd7852221 100644 --- a/Actions/BuildALDoc/BuildALDoc.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.ps1 @@ -9,7 +9,9 @@ . (Join-Path -Path $PSScriptRoot -ChildPath "BuildALDoc.HelperFunctions.ps1" -Resolve) DownloadAndImportBcContainerHelper -$maxReleases = 2 +$settings = $env:Settings | ConvertFrom-Json + +$maxReleases = $settings.ALDocMaxReleases $artifactsFolder = Join-Path $ENV:GITHUB_WORKSPACE ".artifacts" $releases = @() @@ -37,7 +39,7 @@ foreach($release in $releases) { $version = $release.Name $header = "Documentation for $ENV:GITHUB_REPOSITORY $version" $releaseNotes = $release.body - GenerateDocsSite -version $version -allVersions $versions -allApps $allApps -releaseNotes $releaseNotes -header $header -docsPath $docsPath -logLevel $logLevel + GenerateDocsSite -version $version -allVersions $versions -allApps $allApps -repoName $settings.repoName -releaseNotes $releaseNotes -header $header -docsPath $docsPath -logLevel $logLevel do { try { $retry = $false @@ -75,4 +77,4 @@ if ($latestReleaseTag) { else { $releaseNotes = '' } -GenerateDocsSite -version '' -allVersions $versions -allApps $allApps -releaseNotes $releaseNotes -header $header -docsPath $docsPath -logLevel $logLevel +GenerateDocsSite -version '' -allVersions $versions -allApps $allApps -repoName $settings.repoName -releaseNotes $releaseNotes -header $header -docsPath $docsPath -logLevel $logLevel From 5a564545001992c5961bb6db4c6e851f3c8ff075 Mon Sep 17 00:00:00 2001 From: freddydk Date: Sun, 8 Oct 2023 07:43:07 +0200 Subject: [PATCH 086/235] use reponame --- Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 index cff39e538..2d3e2955a 100644 --- a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 @@ -119,7 +119,7 @@ function GenerateDocsSite { $allApps | ConvertTo-Json -Depth 99 | Out-Host if ($allApps.Keys.Count -eq 1 -and $allApps.Keys[0] -eq $repoName) { # Single prokect repo - foreach($appFile in $allApps.".") { + foreach($appFile in $allApps."$repoName") { $apps += @($appFile) $appName, $appFolder = GetAppNameAndFolder -appFile $appFile $newTocYml += @(" - name: $appName"," href: reference/$appFolder/toc.yml") From 1b40d5d5e11f6b827ccf1b95f2506d6ed266de80 Mon Sep 17 00:00:00 2001 From: freddydk Date: Sun, 8 Oct 2023 07:52:11 +0200 Subject: [PATCH 087/235] dumps --- Actions/AL-Go-Helper.ps1 | 2 +- Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/Actions/AL-Go-Helper.ps1 b/Actions/AL-Go-Helper.ps1 index 497cb29e1..11ab1c009 100644 --- a/Actions/AL-Go-Helper.ps1 +++ b/Actions/AL-Go-Helper.ps1 @@ -624,7 +624,7 @@ function ReadSettings { "excludeEnvironments" = @() "generateALDocArtifact" = $false "deployALDocArtifact" = $false - "ALDocMaxReleases" = 3 + "ALDocMaxReleases" = 0 } # Read settings from files and merge them into the settings object diff --git a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 index 2d3e2955a..f143db6e7 100644 --- a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 @@ -95,7 +95,7 @@ function GenerateDocsSite { $indexTemplate = Get-Content -Encoding utf8 -Path $indexTemplatePath -Raw } else { - $indexTemplate = "## [{REPOSITORY}](https://github.com/{REPOSITORY}) reference documentation`n`nThis is the landing page for your generated reference documentation.`n`nYou can use the navigation bar at the top and the table of contents to the left to navigate your documentation.`n`nYou can change this content by editing the **{INDEXTEMPLATERELATIVEPATH}** file in your repository`n`n{RELEASENOTES}" + $indexTemplate = "## Reference documentation`n`nThis is the generated reference documentation for [{REPOSITORY}](https://github.com/{REPOSITORY}).`n`nYou can use the navigation bar at the top and the table of contents to the left to navigate your documentation.`n`nYou can change this content by editing the **{INDEXTEMPLATERELATIVEPATH}** file in your repository`n`n{RELEASENOTES}" } $indexContent = $indexTemplate.Replace('{RELEASENOTES}',$releaseNotes).Replace('{VERSION}',$version).Replace('{REPOSITORY}',$ENV:GITHUB_REPOSITORY).Replace('{INDEXTEMPLATERELATIVEPATH}',$thisTemplateRelativePath) @@ -150,11 +150,17 @@ function GenerateDocsSite { $docfxJson.build.globalMetadata._appFooter = $footer $docfxJson | ConvertTo-Json -Depth 99 | Set-Content -Path $docfxJsonFile -Encoding utf8 + Write-Host "docfx.json:" + Get-Content $docfxJsonFile | Out-Host + # Create new toc.yml Write-Host "Create new toc.yml" $tocYmlFile = Join-Path $docfxpath 'toc.yml' Set-Content -Path $tocYmlFile -Value ($newTocYml -join "`n") -Encoding utf8 + Write-Host "TOC:" + Get-Content $tocYmlFile | Out-Host + $apps | ForEach-Object { $arguments = @("build","--output ""$docfxpath""","--loglevel $loglevel","--source ""$_""") Write-Host "invoke aldoc $arguments" @@ -164,7 +170,12 @@ function GenerateDocsSite { # Set release notes Write-Host "Update index.md" - Set-Content -path (Join-Path $docfxpath 'index.md') -value $indexContent -encoding utf8 + $indexMdFile = Join-Path $docfxpath 'index.md' + Set-Content -path $indexMdFile -value $indexContent -encoding utf8 + + Write-Host "index.md:" + Get-Content $indexMdFile | Out-Host + $arguments = @("build", "--output ""$docsPath""", "--logLevel $loglevel", """$docfxJsonFile""") if ($hostIt) { From 6f4e068327ee40689d912a8c1866e994e8aeb270 Mon Sep 17 00:00:00 2001 From: freddydk Date: Sun, 8 Oct 2023 07:56:48 +0200 Subject: [PATCH 088/235] dump old toc --- Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 index f143db6e7..fd4772364 100644 --- a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 @@ -156,6 +156,10 @@ function GenerateDocsSite { # Create new toc.yml Write-Host "Create new toc.yml" $tocYmlFile = Join-Path $docfxpath 'toc.yml' + + Write-Host "ORGTOC:" + Get-Content $tocYmlFile | Out-Host + Set-Content -Path $tocYmlFile -Value ($newTocYml -join "`n") -Encoding utf8 Write-Host "TOC:" From e8dc89deb7490323fbdfd2eed67e74c4de8bfb57 Mon Sep 17 00:00:00 2001 From: freddydk Date: Sun, 8 Oct 2023 10:19:04 +0200 Subject: [PATCH 089/235] comment --- Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 index fd4772364..d1be6cc54 100644 --- a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 @@ -95,7 +95,7 @@ function GenerateDocsSite { $indexTemplate = Get-Content -Encoding utf8 -Path $indexTemplatePath -Raw } else { - $indexTemplate = "## Reference documentation`n`nThis is the generated reference documentation for [{REPOSITORY}](https://github.com/{REPOSITORY}).`n`nYou can use the navigation bar at the top and the table of contents to the left to navigate your documentation.`n`nYou can change this content by editing the **{INDEXTEMPLATERELATIVEPATH}** file in your repository`n`n{RELEASENOTES}" + $indexTemplate = "## Reference documentation`n`nThis is the generated reference documentation for [{REPOSITORY}](https://github.com/{REPOSITORY}).`n`nYou can use the navigation bar at the top and the table of contents to the left to navigate your documentation.`n`nYou can change this content by creating/editing the **{INDEXTEMPLATERELATIVEPATH}** file in your repository`n`n{RELEASENOTES}" } $indexContent = $indexTemplate.Replace('{RELEASENOTES}',$releaseNotes).Replace('{VERSION}',$version).Replace('{REPOSITORY}',$ENV:GITHUB_REPOSITORY).Replace('{INDEXTEMPLATERELATIVEPATH}',$thisTemplateRelativePath) From 83253b0509b9b63208a1b7bce53527f94892ef6e Mon Sep 17 00:00:00 2001 From: freddydk Date: Sun, 8 Oct 2023 12:15:44 +0200 Subject: [PATCH 090/235] update --- Actions/AL-Go-Helper.ps1 | 2 ++ .../BuildALDoc/BuildALDoc.HelperFunctions.ps1 | 19 +++++++++++-------- Actions/BuildALDoc/BuildALDoc.ps1 | 13 ++++++------- Actions/BuildALDoc/action.yaml | 7 +------ 4 files changed, 20 insertions(+), 21 deletions(-) diff --git a/Actions/AL-Go-Helper.ps1 b/Actions/AL-Go-Helper.ps1 index 11ab1c009..a6435e1f8 100644 --- a/Actions/AL-Go-Helper.ps1 +++ b/Actions/AL-Go-Helper.ps1 @@ -625,6 +625,8 @@ function ReadSettings { "generateALDocArtifact" = $false "deployALDocArtifact" = $false "ALDocMaxReleases" = 0 + "ALDocProjects" = @() + "ALDocExcludeProjects" = @() } # Read settings from files and merge them into the settings object diff --git a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 index d1be6cc54..3dabf9e01 100644 --- a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 @@ -156,7 +156,7 @@ function GenerateDocsSite { # Create new toc.yml Write-Host "Create new toc.yml" $tocYmlFile = Join-Path $docfxpath 'toc.yml' - + Write-Host "ORGTOC:" Get-Content $tocYmlFile | Out-Host @@ -197,21 +197,24 @@ function GenerateDocsSite { function CalculateProjectsAndApps { Param( [string] $tempFolder, - [string] $projects, - [string] $refname + [string[]] $projects, + [string[]] $excludeProjects ) - if ($projects -eq "") { $projects = "*" } - $projectList = @($projects.Split(',') | ForEach-Object { $_.Replace('\','_').Replace('/','_') }) + if ($projects.Count -eq 0) { $projects = @('*') } + $projectList = @($projects | ForEach-Object { $_.Replace('\','_').Replace('/','_') }) + $excludeProjectList = @($excludeProjects | ForEach-Object { $_.Replace('\','_').Replace('/','_') }) foreach($mask in 'Apps','Dependencies') { $allApps = @{} Get-ChildItem -Path $tempFolder -Directory | ForEach-Object { if ($_.Name -match "^(.*)-main-$mask-(\d*\.\d*\.\d*\.\d*)$") { $project = $Matches[1] if ($projectList | Where-Object { $project -like $_ }) { - $allApps."$project" = @() - Get-ChildItem -Path $_.FullName -Filter '*.app' | ForEach-Object { - $allApps."$project" += @($_.FullName) + if (-not ($excludeProjectList | Where-Object { $project -like $_ })) { + $allApps."$project" = @() + Get-ChildItem -Path $_.FullName -Filter '*.app' | ForEach-Object { + $allApps."$project" += @($_.FullName) + } } } } diff --git a/Actions/BuildALDoc/BuildALDoc.ps1 b/Actions/BuildALDoc/BuildALDoc.ps1 index cd7852221..1833ebf4b 100644 --- a/Actions/BuildALDoc/BuildALDoc.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.ps1 @@ -1,8 +1,6 @@ Param( [Parameter(HelpMessage = "The GitHub token running the action", Mandatory = $false)] - [string] $token, - [Parameter(HelpMessage = "Projects to include in the documentation", Mandatory = $false)] - [string] $projects = '*' + [string] $token ) . (Join-Path -Path $PSScriptRoot -ChildPath "..\AL-Go-Helper.ps1" -Resolve) @@ -10,7 +8,8 @@ DownloadAndImportBcContainerHelper $settings = $env:Settings | ConvertFrom-Json - +$projects = $settings.ALDocProjects +$excludeProjects = $settings.ALDocExcludeProjects $maxReleases = $settings.ALDocMaxReleases $artifactsFolder = Join-Path $ENV:GITHUB_WORKSPACE ".artifacts" @@ -31,11 +30,11 @@ foreach($release in $releases) { New-Item -Path $tempFolder -ItemType Directory | Out-Null try { foreach($mask in 'Apps', 'Dependencies') { - DownloadRelease -token $token -projects $projects -api_url $ENV:GITHUB_API_URL -repository $ENV:GITHUB_REPOSITORY -release $release -path $tempFolder -mask $mask -unpack + DownloadRelease -token $token -projects "$($projects -join ',')" -api_url $ENV:GITHUB_API_URL -repository $ENV:GITHUB_REPOSITORY -release $release -path $tempFolder -mask $mask -unpack } Write-Host "Version: $($release.Name):" Get-ChildItem -Path $tempFolder -Recurse -File | ForEach-Object { Write-Host "- $($_.FullName.Substring($tempFolder.Length+1))" } - $allApps,$allDependencies = CalculateProjectsAndApps -tempFolder $tempFolder -projects $projects -refname $ENV:GITHUB_REF_NAME + $allApps,$allDependencies = CalculateProjectsAndApps -tempFolder $tempFolder -projects $projects -excludeProjects $excludeProjects -refname $ENV:GITHUB_REF_NAME $version = $release.Name $header = "Documentation for $ENV:GITHUB_REPOSITORY $version" $releaseNotes = $release.body @@ -63,7 +62,7 @@ foreach($version in $versions) { } Get-ChildItem -Path $artifactsFolder -Depth 1 -File | ForEach-Object { Write-Host "- $($_.FullName.Substring($artifactsFolder.Length))" } -$allApps,$allDependencies = CalculateProjectsAndApps -tempFolder $artifactsFolder -projects $projects -refname $ENV:GITHUB_REF_NAME +$allApps,$allDependencies = CalculateProjectsAndApps -tempFolder $artifactsFolder -projects $projects -excludeProjects $excludeProjects -refname $ENV:GITHUB_REF_NAME $header = "Documentation for $ENV:GITHUB_REPOSITORY" $releaseNotes = '' if ($latestReleaseTag) { diff --git a/Actions/BuildALDoc/action.yaml b/Actions/BuildALDoc/action.yaml index cdcfb3264..3a16304f9 100644 --- a/Actions/BuildALDoc/action.yaml +++ b/Actions/BuildALDoc/action.yaml @@ -9,10 +9,6 @@ inputs: description: The GitHub token running the action required: false default: ${{ github.token }} - projects: - description: Projects to include in the documentation - required: false - default: '*' runs: using: composite steps: @@ -21,11 +17,10 @@ runs: id: BuildALDoc env: _token: ${{ inputs.token }} - _projects: ${{ inputs.projects }} run: | $errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0 try { - ${{ github.action_path }}/BuildALDoc.ps1 -token $ENV:_token -projects $ENV:_projects + ${{ github.action_path }}/BuildALDoc.ps1 -token $ENV:_token } catch { Write-Host "::ERROR::Unexpected error when running action. Error Message: $($_.Exception.Message.Replace("`r",'').Replace("`n",' ')), StackTrace: $($_.ScriptStackTrace.Replace("`r",'').Replace("`n",' <- '))"; From abfcf144f12c42b34175f49011b072236bba8607 Mon Sep 17 00:00:00 2001 From: freddydk Date: Sun, 8 Oct 2023 12:16:33 +0200 Subject: [PATCH 091/235] test exclude --- Actions/BuildALDoc/BuildALDoc.ps1 | 1 + 1 file changed, 1 insertion(+) diff --git a/Actions/BuildALDoc/BuildALDoc.ps1 b/Actions/BuildALDoc/BuildALDoc.ps1 index 1833ebf4b..2349c2e14 100644 --- a/Actions/BuildALDoc/BuildALDoc.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.ps1 @@ -10,6 +10,7 @@ DownloadAndImportBcContainerHelper $settings = $env:Settings | ConvertFrom-Json $projects = $settings.ALDocProjects $excludeProjects = $settings.ALDocExcludeProjects +$excludeProjects = @("System Application Modules") $maxReleases = $settings.ALDocMaxReleases $artifactsFolder = Join-Path $ENV:GITHUB_WORKSPACE ".artifacts" From a93c73c845bbbb111cb92cf91b8cdcc53ef20800 Mon Sep 17 00:00:00 2001 From: freddydk Date: Sun, 8 Oct 2023 12:16:54 +0200 Subject: [PATCH 092/235] throw --- Actions/BuildALDoc/BuildALDoc.ps1 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Actions/BuildALDoc/BuildALDoc.ps1 b/Actions/BuildALDoc/BuildALDoc.ps1 index 2349c2e14..5eb055d32 100644 --- a/Actions/BuildALDoc/BuildALDoc.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.ps1 @@ -78,3 +78,5 @@ else { $releaseNotes = '' } GenerateDocsSite -version '' -allVersions $versions -allApps $allApps -repoName $settings.repoName -releaseNotes $releaseNotes -header $header -docsPath $docsPath -logLevel $logLevel + +throw 'x' \ No newline at end of file From f2986d1c24f719d651f2fc55fb271c355fce563a Mon Sep 17 00:00:00 2001 From: freddydk Date: Sun, 8 Oct 2023 12:25:50 +0200 Subject: [PATCH 093/235] remove exception --- Actions/BuildALDoc/BuildALDoc.ps1 | 2 -- 1 file changed, 2 deletions(-) diff --git a/Actions/BuildALDoc/BuildALDoc.ps1 b/Actions/BuildALDoc/BuildALDoc.ps1 index 5eb055d32..2349c2e14 100644 --- a/Actions/BuildALDoc/BuildALDoc.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.ps1 @@ -78,5 +78,3 @@ else { $releaseNotes = '' } GenerateDocsSite -version '' -allVersions $versions -allApps $allApps -repoName $settings.repoName -releaseNotes $releaseNotes -header $header -docsPath $docsPath -logLevel $logLevel - -throw 'x' \ No newline at end of file From 981a48521ac75c201fbbce5e411edbb99b2c3fa8 Mon Sep 17 00:00:00 2001 From: freddydk Date: Sun, 8 Oct 2023 12:32:54 +0200 Subject: [PATCH 094/235] exclude --- Actions/BuildALDoc/BuildALDoc.ps1 | 1 - 1 file changed, 1 deletion(-) diff --git a/Actions/BuildALDoc/BuildALDoc.ps1 b/Actions/BuildALDoc/BuildALDoc.ps1 index 2349c2e14..1833ebf4b 100644 --- a/Actions/BuildALDoc/BuildALDoc.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.ps1 @@ -10,7 +10,6 @@ DownloadAndImportBcContainerHelper $settings = $env:Settings | ConvertFrom-Json $projects = $settings.ALDocProjects $excludeProjects = $settings.ALDocExcludeProjects -$excludeProjects = @("System Application Modules") $maxReleases = $settings.ALDocMaxReleases $artifactsFolder = Join-Path $ENV:GITHUB_WORKSPACE ".artifacts" From 6088e0d8d62e3bb2bd9c1e3ebccdfa428c0e2ece Mon Sep 17 00:00:00 2001 From: freddydk Date: Sun, 8 Oct 2023 19:17:34 +0200 Subject: [PATCH 095/235] struc --- Actions/AL-Go-Helper.ps1 | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Actions/AL-Go-Helper.ps1 b/Actions/AL-Go-Helper.ps1 index a6435e1f8..c1f98e0ce 100644 --- a/Actions/AL-Go-Helper.ps1 +++ b/Actions/AL-Go-Helper.ps1 @@ -622,6 +622,13 @@ function ReadSettings { "PullRequestTrigger" = "pull_request_target" "fullBuildPatterns" = @() "excludeEnvironments" = @() + "ALDoc" = @{ + "ContinuousDeployment" = $false + "DeployToGitHubPages" = $false + "MaxReleases" = 3 + "Projects" = @() + "ExcludeProjects" = @() + } "generateALDocArtifact" = $false "deployALDocArtifact" = $false "ALDocMaxReleases" = 0 From e58731e6c1900fd9d7fafb56ef24dfaecbd8363f Mon Sep 17 00:00:00 2001 From: freddydk Date: Sun, 8 Oct 2023 19:21:57 +0200 Subject: [PATCH 096/235] hash --- Actions/AL-Go-Helper.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Actions/AL-Go-Helper.ps1 b/Actions/AL-Go-Helper.ps1 index c1f98e0ce..034d713a5 100644 --- a/Actions/AL-Go-Helper.ps1 +++ b/Actions/AL-Go-Helper.ps1 @@ -457,7 +457,7 @@ function MergeCustomObjectIntoOrderedDictionary { $srcProp = $src."$prop" $dstPropType = $dstProp.GetType().Name $srcPropType = $srcProp.GetType().Name - if ($srcPropType -eq "PSCustomObject" -and $dstPropType -eq "OrderedDictionary") { + if ($srcPropType -eq "PSCustomObject" -and ($dstPropType -eq "OrderedDictionary" -or $dstPropType -eq "Hashtable")) { MergeCustomObjectIntoOrderedDictionary -dst $dst."$prop" -src $srcProp } elseif ($dstPropType -ne $srcPropType -and !($srcPropType -eq "Int64" -and $dstPropType -eq "Int32")) { From 47d1a3a975ad50a79eba137f71423e43479c8d38 Mon Sep 17 00:00:00 2001 From: freddydk Date: Sun, 8 Oct 2023 19:26:36 +0200 Subject: [PATCH 097/235] ordered --- Actions/AL-Go-Helper.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Actions/AL-Go-Helper.ps1 b/Actions/AL-Go-Helper.ps1 index 034d713a5..43a5da6bf 100644 --- a/Actions/AL-Go-Helper.ps1 +++ b/Actions/AL-Go-Helper.ps1 @@ -457,7 +457,7 @@ function MergeCustomObjectIntoOrderedDictionary { $srcProp = $src."$prop" $dstPropType = $dstProp.GetType().Name $srcPropType = $srcProp.GetType().Name - if ($srcPropType -eq "PSCustomObject" -and ($dstPropType -eq "OrderedDictionary" -or $dstPropType -eq "Hashtable")) { + if ($srcPropType -eq "PSCustomObject" -and $dstPropType -eq "OrderedDictionary") { MergeCustomObjectIntoOrderedDictionary -dst $dst."$prop" -src $srcProp } elseif ($dstPropType -ne $srcPropType -and !($srcPropType -eq "Int64" -and $dstPropType -eq "Int32")) { @@ -622,7 +622,7 @@ function ReadSettings { "PullRequestTrigger" = "pull_request_target" "fullBuildPatterns" = @() "excludeEnvironments" = @() - "ALDoc" = @{ + "ALDoc" = [ordered]@{ "ContinuousDeployment" = $false "DeployToGitHubPages" = $false "MaxReleases" = 3 From ce45cba01cf2ba468401d5f7d3659ffd2557a746 Mon Sep 17 00:00:00 2001 From: freddydk Date: Sun, 8 Oct 2023 19:58:42 +0200 Subject: [PATCH 098/235] struc2 --- Actions/AL-Go-Helper.ps1 | 7 ++----- Actions/BuildALDoc/BuildALDoc.ps1 | 15 ++++++++------- .../DetermineDeploymentEnvironments.ps1 | 8 ++++---- 3 files changed, 14 insertions(+), 16 deletions(-) diff --git a/Actions/AL-Go-Helper.ps1 b/Actions/AL-Go-Helper.ps1 index 43a5da6bf..d1d926aba 100644 --- a/Actions/AL-Go-Helper.ps1 +++ b/Actions/AL-Go-Helper.ps1 @@ -628,12 +628,9 @@ function ReadSettings { "MaxReleases" = 3 "Projects" = @() "ExcludeProjects" = @() + "Header" = "Documentation for {REPOSITORY} {VERSION}" + "Footer" = "Made with AL-Go for GitHub, ALDoc and DocFx" } - "generateALDocArtifact" = $false - "deployALDocArtifact" = $false - "ALDocMaxReleases" = 0 - "ALDocProjects" = @() - "ALDocExcludeProjects" = @() } # Read settings from files and merge them into the settings object diff --git a/Actions/BuildALDoc/BuildALDoc.ps1 b/Actions/BuildALDoc/BuildALDoc.ps1 index 1833ebf4b..952a89924 100644 --- a/Actions/BuildALDoc/BuildALDoc.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.ps1 @@ -8,9 +8,9 @@ DownloadAndImportBcContainerHelper $settings = $env:Settings | ConvertFrom-Json -$projects = $settings.ALDocProjects -$excludeProjects = $settings.ALDocExcludeProjects -$maxReleases = $settings.ALDocMaxReleases +$projects = $settings.ALDoc.Projects +$excludeProjects = $settings.ALDoc.ExcludeProjects +$maxReleases = $settings.ALDoc.MaxReleases $artifactsFolder = Join-Path $ENV:GITHUB_WORKSPACE ".artifacts" $releases = @() @@ -36,9 +36,10 @@ foreach($release in $releases) { Get-ChildItem -Path $tempFolder -Recurse -File | ForEach-Object { Write-Host "- $($_.FullName.Substring($tempFolder.Length+1))" } $allApps,$allDependencies = CalculateProjectsAndApps -tempFolder $tempFolder -projects $projects -excludeProjects $excludeProjects -refname $ENV:GITHUB_REF_NAME $version = $release.Name - $header = "Documentation for $ENV:GITHUB_REPOSITORY $version" + $header = $settings.ALDoc.Header.Replace('{REPOSITORY}',$ENV:GITHUB_REPOSITORY).Replace('{VERSION}',$version) + $footer = $settings.ALDoc.Footer.Replace('{REPOSITORY}',$ENV:GITHUB_REPOSITORY).Replace('{VERSION}',$version) $releaseNotes = $release.body - GenerateDocsSite -version $version -allVersions $versions -allApps $allApps -repoName $settings.repoName -releaseNotes $releaseNotes -header $header -docsPath $docsPath -logLevel $logLevel + GenerateDocsSite -version $version -allVersions $versions -allApps $allApps -repoName $settings.repoName -releaseNotes $releaseNotes -header $header -footer $footer -docsPath $docsPath -logLevel $logLevel do { try { $retry = $false @@ -46,7 +47,7 @@ foreach($release in $releases) { Rename-Item -Path (join-Path $docsPath "_site") -NewName $version } catch { - $retry = $true + $retry = $true } } while ($retry) } @@ -76,4 +77,4 @@ if ($latestReleaseTag) { else { $releaseNotes = '' } -GenerateDocsSite -version '' -allVersions $versions -allApps $allApps -repoName $settings.repoName -releaseNotes $releaseNotes -header $header -docsPath $docsPath -logLevel $logLevel +GenerateDocsSite -version '' -allVersions $versions -allApps $allApps -repoName $settings.repoName -releaseNotes $releaseNotes -header $header -footer $footer -docsPath $docsPath -logLevel $logLevel diff --git a/Actions/DetermineDeploymentEnvironments/DetermineDeploymentEnvironments.ps1 b/Actions/DetermineDeploymentEnvironments/DetermineDeploymentEnvironments.ps1 index bf71e2ae9..45e288dea 100644 --- a/Actions/DetermineDeploymentEnvironments/DetermineDeploymentEnvironments.ps1 +++ b/Actions/DetermineDeploymentEnvironments/DetermineDeploymentEnvironments.ps1 @@ -185,8 +185,8 @@ Write-Host "EnvironmentCount=$($deploymentEnvironments.Keys.Count)" Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "UnknownEnvironment=$unknownEnvironment" Write-Host "UnknownEnvironment=$unknownEnvironment" -Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "GenerateALDocArtifact=$([int]($settings.generateALDocArtifact -or $settings.deployALDocArtifact))" -Write-Host "GenerateALDocArtifact=$([int]($settings.generateALDocArtifact -or $settings.deployALDocArtifact))" +Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "GenerateALDocArtifact=$([int]($settings.ALDoc.ContinuousDeployment -or $settings.ALDoc.DeployToGitHubPages))" +Write-Host "GenerateALDocArtifact=$([int]($settings.ALDoc.ContinuousDeployment -or $settings.ALDoc.DeployToGitHubPages))" -Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "DeployALDocArtifact=$([int]$settings.deployALDocArtifact)" -Write-Host "DeployALDocArtifact=$([int]$settings.deployALDocArtifact)" +Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "DeployALDocArtifact=$([int]$settings.ALDoc.DeployToGitHubPages)" +Write-Host "DeployALDocArtifact=$([int]$settings.ALDoc.DeployToGitHubPages)" From b9abbbf191ad8cb6ff66e832ffd7900210602d5b Mon Sep 17 00:00:00 2001 From: freddydk Date: Sun, 8 Oct 2023 20:33:33 +0200 Subject: [PATCH 099/235] default --- Actions/AL-Go-Helper.ps1 | 2 +- .../DetermineDeploymentEnvironments.ps1 | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Actions/AL-Go-Helper.ps1 b/Actions/AL-Go-Helper.ps1 index d1d926aba..273d18981 100644 --- a/Actions/AL-Go-Helper.ps1 +++ b/Actions/AL-Go-Helper.ps1 @@ -624,7 +624,7 @@ function ReadSettings { "excludeEnvironments" = @() "ALDoc" = [ordered]@{ "ContinuousDeployment" = $false - "DeployToGitHubPages" = $false + "DeployToGitHubPages" = $true "MaxReleases" = 3 "Projects" = @() "ExcludeProjects" = @() diff --git a/Actions/DetermineDeploymentEnvironments/DetermineDeploymentEnvironments.ps1 b/Actions/DetermineDeploymentEnvironments/DetermineDeploymentEnvironments.ps1 index 45e288dea..c97d6a760 100644 --- a/Actions/DetermineDeploymentEnvironments/DetermineDeploymentEnvironments.ps1 +++ b/Actions/DetermineDeploymentEnvironments/DetermineDeploymentEnvironments.ps1 @@ -185,8 +185,8 @@ Write-Host "EnvironmentCount=$($deploymentEnvironments.Keys.Count)" Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "UnknownEnvironment=$unknownEnvironment" Write-Host "UnknownEnvironment=$unknownEnvironment" -Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "GenerateALDocArtifact=$([int]($settings.ALDoc.ContinuousDeployment -or $settings.ALDoc.DeployToGitHubPages))" -Write-Host "GenerateALDocArtifact=$([int]($settings.ALDoc.ContinuousDeployment -or $settings.ALDoc.DeployToGitHubPages))" +Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "GenerateALDocArtifact=$([int]$settings.ALDoc.ContinuousDeployment)" +Write-Host "GenerateALDocArtifact=$([int]$settings.ALDoc.ContinuousDeployment)" Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "DeployALDocArtifact=$([int]$settings.ALDoc.DeployToGitHubPages)" Write-Host "DeployALDocArtifact=$([int]$settings.ALDoc.DeployToGitHubPages)" From 018bd04a68cd7105a18fff5736ab8d9cdab61da5 Mon Sep 17 00:00:00 2001 From: freddydk Date: Sun, 8 Oct 2023 20:57:11 +0200 Subject: [PATCH 100/235] defaultMD --- Actions/AL-Go-Helper.ps1 | 2 ++ Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 | 13 +++++++++---- Actions/BuildALDoc/BuildALDoc.ps1 | 2 ++ 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/Actions/AL-Go-Helper.ps1 b/Actions/AL-Go-Helper.ps1 index 273d18981..8f897cf68 100644 --- a/Actions/AL-Go-Helper.ps1 +++ b/Actions/AL-Go-Helper.ps1 @@ -630,6 +630,8 @@ function ReadSettings { "ExcludeProjects" = @() "Header" = "Documentation for {REPOSITORY} {VERSION}" "Footer" = "Made with AL-Go for GitHub, ALDoc and DocFx" + "DefaultIndexMD" = "## Reference documentation\n\nThis is the generated reference documentation for [{REPOSITORY}](https://github.com/{REPOSITORY}).\n\nYou can use the navigation bar at the top and the table of contents to the left to navigate your documentation.\n\nYou can change this content by creating/editing the **{INDEXTEMPLATERELATIVEPATH}** file in your repository\n\n{RELEASENOTES}" + "DefaultReleaseMD" = "## Release reference documentation\n\nThis is the generated reference documentation for [{REPOSITORY}](https://github.com/{REPOSITORY}).\n\nYou can use the navigation bar at the top and the table of contents to the left to navigate your documentation.\n\nYou can change this content by creating/editing the **{INDEXTEMPLATERELATIVEPATH}** file in your repository\n\n{RELEASENOTES}" } } diff --git a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 index 3dabf9e01..057b841d0 100644 --- a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 @@ -73,8 +73,10 @@ function GenerateDocsSite { [hashtable] $allApps, [string] $repoName, [string] $releaseNotes, - [string] $header = "Documentation", - [string] $footer = "Made with AL-Go for GitHub, ALDoc and DocFx", + [string] $header, + [string] $footer, + [string] $defaultIndexMD, + [string] $defaultReleaseMD, [string] $docsPath, [string] $logLevel, [switch] $hostIt @@ -83,10 +85,13 @@ function GenerateDocsSite { $indexTemplateRelativePath = '.aldoc/index.md' if ($version) { $thisTemplateRelativePath = '.aldoc/release.md' + $thisDefaultMD = $defaultReleaseMD } else { $thisTemplateRelativePath = $indexTemplateRelativePath + $thisDefaultMD = $defaultIndexMD } + $indexTemplatePath = Join-Path $ENV:GITHUB_WORKSPACE $thisTemplateRelativePath if (-not (Test-Path $indexTemplatePath)) { $indexTemplatePath = Join-Path $ENV:GITHUB_WORKSPACE $indexTemplateRelativePath @@ -95,9 +100,9 @@ function GenerateDocsSite { $indexTemplate = Get-Content -Encoding utf8 -Path $indexTemplatePath -Raw } else { - $indexTemplate = "## Reference documentation`n`nThis is the generated reference documentation for [{REPOSITORY}](https://github.com/{REPOSITORY}).`n`nYou can use the navigation bar at the top and the table of contents to the left to navigate your documentation.`n`nYou can change this content by creating/editing the **{INDEXTEMPLATERELATIVEPATH}** file in your repository`n`n{RELEASENOTES}" + $indexTemplate = $thisDefaultMD } - $indexContent = $indexTemplate.Replace('{RELEASENOTES}',$releaseNotes).Replace('{VERSION}',$version).Replace('{REPOSITORY}',$ENV:GITHUB_REPOSITORY).Replace('{INDEXTEMPLATERELATIVEPATH}',$thisTemplateRelativePath) + $indexContent = $indexTemplate.Replace('{RELEASENOTES}',$releaseNotes).Replace('{INDEXTEMPLATERELATIVEPATH}',$thisTemplateRelativePath) $alDocPath = DownloadAlDoc $docfxPath = Join-Path ([System.IO.Path]::GetTempPath()) ([Guid]::NewGuid().ToString()) diff --git a/Actions/BuildALDoc/BuildALDoc.ps1 b/Actions/BuildALDoc/BuildALDoc.ps1 index 952a89924..88abb9565 100644 --- a/Actions/BuildALDoc/BuildALDoc.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.ps1 @@ -38,6 +38,8 @@ foreach($release in $releases) { $version = $release.Name $header = $settings.ALDoc.Header.Replace('{REPOSITORY}',$ENV:GITHUB_REPOSITORY).Replace('{VERSION}',$version) $footer = $settings.ALDoc.Footer.Replace('{REPOSITORY}',$ENV:GITHUB_REPOSITORY).Replace('{VERSION}',$version) + $defaultIndexMD = $settings.ALDoc.DefaultIndexMD.Replace('\n',"`n").Replace('{REPOSITORY}',$ENV:GITHUB_REPOSITORY).Replace('{VERSION}',$version) + $defaultReleaseMD = $settings.ALDoc.DefaultReleaseMD.Replace('\n',"`n").Replace('{REPOSITORY}',$ENV:GITHUB_REPOSITORY).Replace('{VERSION}',$version) $releaseNotes = $release.body GenerateDocsSite -version $version -allVersions $versions -allApps $allApps -repoName $settings.repoName -releaseNotes $releaseNotes -header $header -footer $footer -docsPath $docsPath -logLevel $logLevel do { From ff6a25ecc964d58c2e62e0db0e60174ecef6bd3d Mon Sep 17 00:00:00 2001 From: freddydk Date: Sun, 8 Oct 2023 21:15:58 +0200 Subject: [PATCH 101/235] md --- Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 | 3 +-- Actions/BuildALDoc/BuildALDoc.ps1 | 8 ++++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 index 057b841d0..943416d12 100644 --- a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 @@ -72,7 +72,6 @@ function GenerateDocsSite { [string[]] $allVersions, [hashtable] $allApps, [string] $repoName, - [string] $releaseNotes, [string] $header, [string] $footer, [string] $defaultIndexMD, @@ -102,7 +101,7 @@ function GenerateDocsSite { else { $indexTemplate = $thisDefaultMD } - $indexContent = $indexTemplate.Replace('{RELEASENOTES}',$releaseNotes).Replace('{INDEXTEMPLATERELATIVEPATH}',$thisTemplateRelativePath) + $indexContent = $indexTemplate.Replace('{REPOSITORY}',$ENV:GITHUB_REPOSITORY).Replace('{VERSION}',$version).Replace('{RELEASENOTES}',$releaseNotes).Replace('{INDEXTEMPLATERELATIVEPATH}',$thisTemplateRelativePath) $alDocPath = DownloadAlDoc $docfxPath = Join-Path ([System.IO.Path]::GetTempPath()) ([Guid]::NewGuid().ToString()) diff --git a/Actions/BuildALDoc/BuildALDoc.ps1 b/Actions/BuildALDoc/BuildALDoc.ps1 index 88abb9565..821daae95 100644 --- a/Actions/BuildALDoc/BuildALDoc.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.ps1 @@ -38,10 +38,10 @@ foreach($release in $releases) { $version = $release.Name $header = $settings.ALDoc.Header.Replace('{REPOSITORY}',$ENV:GITHUB_REPOSITORY).Replace('{VERSION}',$version) $footer = $settings.ALDoc.Footer.Replace('{REPOSITORY}',$ENV:GITHUB_REPOSITORY).Replace('{VERSION}',$version) - $defaultIndexMD = $settings.ALDoc.DefaultIndexMD.Replace('\n',"`n").Replace('{REPOSITORY}',$ENV:GITHUB_REPOSITORY).Replace('{VERSION}',$version) - $defaultReleaseMD = $settings.ALDoc.DefaultReleaseMD.Replace('\n',"`n").Replace('{REPOSITORY}',$ENV:GITHUB_REPOSITORY).Replace('{VERSION}',$version) + $defaultIndexMD = $settings.ALDoc.DefaultIndexMD.Replace('\n',"`n") + $defaultReleaseMD = $settings.ALDoc.DefaultReleaseMD.Replace('\n',"`n") $releaseNotes = $release.body - GenerateDocsSite -version $version -allVersions $versions -allApps $allApps -repoName $settings.repoName -releaseNotes $releaseNotes -header $header -footer $footer -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 do { try { $retry = $false @@ -79,4 +79,4 @@ if ($latestReleaseTag) { else { $releaseNotes = '' } -GenerateDocsSite -version '' -allVersions $versions -allApps $allApps -repoName $settings.repoName -releaseNotes $releaseNotes -header $header -footer $footer -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 From f1e5e77d6191545e0af1c4b3c5f0b9f95a66bc8b Mon Sep 17 00:00:00 2001 From: freddydk Date: Sun, 8 Oct 2023 21:17:51 +0200 Subject: [PATCH 102/235] defaults --- Actions/BuildALDoc/BuildALDoc.ps1 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Actions/BuildALDoc/BuildALDoc.ps1 b/Actions/BuildALDoc/BuildALDoc.ps1 index 821daae95..08307f1b9 100644 --- a/Actions/BuildALDoc/BuildALDoc.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.ps1 @@ -12,6 +12,10 @@ $projects = $settings.ALDoc.Projects $excludeProjects = $settings.ALDoc.ExcludeProjects $maxReleases = $settings.ALDoc.MaxReleases $artifactsFolder = Join-Path $ENV:GITHUB_WORKSPACE ".artifacts" +$header = $settings.ALDoc.Header.Replace('{REPOSITORY}',$ENV:GITHUB_REPOSITORY).Replace('{VERSION}',$version) +$footer = $settings.ALDoc.Footer.Replace('{REPOSITORY}',$ENV:GITHUB_REPOSITORY).Replace('{VERSION}',$version) +$defaultIndexMD = $settings.ALDoc.DefaultIndexMD.Replace('\n',"`n") +$defaultReleaseMD = $settings.ALDoc.DefaultReleaseMD.Replace('\n',"`n") $releases = @() if ($maxReleases -gt 0) { @@ -36,10 +40,6 @@ foreach($release in $releases) { Get-ChildItem -Path $tempFolder -Recurse -File | ForEach-Object { Write-Host "- $($_.FullName.Substring($tempFolder.Length+1))" } $allApps,$allDependencies = CalculateProjectsAndApps -tempFolder $tempFolder -projects $projects -excludeProjects $excludeProjects -refname $ENV:GITHUB_REF_NAME $version = $release.Name - $header = $settings.ALDoc.Header.Replace('{REPOSITORY}',$ENV:GITHUB_REPOSITORY).Replace('{VERSION}',$version) - $footer = $settings.ALDoc.Footer.Replace('{REPOSITORY}',$ENV:GITHUB_REPOSITORY).Replace('{VERSION}',$version) - $defaultIndexMD = $settings.ALDoc.DefaultIndexMD.Replace('\n',"`n") - $defaultReleaseMD = $settings.ALDoc.DefaultReleaseMD.Replace('\n',"`n") $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 do { From 5a71b42b4ccf45f6fa9e16c58cec090d00cfe0b8 Mon Sep 17 00:00:00 2001 From: freddydk Date: Sun, 8 Oct 2023 21:25:47 +0200 Subject: [PATCH 103/235] placeholders --- Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 | 11 ++++++++--- Actions/BuildALDoc/BuildALDoc.ps1 | 4 ++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 index 943416d12..9e91488a0 100644 --- a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 @@ -72,6 +72,7 @@ function GenerateDocsSite { [string[]] $allVersions, [hashtable] $allApps, [string] $repoName, + [string] $releaseNotes, [string] $header, [string] $footer, [string] $defaultIndexMD, @@ -81,6 +82,10 @@ function GenerateDocsSite { [switch] $hostIt ) + function ReplacePlaceHolders([string] $str) { + return $str.Replace('{REPOSITORY}',$ENV:GITHUB_REPOSITORY).Replace('{VERSION}',$version).Replace('{RELEASENOTES}',$releaseNotes) + } + $indexTemplateRelativePath = '.aldoc/index.md' if ($version) { $thisTemplateRelativePath = '.aldoc/release.md' @@ -101,7 +106,7 @@ function GenerateDocsSite { else { $indexTemplate = $thisDefaultMD } - $indexContent = $indexTemplate.Replace('{REPOSITORY}',$ENV:GITHUB_REPOSITORY).Replace('{VERSION}',$version).Replace('{RELEASENOTES}',$releaseNotes).Replace('{INDEXTEMPLATERELATIVEPATH}',$thisTemplateRelativePath) + $indexContent = ReplacePlaceHolders -str $indexTemplate.Replace('{INDEXTEMPLATERELATIVEPATH}',$thisTemplateRelativePath) $alDocPath = DownloadAlDoc $docfxPath = Join-Path ([System.IO.Path]::GetTempPath()) ([Guid]::NewGuid().ToString()) @@ -150,8 +155,8 @@ function GenerateDocsSite { Write-Host "Update docfx.json" $docfxJsonFile = Join-Path $docfxPath 'docfx.json' $docfxJson = Get-Content -Encoding utf8 -Path $docfxJsonFile | ConvertFrom-Json - $docfxJson.build.globalMetadata._appName = $header - $docfxJson.build.globalMetadata._appFooter = $footer + $docfxJson.build.globalMetadata._appName = ReplacePlaceHolders -str $header + $docfxJson.build.globalMetadata._appFooter = ReplacePlaceHolders -str $footer $docfxJson | ConvertTo-Json -Depth 99 | Set-Content -Path $docfxJsonFile -Encoding utf8 Write-Host "docfx.json:" diff --git a/Actions/BuildALDoc/BuildALDoc.ps1 b/Actions/BuildALDoc/BuildALDoc.ps1 index 08307f1b9..e4ed01e4f 100644 --- a/Actions/BuildALDoc/BuildALDoc.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.ps1 @@ -12,8 +12,8 @@ $projects = $settings.ALDoc.Projects $excludeProjects = $settings.ALDoc.ExcludeProjects $maxReleases = $settings.ALDoc.MaxReleases $artifactsFolder = Join-Path $ENV:GITHUB_WORKSPACE ".artifacts" -$header = $settings.ALDoc.Header.Replace('{REPOSITORY}',$ENV:GITHUB_REPOSITORY).Replace('{VERSION}',$version) -$footer = $settings.ALDoc.Footer.Replace('{REPOSITORY}',$ENV:GITHUB_REPOSITORY).Replace('{VERSION}',$version) +$header = $settings.ALDoc.Header +$footer = $settings.ALDoc.Footer $defaultIndexMD = $settings.ALDoc.DefaultIndexMD.Replace('\n',"`n") $defaultReleaseMD = $settings.ALDoc.DefaultReleaseMD.Replace('\n',"`n") From d914f03e0df8805123dd32c4d504009e77bfb22e Mon Sep 17 00:00:00 2001 From: freddydk Date: Sun, 8 Oct 2023 21:34:21 +0200 Subject: [PATCH 104/235] default md --- Actions/AL-Go-Helper.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Actions/AL-Go-Helper.ps1 b/Actions/AL-Go-Helper.ps1 index 8f897cf68..3a876d440 100644 --- a/Actions/AL-Go-Helper.ps1 +++ b/Actions/AL-Go-Helper.ps1 @@ -630,8 +630,8 @@ function ReadSettings { "ExcludeProjects" = @() "Header" = "Documentation for {REPOSITORY} {VERSION}" "Footer" = "Made with AL-Go for GitHub, ALDoc and DocFx" - "DefaultIndexMD" = "## Reference documentation\n\nThis is the generated reference documentation for [{REPOSITORY}](https://github.com/{REPOSITORY}).\n\nYou can use the navigation bar at the top and the table of contents to the left to navigate your documentation.\n\nYou can change this content by creating/editing the **{INDEXTEMPLATERELATIVEPATH}** file in your repository\n\n{RELEASENOTES}" - "DefaultReleaseMD" = "## Release reference documentation\n\nThis is the generated reference documentation for [{REPOSITORY}](https://github.com/{REPOSITORY}).\n\nYou can use the navigation bar at the top and the table of contents to the left to navigate your documentation.\n\nYou can change this content by creating/editing the **{INDEXTEMPLATERELATIVEPATH}** file in your repository\n\n{RELEASENOTES}" + "DefaultIndexMD" = "## Reference documentation\n\nThis is the generated reference documentation for [{REPOSITORY}](https://github.com/{REPOSITORY}).\n\nYou can use the navigation bar at the top and the table of contents to the left to navigate your documentation.\n\nYou can change this content by creating/editing the **{INDEXTEMPLATERELATIVEPATH}** file in your repository or use the ALDoc:DefaultIndexMD setting in your repository settings file (.github/AL-Go-Settings.json)\n\n{RELEASENOTES}" + "DefaultReleaseMD" = "## Release reference documentation\n\nThis is the generated reference documentation for [{REPOSITORY}](https://github.com/{REPOSITORY}).\n\nYou can use the navigation bar at the top and the table of contents to the left to navigate your documentation.\n\nYou can change this content by creating/editing the **{INDEXTEMPLATERELATIVEPATH}** file in your repository or use the ALDoc:DefaultReleaseMD setting in your repository settings file (.github/AL-Go-Settings.json)\n\n{RELEASENOTES}" } } From edb4115b83f694be532bc1b96d5cc7a1189ecc2c Mon Sep 17 00:00:00 2001 From: freddydk Date: Sun, 8 Oct 2023 21:42:17 +0200 Subject: [PATCH 105/235] header --- Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 | 13 +++++++++---- Actions/BuildALDoc/BuildALDoc.ps1 | 1 - 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 index 9e91488a0..6ea9e42fd 100644 --- a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 @@ -82,7 +82,12 @@ function GenerateDocsSite { [switch] $hostIt ) - function ReplacePlaceHolders([string] $str) { + function ReplacePlaceHolders { + Param( + [string] $str, + [string] $version, + [string] $releaseNotes + ) return $str.Replace('{REPOSITORY}',$ENV:GITHUB_REPOSITORY).Replace('{VERSION}',$version).Replace('{RELEASENOTES}',$releaseNotes) } @@ -106,7 +111,7 @@ function GenerateDocsSite { else { $indexTemplate = $thisDefaultMD } - $indexContent = ReplacePlaceHolders -str $indexTemplate.Replace('{INDEXTEMPLATERELATIVEPATH}',$thisTemplateRelativePath) + $indexContent = ReplacePlaceHolders -str $indexTemplate.Replace('{INDEXTEMPLATERELATIVEPATH}',$thisTemplateRelativePath) -version $version -releaseNotes $releaseNotes $alDocPath = DownloadAlDoc $docfxPath = Join-Path ([System.IO.Path]::GetTempPath()) ([Guid]::NewGuid().ToString()) @@ -155,8 +160,8 @@ function GenerateDocsSite { Write-Host "Update docfx.json" $docfxJsonFile = Join-Path $docfxPath 'docfx.json' $docfxJson = Get-Content -Encoding utf8 -Path $docfxJsonFile | ConvertFrom-Json - $docfxJson.build.globalMetadata._appName = ReplacePlaceHolders -str $header - $docfxJson.build.globalMetadata._appFooter = ReplacePlaceHolders -str $footer + $docfxJson.build.globalMetadata._appName = ReplacePlaceHolders -str $header -version $version -releaseNotes $releaseNotes + $docfxJson.build.globalMetadata._appFooter = ReplacePlaceHolders -str $footer -version $version -releaseNotes $releaseNotes $docfxJson | ConvertTo-Json -Depth 99 | Set-Content -Path $docfxJsonFile -Encoding utf8 Write-Host "docfx.json:" diff --git a/Actions/BuildALDoc/BuildALDoc.ps1 b/Actions/BuildALDoc/BuildALDoc.ps1 index e4ed01e4f..5b9c0c5c4 100644 --- a/Actions/BuildALDoc/BuildALDoc.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.ps1 @@ -66,7 +66,6 @@ foreach($version in $versions) { Get-ChildItem -Path $artifactsFolder -Depth 1 -File | ForEach-Object { Write-Host "- $($_.FullName.Substring($artifactsFolder.Length))" } $allApps,$allDependencies = CalculateProjectsAndApps -tempFolder $artifactsFolder -projects $projects -excludeProjects $excludeProjects -refname $ENV:GITHUB_REF_NAME -$header = "Documentation for $ENV:GITHUB_REPOSITORY" $releaseNotes = '' if ($latestReleaseTag) { try { From b53ef6a63ed324baf4f1be86b56f11b80f56e83f Mon Sep 17 00:00:00 2001 From: freddydk Date: Tue, 10 Oct 2023 15:10:22 +0200 Subject: [PATCH 106/235] get repository --- Actions/AL-Go-Helper.ps1 | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/Actions/AL-Go-Helper.ps1 b/Actions/AL-Go-Helper.ps1 index 3a876d440..8a5b95c0b 100644 --- a/Actions/AL-Go-Helper.ps1 +++ b/Actions/AL-Go-Helper.ps1 @@ -1085,6 +1085,7 @@ function CheckAppDependencyProbingPaths { [hashTable] $settings, $token, [string] $baseFolder = $ENV:GITHUB_WORKSPACE, + [string] $repository = $ENV:GITHUB_REPOSITORY, [string] $project = '.', [string[]] $includeOnlyAppIds ) @@ -1105,10 +1106,10 @@ function CheckAppDependencyProbingPaths { throw "The Setting AppDependencyProbingPaths needs to contain a repo property, pointing to the repository on which your project have a dependency" } if ($dependency.Repo -eq ".") { - $dependency.Repo = "$ENV:GITHUB_SERVER_URL/$ENV:GITHUB_REPOSITORY" + $dependency.Repo = "https://github.com/$repository" } elseif ($dependency.Repo -notlike "https://*") { - $dependency.Repo = "$ENV:GITHUB_SERVER_URL/$($dependency.Repo)" + $dependency.Repo = "https://github.com/$($dependency.Repo)" } if (-not ($dependency.PsObject.Properties.name -eq "Version")) { $dependency | Add-Member -name "Version" -MemberType NoteProperty -Value "latest" @@ -1170,7 +1171,7 @@ function CheckAppDependencyProbingPaths { $thisIncludeOnlyAppIds = @($dependencyIds + $includeOnlyAppIds + $dependency.alwaysIncludeApps) $depSettings = ReadSettings -baseFolder $baseFolder -project $depProject -workflowName "CI/CD" $depSettings = AnalyzeRepo -settings $depSettings -baseFolder $baseFolder -project $depProject -includeOnlyAppIds $thisIncludeOnlyAppIds -doNotCheckArtifactSetting -doNotIssueWarnings - $depSettings = CheckAppDependencyProbingPaths -settings $depSettings -token $token -baseFolder $baseFolder -project $depProject -includeOnlyAppIds $thisIncludeOnlyAppIds + $depSettings = CheckAppDependencyProbingPaths -settings $depSettings -token $token -baseFolder $baseFolder -repository $repository -project $depProject -includeOnlyAppIds $thisIncludeOnlyAppIds $projectPath = Join-Path $baseFolder $project -Resolve Push-Location $projectPath @@ -1500,6 +1501,8 @@ function CreateDevEnv { [string] $caller = 'local', [Parameter(Mandatory = $true)] [string] $baseFolder, + [Parameter(Mandatory = $true)] + [string] $repository = $ENV:GITHUB_REPOSITORY, [string] $project, [string] $userName = $env:Username, @@ -1527,6 +1530,16 @@ function CreateDevEnv { throw "Specified parameters doesn't match kind=$kind" } + if ("$repository" -eq "") { + Push-Location $baseFolder + try { + $repoInfo = invoke-gh repo view --json owner,name + $repository = "$($repoInfo.owner.login)/$($repoInfo.name)" + } + finally { + Pop-Location + } + } $projectFolder = Join-Path $baseFolder $project -Resolve $dependenciesFolder = Join-Path $projectFolder ".dependencies" $runAlPipelineParams = @{} From c00903859b74c8a6be6667afa0fc80f2bf324fc1 Mon Sep 17 00:00:00 2001 From: freddydk Date: Tue, 10 Oct 2023 15:11:17 +0200 Subject: [PATCH 107/235] not mandatory --- Actions/AL-Go-Helper.ps1 | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Actions/AL-Go-Helper.ps1 b/Actions/AL-Go-Helper.ps1 index 8a5b95c0b..f2eaffc8e 100644 --- a/Actions/AL-Go-Helper.ps1 +++ b/Actions/AL-Go-Helper.ps1 @@ -1501,8 +1501,7 @@ function CreateDevEnv { [string] $caller = 'local', [Parameter(Mandatory = $true)] [string] $baseFolder, - [Parameter(Mandatory = $true)] - [string] $repository = $ENV:GITHUB_REPOSITORY, + [string] $repository = "$ENV:GITHUB_REPOSITORY", [string] $project, [string] $userName = $env:Username, From 33920604a0a755475dd41111631f4ff7e60b0d1e Mon Sep 17 00:00:00 2001 From: freddydk Date: Tue, 10 Oct 2023 15:15:10 +0200 Subject: [PATCH 108/235] repo --- Actions/AL-Go-Helper.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Actions/AL-Go-Helper.ps1 b/Actions/AL-Go-Helper.ps1 index f2eaffc8e..7e5182416 100644 --- a/Actions/AL-Go-Helper.ps1 +++ b/Actions/AL-Go-Helper.ps1 @@ -1669,7 +1669,7 @@ function CreateDevEnv { } } $settings = AnalyzeRepo -settings $settings -baseFolder $baseFolder -project $project @params - $settings = CheckAppDependencyProbingPaths -settings $settings -baseFolder $baseFolder -project $project + $settings = CheckAppDependencyProbingPaths -settings $settings -baseFolder $baseFolder -repository $repository -project $project if (!$accept_insiderEula -and ($settings.artifact -like 'https://bcinsider.blob.core.windows.net/*' -or $settings.artifact -like 'https://bcinsider.azureedge.net/*')) { Read-Host 'Press ENTER to accept the Business Central insider EULA (https://go.microsoft.com/fwlink/?linkid=2245051) or break the script to cancel' From 677c6e8ca1da04076b8495a85baf5ea40bc27be8 Mon Sep 17 00:00:00 2001 From: freddydk Date: Tue, 10 Oct 2023 15:16:44 +0200 Subject: [PATCH 109/235] str --- Actions/AL-Go-Helper.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Actions/AL-Go-Helper.ps1 b/Actions/AL-Go-Helper.ps1 index 7e5182416..caee35c95 100644 --- a/Actions/AL-Go-Helper.ps1 +++ b/Actions/AL-Go-Helper.ps1 @@ -1532,7 +1532,7 @@ function CreateDevEnv { if ("$repository" -eq "") { Push-Location $baseFolder try { - $repoInfo = invoke-gh repo view --json owner,name + $repoInfo = invoke-gh repo view --json "owner,name" $repository = "$($repoInfo.owner.login)/$($repoInfo.name)" } finally { From 4241ef6ad54e2158f3cc97fba0ef2c6c0295425c Mon Sep 17 00:00:00 2001 From: freddydk Date: Tue, 10 Oct 2023 15:18:58 +0200 Subject: [PATCH 110/235] return --- Actions/AL-Go-Helper.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Actions/AL-Go-Helper.ps1 b/Actions/AL-Go-Helper.ps1 index caee35c95..bc1c0c4a5 100644 --- a/Actions/AL-Go-Helper.ps1 +++ b/Actions/AL-Go-Helper.ps1 @@ -1532,7 +1532,7 @@ function CreateDevEnv { if ("$repository" -eq "") { Push-Location $baseFolder try { - $repoInfo = invoke-gh repo view --json "owner,name" + $repoInfo = invoke-gh -silent -returnValue repo view --json "owner,name" $repository = "$($repoInfo.owner.login)/$($repoInfo.name)" } finally { From 93f5ed25fd5024cb021e7d160fb156ab6a00644e Mon Sep 17 00:00:00 2001 From: freddydk Date: Tue, 10 Oct 2023 15:26:49 +0200 Subject: [PATCH 111/235] json --- Actions/AL-Go-Helper.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Actions/AL-Go-Helper.ps1 b/Actions/AL-Go-Helper.ps1 index bc1c0c4a5..f1a803b10 100644 --- a/Actions/AL-Go-Helper.ps1 +++ b/Actions/AL-Go-Helper.ps1 @@ -1532,7 +1532,7 @@ function CreateDevEnv { if ("$repository" -eq "") { Push-Location $baseFolder try { - $repoInfo = invoke-gh -silent -returnValue repo view --json "owner,name" + $repoInfo = invoke-gh -silent -returnValue repo view --json "owner,name" | ConvertFrom-Json $repository = "$($repoInfo.owner.login)/$($repoInfo.name)" } finally { From 5ad13c1f51d8f28dca47bde19339741a6042ba2e Mon Sep 17 00:00:00 2001 From: freddydk Date: Tue, 10 Oct 2023 15:32:35 +0200 Subject: [PATCH 112/235] remove env --- Actions/AL-Go-Helper.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Actions/AL-Go-Helper.ps1 b/Actions/AL-Go-Helper.ps1 index f1a803b10..b5ea57934 100644 --- a/Actions/AL-Go-Helper.ps1 +++ b/Actions/AL-Go-Helper.ps1 @@ -1156,7 +1156,7 @@ function CheckAppDependencyProbingPaths { } if ($dependency.release_status -eq "include") { - if ($dependency.Repo -ne "$ENV:GITHUB_SERVER_URL/$ENV:GITHUB_REPOSITORY") { + if ($dependency.Repo -ne "https://github.com/$repository") { OutputWarning "Dependencies with release_status 'include' must be to other projects in the same repository." } else { From c69f6b2c55dd31a9f0b1efd99fac861576c4cc5b Mon Sep 17 00:00:00 2001 From: freddydk Date: Sun, 15 Oct 2023 06:08:53 -0700 Subject: [PATCH 113/235] fix tests --- Tests/DetermineDeploymentEnvironments.Test.ps1 | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Tests/DetermineDeploymentEnvironments.Test.ps1 b/Tests/DetermineDeploymentEnvironments.Test.ps1 index 5083732d9..d9f57a8e1 100644 --- a/Tests/DetermineDeploymentEnvironments.Test.ps1 +++ b/Tests/DetermineDeploymentEnvironments.Test.ps1 @@ -56,7 +56,7 @@ Describe "DetermineDeploymentEnvironments Action Test" { return (ConvertTo-Json -Compress -Depth 99 -InputObject @{ "environments" = @( @{ "name" = "test"; "protection_rules" = @() }, @{ "name" = "another"; "protection_rules" = @() } ) }) } - $env:Settings = @{ "type" = "PTE"; "runs-on" = "ubuntu-latest"; "environments" = @(); "excludeEnvironments" = @( 'github-pages' ) } | ConvertTo-Json -Compress + $env:Settings = @{ "type" = "PTE"; "runs-on" = "ubuntu-latest"; "environments" = @(); "excludeEnvironments" = @( 'github-pages' ); "ALDoc" = @{ "ContinuousDeployment" = $false; "DeployToGitHubPages" = $false } } | ConvertTo-Json -Compress . (Join-Path $scriptRoot $scriptName) -getEnvironments '*' -type 'CD' PassGeneratedOutput $EnvironmentsMatrixJson | ConvertFrom-Json | ConvertTo-HashTable -recurse | Should -MatchHashtable @{"matrix"=@{"include"=@(@{"environment"="another";"os"="[""ubuntu-latest""]"};@{"environment"="test";"os"="[""ubuntu-latest""]"})};"fail-fast"=$false} @@ -79,7 +79,7 @@ Describe "DetermineDeploymentEnvironments Action Test" { return (ConvertTo-Json -Compress -Depth 99 -InputObject @( @{ "name" = "branch"; "protected" = $true }, @{ "name" = "main"; "protected" = $false } )) } - $env:Settings = @{ "type" = "PTE"; "runs-on" = "ubuntu-latest"; "environments" = @(); "excludeEnvironments" = @( 'github-pages' ) } | ConvertTo-Json -Compress + $env:Settings = @{ "type" = "PTE"; "runs-on" = "ubuntu-latest"; "environments" = @(); "excludeEnvironments" = @( 'github-pages' ); "ALDoc" = @{ "ContinuousDeployment" = $false; "DeployToGitHubPages" = $false } } | ConvertTo-Json -Compress . (Join-Path $scriptRoot $scriptName) -getEnvironments '*' -type 'CD' PassGeneratedOutput $EnvironmentsMatrixJson | ConvertFrom-Json | ConvertTo-HashTable -recurse | Should -MatchHashtable @{"matrix"=@{"include"=@(@{"environment"="another";"os"="[""ubuntu-latest""]"})};"fail-fast"=$false} @@ -104,7 +104,7 @@ Describe "DetermineDeploymentEnvironments Action Test" { return @{ "branch_policies" = @( @{ "name" = "branch" }, @{ "name" = "branch2" } ) } | ConvertTo-Json -Depth 99 -Compress } - $env:Settings = @{ "type" = "PTE"; "runs-on" = "ubuntu-latest"; "environments" = @(); "excludeEnvironments" = @( 'github-pages' ) } | ConvertTo-Json -Compress + $env:Settings = @{ "type" = "PTE"; "runs-on" = "ubuntu-latest"; "environments" = @(); "excludeEnvironments" = @( 'github-pages' ); "ALDoc" = @{ "ContinuousDeployment" = $false; "DeployToGitHubPages" = $false } } | ConvertTo-Json -Compress # Only another environment should be included when deploying from main . (Join-Path $scriptRoot $scriptName) -getEnvironments '*' -type 'CD' PassGeneratedOutput @@ -152,7 +152,7 @@ Describe "DetermineDeploymentEnvironments Action Test" { return (ConvertTo-Json -Compress -Depth 99 -InputObject @{ "environments" = @( @{ "name" = "test"; "protection_rules" = @() }; @{ "name" = "another"; "protection_rules" = @() } ) }) } - $settings = @{ "type" = "PTE"; "runs-on" = "ubuntu-latest"; "environments" = @("settingsenv"); "excludeEnvironments" = @( 'github-pages' ) } + $settings = @{ "type" = "PTE"; "runs-on" = "ubuntu-latest"; "environments" = @("settingsenv"); "excludeEnvironments" = @( 'github-pages' ); "ALDoc" = @{ "ContinuousDeployment" = $false; "DeployToGitHubPages" = $false } } $env:Settings = $settings | ConvertTo-Json -Compress . (Join-Path $scriptRoot $scriptName) -getEnvironments '*' -type 'CD' PassGeneratedOutput @@ -210,7 +210,7 @@ Describe "DetermineDeploymentEnvironments Action Test" { # 2 environments defined in Settings - one PROD and one non-PROD (settings based) It 'Test calling action directly - 2 environments defined in Settings - one PROD and one non-PROD (settings based)' { - $settings = @{ "type" = "PTE"; "runs-on" = "ubuntu-latest"; "environments" = @("test (PROD)","another"); "excludeEnvironments" = @( 'github-pages' ) } + $settings = @{ "type" = "PTE"; "runs-on" = "ubuntu-latest"; "environments" = @("test (PROD)","another"); "excludeEnvironments" = @( 'github-pages' ); "ALDoc" = @{ "ContinuousDeployment" = $false; "DeployToGitHubPages" = $false } } Mock InvokeWebRequest -ParameterFilter { $uri -like '*/environments' } -MockWith { throw "Not supported" From b92cae99cff344d805a97977f1d93964926a4212 Mon Sep 17 00:00:00 2001 From: freddydk Date: Sun, 15 Oct 2023 06:36:17 -0700 Subject: [PATCH 114/235] fix test --- Tests/DetermineDeploymentEnvironments.Test.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/DetermineDeploymentEnvironments.Test.ps1 b/Tests/DetermineDeploymentEnvironments.Test.ps1 index d9f57a8e1..995c36b9b 100644 --- a/Tests/DetermineDeploymentEnvironments.Test.ps1 +++ b/Tests/DetermineDeploymentEnvironments.Test.ps1 @@ -193,7 +193,7 @@ Describe "DetermineDeploymentEnvironments Action Test" { } # One PROD environment and one non-PROD environment - only non-PROD environment is selected for CD - $settings = @{ "type" = "PTE"; "runs-on" = "ubuntu-latest"; "environments" = @("test (PROD)","another"); "excludeEnvironments" = @( 'github-pages' ) } + $settings = @{ "type" = "PTE"; "runs-on" = "ubuntu-latest"; "environments" = @("test (PROD)","another"); "excludeEnvironments" = @( 'github-pages' ); "ALDoc" = @{ "ContinuousDeployment" = $false; "DeployToGitHubPages" = $false } } $env:Settings = $settings | ConvertTo-Json -Compress . (Join-Path $scriptRoot $scriptName) -getEnvironments '*' -type 'CD' PassGeneratedOutput From b68687e9987e55360c694f4687ccd60e2a08e7f3 Mon Sep 17 00:00:00 2001 From: freddydk Date: Fri, 10 Nov 2023 11:41:43 +0100 Subject: [PATCH 115/235] add available check --- .../DetermineDeploymentEnvironments.ps1 | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/Actions/DetermineDeploymentEnvironments/DetermineDeploymentEnvironments.ps1 b/Actions/DetermineDeploymentEnvironments/DetermineDeploymentEnvironments.ps1 index c97d6a760..2d6b2414b 100644 --- a/Actions/DetermineDeploymentEnvironments/DetermineDeploymentEnvironments.ps1 +++ b/Actions/DetermineDeploymentEnvironments/DetermineDeploymentEnvironments.ps1 @@ -6,6 +6,19 @@ [string] $type ) +function IsGitHubPagesAvailable() { + $headers = GetHeader -token $env:GITHUB_TOKEN + $url = "$($ENV:GITHUB_API_URL)/repos/$($ENV:GITHUB_REPOSITORY)/pages" + try { + Write-Host "Requesting GitHub Pages settings from GitHub" + $ghPages = InvokeWebRequest -Headers $headers -Uri $url -ignoreErrors | ConvertFrom-Json + return $ghPages.build_type -eq 'workflow' + } + catch { + return $false + } +} + function GetGitHubEnvironments() { $headers = GetHeader -token $env:GITHUB_TOKEN $url = "$($ENV:GITHUB_API_URL)/repos/$($ENV:GITHUB_REPOSITORY)/environments" @@ -188,5 +201,5 @@ Write-Host "UnknownEnvironment=$unknownEnvironment" Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "GenerateALDocArtifact=$([int]$settings.ALDoc.ContinuousDeployment)" Write-Host "GenerateALDocArtifact=$([int]$settings.ALDoc.ContinuousDeployment)" -Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "DeployALDocArtifact=$([int]$settings.ALDoc.DeployToGitHubPages)" +Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "DeployALDocArtifact=$([int]($settings.ALDoc.DeployToGitHubPages -and (IsGitHubPagesAvailable())))" Write-Host "DeployALDocArtifact=$([int]$settings.ALDoc.DeployToGitHubPages)" From 7be9fda8824c8f0dd3f181cab5814ce41755f2e4 Mon Sep 17 00:00:00 2001 From: freddydk Date: Fri, 10 Nov 2023 11:50:10 +0100 Subject: [PATCH 116/235] calc deploy --- .../DetermineDeploymentEnvironments.ps1 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Actions/DetermineDeploymentEnvironments/DetermineDeploymentEnvironments.ps1 b/Actions/DetermineDeploymentEnvironments/DetermineDeploymentEnvironments.ps1 index 2d6b2414b..74d519bf4 100644 --- a/Actions/DetermineDeploymentEnvironments/DetermineDeploymentEnvironments.ps1 +++ b/Actions/DetermineDeploymentEnvironments/DetermineDeploymentEnvironments.ps1 @@ -201,5 +201,9 @@ Write-Host "UnknownEnvironment=$unknownEnvironment" Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "GenerateALDocArtifact=$([int]$settings.ALDoc.ContinuousDeployment)" Write-Host "GenerateALDocArtifact=$([int]$settings.ALDoc.ContinuousDeployment)" -Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "DeployALDocArtifact=$([int]($settings.ALDoc.DeployToGitHubPages -and (IsGitHubPagesAvailable())))" +$deployToGitHubPages = $settings.ALDoc.DeployToGitHubPages +if ($deployToGitHubPages) { + $deployToGitHubPages = IsGitHubPagesAvailable +} +Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "DeployALDocArtifact=$([int]$deployToGitHubPages)" Write-Host "DeployALDocArtifact=$([int]$settings.ALDoc.DeployToGitHubPages)" From 31f984e98d0087c203a1d6328b6ba1ec1c179327 Mon Sep 17 00:00:00 2001 From: freddydk Date: Fri, 10 Nov 2023 11:55:56 +0100 Subject: [PATCH 117/235] dump --- .../DetermineDeploymentEnvironments.ps1 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Actions/DetermineDeploymentEnvironments/DetermineDeploymentEnvironments.ps1 b/Actions/DetermineDeploymentEnvironments/DetermineDeploymentEnvironments.ps1 index 74d519bf4..9cd554f04 100644 --- a/Actions/DetermineDeploymentEnvironments/DetermineDeploymentEnvironments.ps1 +++ b/Actions/DetermineDeploymentEnvironments/DetermineDeploymentEnvironments.ps1 @@ -12,7 +12,8 @@ function IsGitHubPagesAvailable() { try { Write-Host "Requesting GitHub Pages settings from GitHub" $ghPages = InvokeWebRequest -Headers $headers -Uri $url -ignoreErrors | ConvertFrom-Json - return $ghPages.build_type -eq 'workflow' + $ghPages | Out-Host + return ($ghPages.build_type -eq 'workflow') } catch { return $false From ba33c42be111b65dc8409e7763edb45b8aa1f160 Mon Sep 17 00:00:00 2001 From: freddydk Date: Fri, 10 Nov 2023 11:57:47 +0100 Subject: [PATCH 118/235] dump the right value --- .../DetermineDeploymentEnvironments.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Actions/DetermineDeploymentEnvironments/DetermineDeploymentEnvironments.ps1 b/Actions/DetermineDeploymentEnvironments/DetermineDeploymentEnvironments.ps1 index 9cd554f04..15b4a4916 100644 --- a/Actions/DetermineDeploymentEnvironments/DetermineDeploymentEnvironments.ps1 +++ b/Actions/DetermineDeploymentEnvironments/DetermineDeploymentEnvironments.ps1 @@ -207,4 +207,4 @@ if ($deployToGitHubPages) { $deployToGitHubPages = IsGitHubPagesAvailable } Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "DeployALDocArtifact=$([int]$deployToGitHubPages)" -Write-Host "DeployALDocArtifact=$([int]$settings.ALDoc.DeployToGitHubPages)" +Write-Host "DeployALDocArtifact=$([int]$deployToGitHubPages)" From 531f5c5d4843659ff1b1fd94d1b1316df8423a7b Mon Sep 17 00:00:00 2001 From: freddydk Date: Fri, 10 Nov 2023 22:47:07 +0100 Subject: [PATCH 119/235] add workflow --- Actions/BuildALDoc/BuildALDoc.ps1 | 26 ++- Actions/BuildALDoc/action.yaml | 6 +- .../DetermineDeploymentEnvironments.ps1 | 27 ++- .../AppSource App/.github/workflows/CICD.yaml | 1 + .../.github/workflows/PublishALDoc.yaml | 204 ++++++++++++++++++ .../.github/workflows/CICD.yaml | 1 + .../.github/workflows/PublishALDoc.yaml | 204 ++++++++++++++++++ 7 files changed, 456 insertions(+), 13 deletions(-) create mode 100644 Templates/AppSource App/.github/workflows/PublishALDoc.yaml create mode 100644 Templates/Per Tenant Extension/.github/workflows/PublishALDoc.yaml diff --git a/Actions/BuildALDoc/BuildALDoc.ps1 b/Actions/BuildALDoc/BuildALDoc.ps1 index 5b9c0c5c4..e2bae6556 100644 --- a/Actions/BuildALDoc/BuildALDoc.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.ps1 @@ -1,6 +1,8 @@ Param( [Parameter(HelpMessage = "The GitHub token running the action", Mandatory = $false)] - [string] $token + [string] $token, + [Parameter(HelpMessage = "Artifacts to build documentation for", Mandatory = $true)] + [string] $artifacts ) . (Join-Path -Path $PSScriptRoot -ChildPath "..\AL-Go-Helper.ps1" -Resolve) @@ -12,6 +14,24 @@ $projects = $settings.ALDoc.Projects $excludeProjects = $settings.ALDoc.ExcludeProjects $maxReleases = $settings.ALDoc.MaxReleases $artifactsFolder = Join-Path $ENV:GITHUB_WORKSPACE ".artifacts" +$artifactsFolderCreated = $false +if ($artifacts -eq ".artifacts") { + $artifacts = $artifactsFolder +} +else { + $artifactsFolderCreated = $true + New-Item $artifactsFolder -ItemType Directory | Out-Null + $allArtifacts = @(GetArtifacts -token $token -api_url $ENV:GITHUB_API_URL -repository $ENV:GITHUB_REPOSITORY -mask "Apps" -projects '*' -Version 'latest' -branch $ENV:GITHUB_REF_NAME) + if ($allArtifacts) { + $allArtifacts | ForEach-Object { + $appFile = DownloadArtifact -token $token -artifact $_ -path $artifactsFolder + if (!(Test-Path $appFile)) { + throw "Unable to download artifact $($_.name)" + } + } + } +} + $header = $settings.ALDoc.Header $footer = $settings.ALDoc.Footer $defaultIndexMD = $settings.ALDoc.DefaultIndexMD.Replace('\n',"`n") @@ -79,3 +99,7 @@ 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 + +if ($artifactsFolderCreated) { + Remove-Item $artifactsFolder -Recurse -Force +} diff --git a/Actions/BuildALDoc/action.yaml b/Actions/BuildALDoc/action.yaml index 3a16304f9..16b3624d5 100644 --- a/Actions/BuildALDoc/action.yaml +++ b/Actions/BuildALDoc/action.yaml @@ -9,6 +9,9 @@ inputs: description: The GitHub token running the action required: false default: ${{ github.token }} + artifacts: + description: Artifacts to build documentation for + required: true runs: using: composite steps: @@ -17,10 +20,11 @@ runs: id: BuildALDoc env: _token: ${{ inputs.token }} + _artifacts: ${{ inputs.artifacts }} run: | $errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0 try { - ${{ github.action_path }}/BuildALDoc.ps1 -token $ENV:_token + ${{ github.action_path }}/BuildALDoc.ps1 -token $ENV:_token -artifacts $ENV:_artifacts } catch { Write-Host "::ERROR::Unexpected error when running action. Error Message: $($_.Exception.Message.Replace("`r",'').Replace("`n",' ')), StackTrace: $($_.ScriptStackTrace.Replace("`r",'').Replace("`n",' <- '))"; diff --git a/Actions/DetermineDeploymentEnvironments/DetermineDeploymentEnvironments.ps1 b/Actions/DetermineDeploymentEnvironments/DetermineDeploymentEnvironments.ps1 index 15b4a4916..b6372eac1 100644 --- a/Actions/DetermineDeploymentEnvironments/DetermineDeploymentEnvironments.ps1 +++ b/Actions/DetermineDeploymentEnvironments/DetermineDeploymentEnvironments.ps1 @@ -12,7 +12,6 @@ function IsGitHubPagesAvailable() { try { Write-Host "Requesting GitHub Pages settings from GitHub" $ghPages = InvokeWebRequest -Headers $headers -Uri $url -ignoreErrors | ConvertFrom-Json - $ghPages | Out-Host return ($ghPages.build_type -eq 'workflow') } catch { @@ -60,6 +59,22 @@ function Get-BranchesFromPolicy($ghEnvironment) { . (Join-Path -Path $PSScriptRoot -ChildPath "..\AL-Go-Helper.ps1" -Resolve) $settings = $env:Settings | ConvertFrom-Json | ConvertTo-HashTable -recurse + +$generateALDocArtifact = ($type -eq 'Publish') -or $settings.ALDoc.ContinuousDeployment +Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "GenerateALDocArtifact=$([int]$generateALDocArtifact)" +Write-Host "GenerateALDocArtifact=$([int]$generateALDocArtifact)" + +$deployToGitHubPages = $settings.ALDoc.DeployToGitHubPages +if ($deployToGitHubPages) { + $deployToGitHubPages = IsGitHubPagesAvailable +} +Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "DeployALDocArtifact=$([int]$deployToGitHubPages)" +Write-Host "DeployALDocArtifact=$([int]$deployToGitHubPages)" + +if ($getEnvironments -eq '-') { + exit 0 +} + Write-Host "Environment pattern to use: $getEnvironments" $ghEnvironments = @(GetGitHubEnvironments) @@ -198,13 +213,3 @@ Write-Host "EnvironmentCount=$($deploymentEnvironments.Keys.Count)" Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "UnknownEnvironment=$unknownEnvironment" Write-Host "UnknownEnvironment=$unknownEnvironment" - -Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "GenerateALDocArtifact=$([int]$settings.ALDoc.ContinuousDeployment)" -Write-Host "GenerateALDocArtifact=$([int]$settings.ALDoc.ContinuousDeployment)" - -$deployToGitHubPages = $settings.ALDoc.DeployToGitHubPages -if ($deployToGitHubPages) { - $deployToGitHubPages = IsGitHubPagesAvailable -} -Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "DeployALDocArtifact=$([int]$deployToGitHubPages)" -Write-Host "DeployALDocArtifact=$([int]$deployToGitHubPages)" diff --git a/Templates/AppSource App/.github/workflows/CICD.yaml b/Templates/AppSource App/.github/workflows/CICD.yaml index 7815882f1..1fce07e71 100644 --- a/Templates/AppSource App/.github/workflows/CICD.yaml +++ b/Templates/AppSource App/.github/workflows/CICD.yaml @@ -183,6 +183,7 @@ jobs: uses: microsoft/AL-Go-Actions/BuildALDoc@main with: shell: powershell + artifacts: '.artifacts' - name: Upload pages artifact uses: actions/upload-pages-artifact@v2 diff --git a/Templates/AppSource App/.github/workflows/PublishALDoc.yaml b/Templates/AppSource App/.github/workflows/PublishALDoc.yaml new file mode 100644 index 000000000..2996d7239 --- /dev/null +++ b/Templates/AppSource App/.github/workflows/PublishALDoc.yaml @@ -0,0 +1,204 @@ +name: ' Publish ALDoc Reference Documentation' + +on: + workflow_dispatch: + +permissions: + contents: read + actions: read + +defaults: + run: + shell: powershell + +env: + ALGoOrgSettings: ${{ vars.ALGoOrgSettings }} + ALGoRepoSettings: ${{ vars.ALGoRepoSettings }} + +jobs: + Initialization: + runs-on: [ windows-latest ] + name: Deploy ALDoc Documentation + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Initialize the workflow + id: init + uses: microsoft/AL-Go-Actions/WorkflowInitialize@main + with: + shell: powershell + eventId: "DO0097" + + - name: Read settings + uses: microsoft/AL-Go-Actions/ReadSettings@main + with: + shell: powershell + + - name: Determine Deployment Environments + id: DetermineDeploymentEnvironments + uses: microsoft/AL-Go-Actions/DetermineDeploymentEnvironments@main + env: + GITHUB_TOKEN: ${{ github.token }} + with: + shell: powershell + getEnvironments: '-' + type: 'Publish' + + - name: Setup Pages + if: steps.DetermineDeploymentEnvironments.outputs.deployALDocArtifact == 1 + uses: actions/configure-pages@v3 + + - name: Build ALDoc Documentation + uses: microsoft/AL-Go-Actions/BuildALDoc@main + with: + shell: powershell + artifacts: 'latest' + + - name: Upload pages artifact + uses: actions/upload-pages-artifact@v2 + with: + path: ".aldoc/_site/" + + - name: Deploy to GitHub Pages + if: steps.DetermineDeploymentEnvironments.outputs.deployALDocArtifact == 1 + id: deployment + uses: actions/deploy-pages@v2 + + + + + + + + - name: Read settings + id: ReadSettings + uses: microsoft/AL-Go-Actions/ReadSettings@main + with: + shell: powershell + + - name: Determine Deployment Environments + id: DetermineDeploymentEnvironments + uses: microsoft/AL-Go-Actions/DetermineDeploymentEnvironments@main + env: + GITHUB_TOKEN: ${{ github.token }} + with: + shell: powershell + getEnvironments: ${{ github.event.inputs.environmentName }} + type: 'Publish' + + - name: EnvName + id: envName + if: steps.DetermineDeploymentEnvironments.outputs.UnknownEnvironment == 1 + run: | + $errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0 + $envName = '${{ fromJson(steps.DetermineDeploymentEnvironments.outputs.environmentsMatrixJson).matrix.include[0].environment }}'.split(' ')[0] + Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "envName=$envName" + + - name: Read secrets + id: ReadSecrets + uses: microsoft/AL-Go-Actions/ReadSecrets@main + if: steps.DetermineDeploymentEnvironments.outputs.UnknownEnvironment == 1 + with: + shell: powershell + gitHubSecrets: ${{ toJson(secrets) }} + getSecrets: '${{ steps.envName.outputs.envName }}-AuthContext,${{ steps.envName.outputs.envName }}_AuthContext,AuthContext' + + - name: Authenticate + id: Authenticate + if: steps.DetermineDeploymentEnvironments.outputs.UnknownEnvironment == 1 + run: | + $envName = '${{ steps.envName.outputs.envName }}' + $secretName = '' + $secrets = '${{ steps.ReadSecrets.outputs.Secrets }}' | ConvertFrom-Json + $authContext = $null + "$($envName)-AuthContext", "$($envName)_AuthContext", "AuthContext" | ForEach-Object { + if (!($authContext)) { + if ($secrets."$_") { + Write-Host "Using $_ secret as AuthContext" + $authContext = $secrets."$_" + $secretName = $_ + } + } + } + if ($authContext) { + Write-Host "AuthContext provided in secret $secretName!" + Set-Content -Path $ENV:GITHUB_STEP_SUMMARY -value "AuthContext was provided in a secret called $secretName. Using this information for authentication." + } + else { + Write-Host "No AuthContext provided for $envName, initiating Device Code flow" + $ALGoHelperPath = "$([System.IO.Path]::GetTempFileName()).ps1" + $webClient = New-Object System.Net.WebClient + $webClient.DownloadFile('https://raw.githubusercontent.com/microsoft/AL-Go-Actions/main/AL-Go-Helper.ps1', $ALGoHelperPath) + . $ALGoHelperPath + DownloadAndImportBcContainerHelper + $authContext = New-BcAuthContext -includeDeviceLogin -deviceLoginTimeout ([TimeSpan]::FromSeconds(0)) + Set-Content -Path $ENV:GITHUB_STEP_SUMMARY -value "AL-Go needs access to the Business Central Environment $('${{ steps.envName.outputs.envName }}'.Split(' ')[0]) and could not locate a secret called ${{ steps.envName.outputs.envName }}_AuthContext`n`n$($authContext.message)" + Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "deviceCode=$($authContext.deviceCode)" + } + + Deploy: + needs: [ Initialization ] + if: needs.Initialization.outputs.environmentCount > 0 + strategy: ${{ fromJson(needs.Initialization.outputs.environmentsMatrixJson) }} + runs-on: ${{ fromJson(matrix.os) }} + name: Deploy to ${{ matrix.environment }} + environment: + name: ${{ matrix.environment }} + url: ${{ steps.Deploy.outputs.environmentUrl }} + env: + deviceCode: ${{ needs.Initialization.outputs.deviceCode }} + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: EnvName + id: envName + run: | + $errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0 + $envName = '${{ matrix.environment }}'.split(' ')[0] + Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "envName=$envName" + + - name: Read settings + uses: microsoft/AL-Go-Actions/ReadSettings@main + with: + shell: powershell + + - name: Read secrets + id: ReadSecrets + uses: microsoft/AL-Go-Actions/ReadSecrets@main + with: + shell: powershell + gitHubSecrets: ${{ toJson(secrets) }} + getSecrets: '${{ steps.envName.outputs.envName }}-AuthContext,${{ steps.envName.outputs.envName }}_AuthContext,AuthContext,${{ steps.envName.outputs.envName }}-EnvironmentName,${{ steps.envName.outputs.envName }}_EnvironmentName,EnvironmentName,projects' + + - name: Deploy + id: Deploy + uses: microsoft/AL-Go-Actions/Deploy@main + env: + Secrets: '${{ steps.ReadSecrets.outputs.Secrets }}' + with: + shell: powershell + environmentName: ${{ matrix.environment }} + artifacts: ${{ github.event.inputs.appVersion }} + type: 'Publish' + deploymentEnvironmentsJson: ${{ needs.Initialization.outputs.deploymentEnvironmentsJson }} + + PostProcess: + if: always() + runs-on: [ windows-latest ] + needs: [ Initialization, Deploy ] + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Finalize the workflow + id: PostProcess + uses: microsoft/AL-Go-Actions/WorkflowPostProcess@main + with: + shell: powershell + eventId: "DO0097" + telemetryScopeJson: ${{ needs.Initialization.outputs.telemetryScopeJson }} diff --git a/Templates/Per Tenant Extension/.github/workflows/CICD.yaml b/Templates/Per Tenant Extension/.github/workflows/CICD.yaml index 7815882f1..1fce07e71 100644 --- a/Templates/Per Tenant Extension/.github/workflows/CICD.yaml +++ b/Templates/Per Tenant Extension/.github/workflows/CICD.yaml @@ -183,6 +183,7 @@ jobs: uses: microsoft/AL-Go-Actions/BuildALDoc@main with: shell: powershell + artifacts: '.artifacts' - name: Upload pages artifact uses: actions/upload-pages-artifact@v2 diff --git a/Templates/Per Tenant Extension/.github/workflows/PublishALDoc.yaml b/Templates/Per Tenant Extension/.github/workflows/PublishALDoc.yaml new file mode 100644 index 000000000..2996d7239 --- /dev/null +++ b/Templates/Per Tenant Extension/.github/workflows/PublishALDoc.yaml @@ -0,0 +1,204 @@ +name: ' Publish ALDoc Reference Documentation' + +on: + workflow_dispatch: + +permissions: + contents: read + actions: read + +defaults: + run: + shell: powershell + +env: + ALGoOrgSettings: ${{ vars.ALGoOrgSettings }} + ALGoRepoSettings: ${{ vars.ALGoRepoSettings }} + +jobs: + Initialization: + runs-on: [ windows-latest ] + name: Deploy ALDoc Documentation + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Initialize the workflow + id: init + uses: microsoft/AL-Go-Actions/WorkflowInitialize@main + with: + shell: powershell + eventId: "DO0097" + + - name: Read settings + uses: microsoft/AL-Go-Actions/ReadSettings@main + with: + shell: powershell + + - name: Determine Deployment Environments + id: DetermineDeploymentEnvironments + uses: microsoft/AL-Go-Actions/DetermineDeploymentEnvironments@main + env: + GITHUB_TOKEN: ${{ github.token }} + with: + shell: powershell + getEnvironments: '-' + type: 'Publish' + + - name: Setup Pages + if: steps.DetermineDeploymentEnvironments.outputs.deployALDocArtifact == 1 + uses: actions/configure-pages@v3 + + - name: Build ALDoc Documentation + uses: microsoft/AL-Go-Actions/BuildALDoc@main + with: + shell: powershell + artifacts: 'latest' + + - name: Upload pages artifact + uses: actions/upload-pages-artifact@v2 + with: + path: ".aldoc/_site/" + + - name: Deploy to GitHub Pages + if: steps.DetermineDeploymentEnvironments.outputs.deployALDocArtifact == 1 + id: deployment + uses: actions/deploy-pages@v2 + + + + + + + + - name: Read settings + id: ReadSettings + uses: microsoft/AL-Go-Actions/ReadSettings@main + with: + shell: powershell + + - name: Determine Deployment Environments + id: DetermineDeploymentEnvironments + uses: microsoft/AL-Go-Actions/DetermineDeploymentEnvironments@main + env: + GITHUB_TOKEN: ${{ github.token }} + with: + shell: powershell + getEnvironments: ${{ github.event.inputs.environmentName }} + type: 'Publish' + + - name: EnvName + id: envName + if: steps.DetermineDeploymentEnvironments.outputs.UnknownEnvironment == 1 + run: | + $errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0 + $envName = '${{ fromJson(steps.DetermineDeploymentEnvironments.outputs.environmentsMatrixJson).matrix.include[0].environment }}'.split(' ')[0] + Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "envName=$envName" + + - name: Read secrets + id: ReadSecrets + uses: microsoft/AL-Go-Actions/ReadSecrets@main + if: steps.DetermineDeploymentEnvironments.outputs.UnknownEnvironment == 1 + with: + shell: powershell + gitHubSecrets: ${{ toJson(secrets) }} + getSecrets: '${{ steps.envName.outputs.envName }}-AuthContext,${{ steps.envName.outputs.envName }}_AuthContext,AuthContext' + + - name: Authenticate + id: Authenticate + if: steps.DetermineDeploymentEnvironments.outputs.UnknownEnvironment == 1 + run: | + $envName = '${{ steps.envName.outputs.envName }}' + $secretName = '' + $secrets = '${{ steps.ReadSecrets.outputs.Secrets }}' | ConvertFrom-Json + $authContext = $null + "$($envName)-AuthContext", "$($envName)_AuthContext", "AuthContext" | ForEach-Object { + if (!($authContext)) { + if ($secrets."$_") { + Write-Host "Using $_ secret as AuthContext" + $authContext = $secrets."$_" + $secretName = $_ + } + } + } + if ($authContext) { + Write-Host "AuthContext provided in secret $secretName!" + Set-Content -Path $ENV:GITHUB_STEP_SUMMARY -value "AuthContext was provided in a secret called $secretName. Using this information for authentication." + } + else { + Write-Host "No AuthContext provided for $envName, initiating Device Code flow" + $ALGoHelperPath = "$([System.IO.Path]::GetTempFileName()).ps1" + $webClient = New-Object System.Net.WebClient + $webClient.DownloadFile('https://raw.githubusercontent.com/microsoft/AL-Go-Actions/main/AL-Go-Helper.ps1', $ALGoHelperPath) + . $ALGoHelperPath + DownloadAndImportBcContainerHelper + $authContext = New-BcAuthContext -includeDeviceLogin -deviceLoginTimeout ([TimeSpan]::FromSeconds(0)) + Set-Content -Path $ENV:GITHUB_STEP_SUMMARY -value "AL-Go needs access to the Business Central Environment $('${{ steps.envName.outputs.envName }}'.Split(' ')[0]) and could not locate a secret called ${{ steps.envName.outputs.envName }}_AuthContext`n`n$($authContext.message)" + Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "deviceCode=$($authContext.deviceCode)" + } + + Deploy: + needs: [ Initialization ] + if: needs.Initialization.outputs.environmentCount > 0 + strategy: ${{ fromJson(needs.Initialization.outputs.environmentsMatrixJson) }} + runs-on: ${{ fromJson(matrix.os) }} + name: Deploy to ${{ matrix.environment }} + environment: + name: ${{ matrix.environment }} + url: ${{ steps.Deploy.outputs.environmentUrl }} + env: + deviceCode: ${{ needs.Initialization.outputs.deviceCode }} + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: EnvName + id: envName + run: | + $errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0 + $envName = '${{ matrix.environment }}'.split(' ')[0] + Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "envName=$envName" + + - name: Read settings + uses: microsoft/AL-Go-Actions/ReadSettings@main + with: + shell: powershell + + - name: Read secrets + id: ReadSecrets + uses: microsoft/AL-Go-Actions/ReadSecrets@main + with: + shell: powershell + gitHubSecrets: ${{ toJson(secrets) }} + getSecrets: '${{ steps.envName.outputs.envName }}-AuthContext,${{ steps.envName.outputs.envName }}_AuthContext,AuthContext,${{ steps.envName.outputs.envName }}-EnvironmentName,${{ steps.envName.outputs.envName }}_EnvironmentName,EnvironmentName,projects' + + - name: Deploy + id: Deploy + uses: microsoft/AL-Go-Actions/Deploy@main + env: + Secrets: '${{ steps.ReadSecrets.outputs.Secrets }}' + with: + shell: powershell + environmentName: ${{ matrix.environment }} + artifacts: ${{ github.event.inputs.appVersion }} + type: 'Publish' + deploymentEnvironmentsJson: ${{ needs.Initialization.outputs.deploymentEnvironmentsJson }} + + PostProcess: + if: always() + runs-on: [ windows-latest ] + needs: [ Initialization, Deploy ] + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Finalize the workflow + id: PostProcess + uses: microsoft/AL-Go-Actions/WorkflowPostProcess@main + with: + shell: powershell + eventId: "DO0097" + telemetryScopeJson: ${{ needs.Initialization.outputs.telemetryScopeJson }} From a53ece7944766b735a2bbebda41f9da74d74cbc6 Mon Sep 17 00:00:00 2001 From: freddydk Date: Fri, 10 Nov 2023 22:51:56 +0100 Subject: [PATCH 120/235] dups --- .../.github/workflows/PublishALDoc.yaml | 139 +----------------- 1 file changed, 2 insertions(+), 137 deletions(-) diff --git a/Templates/Per Tenant Extension/.github/workflows/PublishALDoc.yaml b/Templates/Per Tenant Extension/.github/workflows/PublishALDoc.yaml index 2996d7239..2b6eefde4 100644 --- a/Templates/Per Tenant Extension/.github/workflows/PublishALDoc.yaml +++ b/Templates/Per Tenant Extension/.github/workflows/PublishALDoc.yaml @@ -1,4 +1,4 @@ -name: ' Publish ALDoc Reference Documentation' +name: ' Publish ALDoc Documentation' on: workflow_dispatch: @@ -16,7 +16,7 @@ env: ALGoRepoSettings: ${{ vars.ALGoRepoSettings }} jobs: - Initialization: + DeployALDoc: runs-on: [ windows-latest ] name: Deploy ALDoc Documentation environment: @@ -67,138 +67,3 @@ jobs: if: steps.DetermineDeploymentEnvironments.outputs.deployALDocArtifact == 1 id: deployment uses: actions/deploy-pages@v2 - - - - - - - - - name: Read settings - id: ReadSettings - uses: microsoft/AL-Go-Actions/ReadSettings@main - with: - shell: powershell - - - name: Determine Deployment Environments - id: DetermineDeploymentEnvironments - uses: microsoft/AL-Go-Actions/DetermineDeploymentEnvironments@main - env: - GITHUB_TOKEN: ${{ github.token }} - with: - shell: powershell - getEnvironments: ${{ github.event.inputs.environmentName }} - type: 'Publish' - - - name: EnvName - id: envName - if: steps.DetermineDeploymentEnvironments.outputs.UnknownEnvironment == 1 - run: | - $errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0 - $envName = '${{ fromJson(steps.DetermineDeploymentEnvironments.outputs.environmentsMatrixJson).matrix.include[0].environment }}'.split(' ')[0] - Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "envName=$envName" - - - name: Read secrets - id: ReadSecrets - uses: microsoft/AL-Go-Actions/ReadSecrets@main - if: steps.DetermineDeploymentEnvironments.outputs.UnknownEnvironment == 1 - with: - shell: powershell - gitHubSecrets: ${{ toJson(secrets) }} - getSecrets: '${{ steps.envName.outputs.envName }}-AuthContext,${{ steps.envName.outputs.envName }}_AuthContext,AuthContext' - - - name: Authenticate - id: Authenticate - if: steps.DetermineDeploymentEnvironments.outputs.UnknownEnvironment == 1 - run: | - $envName = '${{ steps.envName.outputs.envName }}' - $secretName = '' - $secrets = '${{ steps.ReadSecrets.outputs.Secrets }}' | ConvertFrom-Json - $authContext = $null - "$($envName)-AuthContext", "$($envName)_AuthContext", "AuthContext" | ForEach-Object { - if (!($authContext)) { - if ($secrets."$_") { - Write-Host "Using $_ secret as AuthContext" - $authContext = $secrets."$_" - $secretName = $_ - } - } - } - if ($authContext) { - Write-Host "AuthContext provided in secret $secretName!" - Set-Content -Path $ENV:GITHUB_STEP_SUMMARY -value "AuthContext was provided in a secret called $secretName. Using this information for authentication." - } - else { - Write-Host "No AuthContext provided for $envName, initiating Device Code flow" - $ALGoHelperPath = "$([System.IO.Path]::GetTempFileName()).ps1" - $webClient = New-Object System.Net.WebClient - $webClient.DownloadFile('https://raw.githubusercontent.com/microsoft/AL-Go-Actions/main/AL-Go-Helper.ps1', $ALGoHelperPath) - . $ALGoHelperPath - DownloadAndImportBcContainerHelper - $authContext = New-BcAuthContext -includeDeviceLogin -deviceLoginTimeout ([TimeSpan]::FromSeconds(0)) - Set-Content -Path $ENV:GITHUB_STEP_SUMMARY -value "AL-Go needs access to the Business Central Environment $('${{ steps.envName.outputs.envName }}'.Split(' ')[0]) and could not locate a secret called ${{ steps.envName.outputs.envName }}_AuthContext`n`n$($authContext.message)" - Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "deviceCode=$($authContext.deviceCode)" - } - - Deploy: - needs: [ Initialization ] - if: needs.Initialization.outputs.environmentCount > 0 - strategy: ${{ fromJson(needs.Initialization.outputs.environmentsMatrixJson) }} - runs-on: ${{ fromJson(matrix.os) }} - name: Deploy to ${{ matrix.environment }} - environment: - name: ${{ matrix.environment }} - url: ${{ steps.Deploy.outputs.environmentUrl }} - env: - deviceCode: ${{ needs.Initialization.outputs.deviceCode }} - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: EnvName - id: envName - run: | - $errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0 - $envName = '${{ matrix.environment }}'.split(' ')[0] - Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "envName=$envName" - - - name: Read settings - uses: microsoft/AL-Go-Actions/ReadSettings@main - with: - shell: powershell - - - name: Read secrets - id: ReadSecrets - uses: microsoft/AL-Go-Actions/ReadSecrets@main - with: - shell: powershell - gitHubSecrets: ${{ toJson(secrets) }} - getSecrets: '${{ steps.envName.outputs.envName }}-AuthContext,${{ steps.envName.outputs.envName }}_AuthContext,AuthContext,${{ steps.envName.outputs.envName }}-EnvironmentName,${{ steps.envName.outputs.envName }}_EnvironmentName,EnvironmentName,projects' - - - name: Deploy - id: Deploy - uses: microsoft/AL-Go-Actions/Deploy@main - env: - Secrets: '${{ steps.ReadSecrets.outputs.Secrets }}' - with: - shell: powershell - environmentName: ${{ matrix.environment }} - artifacts: ${{ github.event.inputs.appVersion }} - type: 'Publish' - deploymentEnvironmentsJson: ${{ needs.Initialization.outputs.deploymentEnvironmentsJson }} - - PostProcess: - if: always() - runs-on: [ windows-latest ] - needs: [ Initialization, Deploy ] - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Finalize the workflow - id: PostProcess - uses: microsoft/AL-Go-Actions/WorkflowPostProcess@main - with: - shell: powershell - eventId: "DO0097" - telemetryScopeJson: ${{ needs.Initialization.outputs.telemetryScopeJson }} From f5fbbe846a41cc0aa816907960aa49f262c3885b Mon Sep 17 00:00:00 2001 From: freddydk Date: Fri, 10 Nov 2023 22:59:44 +0100 Subject: [PATCH 121/235] permissions --- .../.github/workflows/PublishALDoc.yaml | 140 +----------------- .../.github/workflows/PublishALDoc.yaml | 1 + 2 files changed, 4 insertions(+), 137 deletions(-) diff --git a/Templates/AppSource App/.github/workflows/PublishALDoc.yaml b/Templates/AppSource App/.github/workflows/PublishALDoc.yaml index 2996d7239..da89c861b 100644 --- a/Templates/AppSource App/.github/workflows/PublishALDoc.yaml +++ b/Templates/AppSource App/.github/workflows/PublishALDoc.yaml @@ -1,4 +1,4 @@ -name: ' Publish ALDoc Reference Documentation' +name: ' Publish ALDoc Documentation' on: workflow_dispatch: @@ -6,6 +6,7 @@ on: permissions: contents: read actions: read + pages: write defaults: run: @@ -16,7 +17,7 @@ env: ALGoRepoSettings: ${{ vars.ALGoRepoSettings }} jobs: - Initialization: + DeployALDoc: runs-on: [ windows-latest ] name: Deploy ALDoc Documentation environment: @@ -67,138 +68,3 @@ jobs: if: steps.DetermineDeploymentEnvironments.outputs.deployALDocArtifact == 1 id: deployment uses: actions/deploy-pages@v2 - - - - - - - - - name: Read settings - id: ReadSettings - uses: microsoft/AL-Go-Actions/ReadSettings@main - with: - shell: powershell - - - name: Determine Deployment Environments - id: DetermineDeploymentEnvironments - uses: microsoft/AL-Go-Actions/DetermineDeploymentEnvironments@main - env: - GITHUB_TOKEN: ${{ github.token }} - with: - shell: powershell - getEnvironments: ${{ github.event.inputs.environmentName }} - type: 'Publish' - - - name: EnvName - id: envName - if: steps.DetermineDeploymentEnvironments.outputs.UnknownEnvironment == 1 - run: | - $errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0 - $envName = '${{ fromJson(steps.DetermineDeploymentEnvironments.outputs.environmentsMatrixJson).matrix.include[0].environment }}'.split(' ')[0] - Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "envName=$envName" - - - name: Read secrets - id: ReadSecrets - uses: microsoft/AL-Go-Actions/ReadSecrets@main - if: steps.DetermineDeploymentEnvironments.outputs.UnknownEnvironment == 1 - with: - shell: powershell - gitHubSecrets: ${{ toJson(secrets) }} - getSecrets: '${{ steps.envName.outputs.envName }}-AuthContext,${{ steps.envName.outputs.envName }}_AuthContext,AuthContext' - - - name: Authenticate - id: Authenticate - if: steps.DetermineDeploymentEnvironments.outputs.UnknownEnvironment == 1 - run: | - $envName = '${{ steps.envName.outputs.envName }}' - $secretName = '' - $secrets = '${{ steps.ReadSecrets.outputs.Secrets }}' | ConvertFrom-Json - $authContext = $null - "$($envName)-AuthContext", "$($envName)_AuthContext", "AuthContext" | ForEach-Object { - if (!($authContext)) { - if ($secrets."$_") { - Write-Host "Using $_ secret as AuthContext" - $authContext = $secrets."$_" - $secretName = $_ - } - } - } - if ($authContext) { - Write-Host "AuthContext provided in secret $secretName!" - Set-Content -Path $ENV:GITHUB_STEP_SUMMARY -value "AuthContext was provided in a secret called $secretName. Using this information for authentication." - } - else { - Write-Host "No AuthContext provided for $envName, initiating Device Code flow" - $ALGoHelperPath = "$([System.IO.Path]::GetTempFileName()).ps1" - $webClient = New-Object System.Net.WebClient - $webClient.DownloadFile('https://raw.githubusercontent.com/microsoft/AL-Go-Actions/main/AL-Go-Helper.ps1', $ALGoHelperPath) - . $ALGoHelperPath - DownloadAndImportBcContainerHelper - $authContext = New-BcAuthContext -includeDeviceLogin -deviceLoginTimeout ([TimeSpan]::FromSeconds(0)) - Set-Content -Path $ENV:GITHUB_STEP_SUMMARY -value "AL-Go needs access to the Business Central Environment $('${{ steps.envName.outputs.envName }}'.Split(' ')[0]) and could not locate a secret called ${{ steps.envName.outputs.envName }}_AuthContext`n`n$($authContext.message)" - Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "deviceCode=$($authContext.deviceCode)" - } - - Deploy: - needs: [ Initialization ] - if: needs.Initialization.outputs.environmentCount > 0 - strategy: ${{ fromJson(needs.Initialization.outputs.environmentsMatrixJson) }} - runs-on: ${{ fromJson(matrix.os) }} - name: Deploy to ${{ matrix.environment }} - environment: - name: ${{ matrix.environment }} - url: ${{ steps.Deploy.outputs.environmentUrl }} - env: - deviceCode: ${{ needs.Initialization.outputs.deviceCode }} - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: EnvName - id: envName - run: | - $errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0 - $envName = '${{ matrix.environment }}'.split(' ')[0] - Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "envName=$envName" - - - name: Read settings - uses: microsoft/AL-Go-Actions/ReadSettings@main - with: - shell: powershell - - - name: Read secrets - id: ReadSecrets - uses: microsoft/AL-Go-Actions/ReadSecrets@main - with: - shell: powershell - gitHubSecrets: ${{ toJson(secrets) }} - getSecrets: '${{ steps.envName.outputs.envName }}-AuthContext,${{ steps.envName.outputs.envName }}_AuthContext,AuthContext,${{ steps.envName.outputs.envName }}-EnvironmentName,${{ steps.envName.outputs.envName }}_EnvironmentName,EnvironmentName,projects' - - - name: Deploy - id: Deploy - uses: microsoft/AL-Go-Actions/Deploy@main - env: - Secrets: '${{ steps.ReadSecrets.outputs.Secrets }}' - with: - shell: powershell - environmentName: ${{ matrix.environment }} - artifacts: ${{ github.event.inputs.appVersion }} - type: 'Publish' - deploymentEnvironmentsJson: ${{ needs.Initialization.outputs.deploymentEnvironmentsJson }} - - PostProcess: - if: always() - runs-on: [ windows-latest ] - needs: [ Initialization, Deploy ] - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Finalize the workflow - id: PostProcess - uses: microsoft/AL-Go-Actions/WorkflowPostProcess@main - with: - shell: powershell - eventId: "DO0097" - telemetryScopeJson: ${{ needs.Initialization.outputs.telemetryScopeJson }} diff --git a/Templates/Per Tenant Extension/.github/workflows/PublishALDoc.yaml b/Templates/Per Tenant Extension/.github/workflows/PublishALDoc.yaml index 2b6eefde4..da89c861b 100644 --- a/Templates/Per Tenant Extension/.github/workflows/PublishALDoc.yaml +++ b/Templates/Per Tenant Extension/.github/workflows/PublishALDoc.yaml @@ -6,6 +6,7 @@ on: permissions: contents: read actions: read + pages: write defaults: run: From 74a31dbf7e237cd708e39e9586fde08ccbdb01f5 Mon Sep 17 00:00:00 2001 From: freddydk Date: Fri, 10 Nov 2023 23:04:54 +0100 Subject: [PATCH 122/235] generate rel notes --- Templates/AppSource App/.github/workflows/PublishALDoc.yaml | 2 +- .../Per Tenant Extension/.github/workflows/PublishALDoc.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Templates/AppSource App/.github/workflows/PublishALDoc.yaml b/Templates/AppSource App/.github/workflows/PublishALDoc.yaml index da89c861b..d637817bf 100644 --- a/Templates/AppSource App/.github/workflows/PublishALDoc.yaml +++ b/Templates/AppSource App/.github/workflows/PublishALDoc.yaml @@ -4,7 +4,7 @@ on: workflow_dispatch: permissions: - contents: read + contents: write actions: read pages: write diff --git a/Templates/Per Tenant Extension/.github/workflows/PublishALDoc.yaml b/Templates/Per Tenant Extension/.github/workflows/PublishALDoc.yaml index da89c861b..d637817bf 100644 --- a/Templates/Per Tenant Extension/.github/workflows/PublishALDoc.yaml +++ b/Templates/Per Tenant Extension/.github/workflows/PublishALDoc.yaml @@ -4,7 +4,7 @@ on: workflow_dispatch: permissions: - contents: read + contents: write actions: read pages: write From 6748ffed50f851dc2dd6024bdf2f2ccd69684794 Mon Sep 17 00:00:00 2001 From: freddydk Date: Fri, 10 Nov 2023 23:14:12 +0100 Subject: [PATCH 123/235] expand --- Actions/BuildALDoc/BuildALDoc.ps1 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Actions/BuildALDoc/BuildALDoc.ps1 b/Actions/BuildALDoc/BuildALDoc.ps1 index e2bae6556..f25393670 100644 --- a/Actions/BuildALDoc/BuildALDoc.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.ps1 @@ -24,10 +24,12 @@ else { $allArtifacts = @(GetArtifacts -token $token -api_url $ENV:GITHUB_API_URL -repository $ENV:GITHUB_REPOSITORY -mask "Apps" -projects '*' -Version 'latest' -branch $ENV:GITHUB_REF_NAME) if ($allArtifacts) { $allArtifacts | ForEach-Object { - $appFile = DownloadArtifact -token $token -artifact $_ -path $artifactsFolder - if (!(Test-Path $appFile)) { + $filename = DownloadArtifact -token $token -artifact $_ -path $artifactsFolder + if (!(Test-Path $filename)) { throw "Unable to download artifact $($_.name)" } + Expand-Archive -Path $filename -DestinationPath $artifactFolder -Force + Remove-Item -Path $filename -Force } } } From 5ec9496be3e32c70a74379e19c2c778fe16918f7 Mon Sep 17 00:00:00 2001 From: freddydk Date: Fri, 10 Nov 2023 23:15:33 +0100 Subject: [PATCH 124/235] s --- Actions/BuildALDoc/BuildALDoc.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Actions/BuildALDoc/BuildALDoc.ps1 b/Actions/BuildALDoc/BuildALDoc.ps1 index f25393670..eb5ad19a8 100644 --- a/Actions/BuildALDoc/BuildALDoc.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.ps1 @@ -28,7 +28,7 @@ else { if (!(Test-Path $filename)) { throw "Unable to download artifact $($_.name)" } - Expand-Archive -Path $filename -DestinationPath $artifactFolder -Force + Expand-Archive -Path $filename -DestinationPath $artifactsFolder -Force Remove-Item -Path $filename -Force } } From 1436ee1e3a94167fbe60f44d1839e86908ab5499 Mon Sep 17 00:00:00 2001 From: freddydk Date: Fri, 10 Nov 2023 23:24:02 +0100 Subject: [PATCH 125/235] with folder --- Actions/BuildALDoc/BuildALDoc.ps1 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Actions/BuildALDoc/BuildALDoc.ps1 b/Actions/BuildALDoc/BuildALDoc.ps1 index eb5ad19a8..91a95157b 100644 --- a/Actions/BuildALDoc/BuildALDoc.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.ps1 @@ -28,7 +28,8 @@ else { if (!(Test-Path $filename)) { throw "Unable to download artifact $($_.name)" } - Expand-Archive -Path $filename -DestinationPath $artifactsFolder -Force + $destFolder = Join-Path $artifactsFolder [System.IO.Path]::GetFileName($filename) + Expand-Archive -Path $filename -DestinationPath $destFolder -Force Remove-Item -Path $filename -Force } } From 5efff1e02132e5a7b253cff6f09c5a99fa3875bc Mon Sep 17 00:00:00 2001 From: freddydk Date: Fri, 10 Nov 2023 23:26:11 +0100 Subject: [PATCH 126/235] p --- Actions/BuildALDoc/BuildALDoc.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Actions/BuildALDoc/BuildALDoc.ps1 b/Actions/BuildALDoc/BuildALDoc.ps1 index 91a95157b..3a02f086d 100644 --- a/Actions/BuildALDoc/BuildALDoc.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.ps1 @@ -28,7 +28,7 @@ else { if (!(Test-Path $filename)) { throw "Unable to download artifact $($_.name)" } - $destFolder = Join-Path $artifactsFolder [System.IO.Path]::GetFileName($filename) + $destFolder = Join-Path $artifactsFolder ([System.IO.Path]::GetFileName($filename)) Expand-Archive -Path $filename -DestinationPath $destFolder -Force Remove-Item -Path $filename -Force } From c3e71cde383b07dc8251dd760abab97fb3171dc7 Mon Sep 17 00:00:00 2001 From: freddydk Date: Fri, 10 Nov 2023 23:27:34 +0100 Subject: [PATCH 127/235] noext --- Actions/BuildALDoc/BuildALDoc.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Actions/BuildALDoc/BuildALDoc.ps1 b/Actions/BuildALDoc/BuildALDoc.ps1 index 3a02f086d..abdcc0127 100644 --- a/Actions/BuildALDoc/BuildALDoc.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.ps1 @@ -28,7 +28,7 @@ else { if (!(Test-Path $filename)) { throw "Unable to download artifact $($_.name)" } - $destFolder = Join-Path $artifactsFolder ([System.IO.Path]::GetFileName($filename)) + $destFolder = Join-Path $artifactsFolder ([System.IO.Path]::GetFileNameWithoutExtension($filename)) Expand-Archive -Path $filename -DestinationPath $destFolder -Force Remove-Item -Path $filename -Force } From 435049780d0828d80c37389004bc5359ce463007 Mon Sep 17 00:00:00 2001 From: freddydk Date: Fri, 10 Nov 2023 23:31:00 +0100 Subject: [PATCH 128/235] id token --- Templates/AppSource App/.github/workflows/PublishALDoc.yaml | 1 + .../Per Tenant Extension/.github/workflows/PublishALDoc.yaml | 1 + 2 files changed, 2 insertions(+) diff --git a/Templates/AppSource App/.github/workflows/PublishALDoc.yaml b/Templates/AppSource App/.github/workflows/PublishALDoc.yaml index d637817bf..74487bd10 100644 --- a/Templates/AppSource App/.github/workflows/PublishALDoc.yaml +++ b/Templates/AppSource App/.github/workflows/PublishALDoc.yaml @@ -7,6 +7,7 @@ permissions: contents: write actions: read pages: write + id-token: write defaults: run: diff --git a/Templates/Per Tenant Extension/.github/workflows/PublishALDoc.yaml b/Templates/Per Tenant Extension/.github/workflows/PublishALDoc.yaml index d637817bf..74487bd10 100644 --- a/Templates/Per Tenant Extension/.github/workflows/PublishALDoc.yaml +++ b/Templates/Per Tenant Extension/.github/workflows/PublishALDoc.yaml @@ -7,6 +7,7 @@ permissions: contents: write actions: read pages: write + id-token: write defaults: run: From 385cea6573b6e756386bf237d067a6be155e3f00 Mon Sep 17 00:00:00 2001 From: freddydk Date: Fri, 10 Nov 2023 23:55:43 +0100 Subject: [PATCH 129/235] rename --- Templates/AppSource App/.github/workflows/CICD.yaml | 4 ++-- ...{PublishALDoc.yaml => DeployReferenceDocumentation.yaml} | 6 +++--- Templates/Per Tenant Extension/.github/workflows/CICD.yaml | 4 ++-- ...{PublishALDoc.yaml => DeployReferenceDocumentation.yaml} | 6 +++--- 4 files changed, 10 insertions(+), 10 deletions(-) rename Templates/AppSource App/.github/workflows/{PublishALDoc.yaml => DeployReferenceDocumentation.yaml} (93%) rename Templates/Per Tenant Extension/.github/workflows/{PublishALDoc.yaml => DeployReferenceDocumentation.yaml} (93%) diff --git a/Templates/AppSource App/.github/workflows/CICD.yaml b/Templates/AppSource App/.github/workflows/CICD.yaml index 1fce07e71..a64d4d762 100644 --- a/Templates/AppSource App/.github/workflows/CICD.yaml +++ b/Templates/AppSource App/.github/workflows/CICD.yaml @@ -157,7 +157,7 @@ jobs: needs: [ Initialization, Build ] if: always() && needs.Build.result == 'Success' && needs.Initialization.outputs.generateALDocArtifact == 1 runs-on: windows-latest - name: Deploy ALDoc Documentation + name: Deploy Reference Documentation environment: name: github-pages url: ${{ steps.deployment.outputs.page_url }} @@ -179,7 +179,7 @@ jobs: if: needs.Initialization.outputs.deployALDocArtifact == 1 uses: actions/configure-pages@v3 - - name: Build ALDoc Documentation + - name: Build Reference Documentation uses: microsoft/AL-Go-Actions/BuildALDoc@main with: shell: powershell diff --git a/Templates/AppSource App/.github/workflows/PublishALDoc.yaml b/Templates/AppSource App/.github/workflows/DeployReferenceDocumentation.yaml similarity index 93% rename from Templates/AppSource App/.github/workflows/PublishALDoc.yaml rename to Templates/AppSource App/.github/workflows/DeployReferenceDocumentation.yaml index 74487bd10..29df5da8b 100644 --- a/Templates/AppSource App/.github/workflows/PublishALDoc.yaml +++ b/Templates/AppSource App/.github/workflows/DeployReferenceDocumentation.yaml @@ -1,4 +1,4 @@ -name: ' Publish ALDoc Documentation' +name: ' Deploy Reference Documentation' on: workflow_dispatch: @@ -20,7 +20,7 @@ env: jobs: DeployALDoc: runs-on: [ windows-latest ] - name: Deploy ALDoc Documentation + name: Deploy Reference Documentation environment: name: github-pages url: ${{ steps.deployment.outputs.page_url }} @@ -54,7 +54,7 @@ jobs: if: steps.DetermineDeploymentEnvironments.outputs.deployALDocArtifact == 1 uses: actions/configure-pages@v3 - - name: Build ALDoc Documentation + - name: Build Reference Documentation uses: microsoft/AL-Go-Actions/BuildALDoc@main with: shell: powershell diff --git a/Templates/Per Tenant Extension/.github/workflows/CICD.yaml b/Templates/Per Tenant Extension/.github/workflows/CICD.yaml index 1fce07e71..a64d4d762 100644 --- a/Templates/Per Tenant Extension/.github/workflows/CICD.yaml +++ b/Templates/Per Tenant Extension/.github/workflows/CICD.yaml @@ -157,7 +157,7 @@ jobs: needs: [ Initialization, Build ] if: always() && needs.Build.result == 'Success' && needs.Initialization.outputs.generateALDocArtifact == 1 runs-on: windows-latest - name: Deploy ALDoc Documentation + name: Deploy Reference Documentation environment: name: github-pages url: ${{ steps.deployment.outputs.page_url }} @@ -179,7 +179,7 @@ jobs: if: needs.Initialization.outputs.deployALDocArtifact == 1 uses: actions/configure-pages@v3 - - name: Build ALDoc Documentation + - name: Build Reference Documentation uses: microsoft/AL-Go-Actions/BuildALDoc@main with: shell: powershell diff --git a/Templates/Per Tenant Extension/.github/workflows/PublishALDoc.yaml b/Templates/Per Tenant Extension/.github/workflows/DeployReferenceDocumentation.yaml similarity index 93% rename from Templates/Per Tenant Extension/.github/workflows/PublishALDoc.yaml rename to Templates/Per Tenant Extension/.github/workflows/DeployReferenceDocumentation.yaml index 74487bd10..29df5da8b 100644 --- a/Templates/Per Tenant Extension/.github/workflows/PublishALDoc.yaml +++ b/Templates/Per Tenant Extension/.github/workflows/DeployReferenceDocumentation.yaml @@ -1,4 +1,4 @@ -name: ' Publish ALDoc Documentation' +name: ' Deploy Reference Documentation' on: workflow_dispatch: @@ -20,7 +20,7 @@ env: jobs: DeployALDoc: runs-on: [ windows-latest ] - name: Deploy ALDoc Documentation + name: Deploy Reference Documentation environment: name: github-pages url: ${{ steps.deployment.outputs.page_url }} @@ -54,7 +54,7 @@ jobs: if: steps.DetermineDeploymentEnvironments.outputs.deployALDocArtifact == 1 uses: actions/configure-pages@v3 - - name: Build ALDoc Documentation + - name: Build Reference Documentation uses: microsoft/AL-Go-Actions/BuildALDoc@main with: shell: powershell From 28a83aaf79abe469c2b169d23ebb37fee70ebd91 Mon Sep 17 00:00:00 2001 From: freddydk Date: Fri, 17 Nov 2023 10:39:28 +0100 Subject: [PATCH 130/235] docs --- RELEASENOTES.md | 20 ++++++++++++++++++++ Scenarios/settings.md | 7 ++++--- Workshop/DevelopmentEnvironments.md | 2 +- Workshop/Index.md | 15 ++++++++------- Workshop/KeepUpToDate.md | 2 +- Workshop/PerformanceTesting.md | 6 +++--- Workshop/ReferenceDoc.md | 15 +++++++++++++++ Workshop/TheDevelopmentProcess.md | 2 +- 8 files changed, 53 insertions(+), 16 deletions(-) create mode 100644 Workshop/ReferenceDoc.md diff --git a/RELEASENOTES.md b/RELEASENOTES.md index 63a6d43a5..57d8a0dbb 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -5,6 +5,26 @@ Note that when using the preview version of AL-Go for GitHub, we recommend you U ### Issues - Issue 782 Exclude '.altestrunner/' from template .gitignore +### New Settings + +- `alDoc` : Structure with properties for the ALDoc reference document generation + - **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}* + +### New Workflows +- **Deploy Reference Documentation** is a workflow, which you can invoke manually or on a schedule to generate and deploy reference documentation using the aldoc tool, using the ALDoc setting properties described above. + +### Support for ALDoc reference documentation tool +ALDoc reference documentation tool is now supported for generating and deploying reference documentation for your projects either continuously or manually/scheduled. + ## v4.0 ### Removal of the InsiderSasToken diff --git a/Scenarios/settings.md b/Scenarios/settings.md index 186a6b5f5..f000cdb27 100644 --- a/Scenarios/settings.md +++ b/Scenarios/settings.md @@ -55,9 +55,10 @@ The repository settings are only read from the repository settings file (.github | shell | Specifies which shell will be used as the default in all jobs. **powershell** is the default, which results in using _PowerShell 5.1_ (unless you selected _ubuntu-latest_, then **pwsh** is used, which results in using _PowerShell 7_) | | githubRunner | Specifies which github runner will be used for the build/test jobs in workflows including a build job. This is the most time consuming task. By default this job uses the _Windows-latest_ github runner (unless overridden by the runs-on setting). This settings takes precedence over runs-on so that you can use different runners for the build job and the housekeeping jobs. See **runs-on** setting. | | githubRunnerShell | Specifies which shell is used for build jobs in workflows including a build job. The default is to use the same as defined in **shell**. If the shell setting isn't defined, **powershell** is the default, which results in using _PowerShell 5.1_. Use **pwsh** for _PowerShell 7_. | -| 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)
| { } | +| 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}* | | 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" ] | diff --git a/Workshop/DevelopmentEnvironments.md b/Workshop/DevelopmentEnvironments.md index 9bcb5ffd4..50351acb3 100644 --- a/Workshop/DevelopmentEnvironments.md +++ b/Workshop/DevelopmentEnvironments.md @@ -1,4 +1,4 @@ -# Development Environments +# FUTURE TOPIC: Development Environments This topic will be finalized later diff --git a/Workshop/Index.md b/Workshop/Index.md index 542632f6f..cd2365744 100644 --- a/Workshop/Index.md +++ b/Workshop/Index.md @@ -1,5 +1,5 @@ # AL-Go for GitHub Workshop -This workshop... +This workshop shows you how to take advantage of the functionality, which is provided out-of-the-box by AL-Go for GitHub. 1. [Introduction](Introduction.md) - Introduction to GitHub, AL-Go for GitHub, personal and organizational accounts. 1. [Prerequisites](Prerequisites.md) - Setup pre-requisites for the Workshop. @@ -15,14 +15,14 @@ This workshop... 1. [Publish to Production](PublishToProduction.md) - Publish your apps to a production environment securely. 1. [Automated Tests](AutomatedTests.md) - Add automated testing to your project. 1. [Scheduled test runs](ScheduledTestRuns.md) - Testing your app against the latest (and future Business Central versions) daily or weekly. +1. [Performance Testing](PerformanceTesting.md) - *FUTURE TOPIC: Add performance tests to your daily test runs.* +1. [Automatic Reference Documentation Generation](ReferenceDoc.md) - Keep your reference documentation up-to-date. +1. [Delevelopment Environments](DevelopmentEnvironments.md) - *FUTURE TOPIC: How to setup a development environment for a project.* +1. [The Development Process](TheDevelopmentProcess.md) - *FUTURE TOPIC: The recommended way to work with feature branches, pull requests, code reviews and branch protection rules.* +1. [Keeping your Repository Up-to-date](KeepUpToDate.md) - *FUTURE TOPIC: Updating AL-Go for GitHub to the latest version by running a workflow.* - -## Future topics -1. [Performance Testing](PerformanceTesting.md) - Add performance tests to your daily test runs. -1. [Delevelopment Environments](DevelopmentEnvironments.md) - How to setup a development environment for a project. -1. [The Development Process](TheDevelopmentProcess.md) - The recommended way to work with feature branches, pull requests, code reviews and branch protection rules. -1. [Keeping your Repository Up-to-date](KeepUpToDate.md) - Updating AL-Go for GitHub to the latest version by running a workflow. +## Additional Future topics 1. Dependencies to other apps 1. AppSource validation 1. Settings @@ -30,3 +30,4 @@ This workshop... 1. Power Platform solution 1. Self Hosted Runners 1. Make it your own + diff --git a/Workshop/KeepUpToDate.md b/Workshop/KeepUpToDate.md index 85dc7349a..d3467f18b 100644 --- a/Workshop/KeepUpToDate.md +++ b/Workshop/KeepUpToDate.md @@ -1,4 +1,4 @@ -# Keeping your AL-Go repository up-to-date +# FUTURE TOPIC: Keeping your AL-Go repository up-to-date This topic will be finalized later diff --git a/Workshop/PerformanceTesting.md b/Workshop/PerformanceTesting.md index eca1b10a2..9f05e12cb 100644 --- a/Workshop/PerformanceTesting.md +++ b/Workshop/PerformanceTesting.md @@ -1,9 +1,9 @@ -# Performance Testing +# FUTURE TOPIC: Performance Testing This topic will be finalized later -Maybe it is about time to actually explain how you create a development environment and code your app? +Testing is an important part of the app quality, but so is documentation. Let's look at generating reference documentation your app, and... - keeping it up-to-date... --- -[Index](Index.md)  [next](DevelopmentEnvironments.md) +[Index](Index.md)  [next](ReferenceDoc.md) diff --git a/Workshop/ReferenceDoc.md b/Workshop/ReferenceDoc.md new file mode 100644 index 000000000..5746af9da --- /dev/null +++ b/Workshop/ReferenceDoc.md @@ -0,0 +1,15 @@ +# Reference Documentation + +A vital part of your development processes is reference documentation. AL-Go for GitHub supports the ALDoc tool for reference documentation generation, either continuously as part of CI/CD, manually or scheduled. + +The ALDoc tool generates content based on the source code. Generating content based on source code has many advantages such as accuracy, 100% reflection of the current codebase, less error prone documentation, and it saves time. The ALDoc tool generates documentation from symbolic and syntactical information, code comments, and overall application structure based on input .app file(s). The tool also generates a help site with these reference articles, sorted by the application structure, based on the provided template. + + + + + + +Maybe it is about time to actually explain how you create a development environment and code your app? + +--- +[Index](Index.md)  [next](DevelopmentEnvironments.md) diff --git a/Workshop/TheDevelopmentProcess.md b/Workshop/TheDevelopmentProcess.md index e3f4fdf44..6d983e040 100644 --- a/Workshop/TheDevelopmentProcess.md +++ b/Workshop/TheDevelopmentProcess.md @@ -1,4 +1,4 @@ -# The Development Process +# FUTURE TOPIC: The Development Process This topic will be finalized later From eb567c667997dc42ef89c6b454813c591eb5e7a3 Mon Sep 17 00:00:00 2001 From: Freddy Kristiansen Date: Fri, 17 Nov 2023 10:54:18 +0100 Subject: [PATCH 131/235] Update GetStarted.md --- Workshop/GetStarted.md | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/Workshop/GetStarted.md b/Workshop/GetStarted.md index e6da744dd..7cb85ba6d 100644 --- a/Workshop/GetStarted.md +++ b/Workshop/GetStarted.md @@ -3,24 +3,37 @@ With our prerequisites in place, it is time to get started and create our first In a browser, navigate to https://aka.ms/algopte: -| ![image](https://user-images.githubusercontent.com/10775043/231536061-8594cfec-d312-4f5b-9ff4-a3d0cf46ab69.png) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/e00a3a4e-0443-4369-9cad-6a4041fd9c58) | +|-| + +And you shouold see: + +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/ba6520ef-2c24-454e-9227-2298a26931e2) | |-| Click **Use This Template** and select **Create a new repository**. Select your **organizational account** as **owner** and enter **repo1** as repository name. Make the repo **public** and click **Create repository form template**. -| ![image](https://user-images.githubusercontent.com/10775043/231535787-43d8af7d-1554-4e11-9753-8e7d7d21401c.png) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/8f529957-5023-4967-ad8c-2bc4399cec47) | +|-| + +After a few seconds, your new repository should be ready for you. + +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/a56e6b5f-8978-4065-828b-946ba324f525) | |-| -Click **Actions**, select the **CI/CD** workflow, click **Run workflow** and run the CI/CD workflow on our empty repository. Wait for the CI/CD workflow to complete. +Click **Actions**, and you should see that a CI/CD workflow has already been kicked off on our empty repository. -![image](https://github.com/microsoft/AL-Go/assets/10775043/d411bc1f-8494-4c00-93b5-26046ecda6a1) +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/8e75c3b6-741f-4802-b061-b574c7673b46) | +|-| - By clicking the workflow in the list, and scrolling down, you should see: +Wait for the CI/CD workflow to complete and click the completed workflow to see details. -| ![image](https://user-images.githubusercontent.com/10775043/231540402-05af1336-0f60-45e7-a86c-501a95a657de.png) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/9389fe37-c8e8-4bbb-8283-eb9cf4fa4424) | |-| -Note the three warnings explaining that no apps have been added. The CI/CD workflow doesn't have anything to compile yet as you didn't add any source code. +Note the warnings explaining that no apps have been added. The CI/CD workflow doesn't have anything to compile yet as you didn't add any source code. + +Ignore the warning about available updates for now. After this step, we are done setting up a basic AL-Go for GitHub repository and we only need to add our apps. From 8c589ca33e42ff565e89bb2218f7cbca294c6257 Mon Sep 17 00:00:00 2001 From: Freddy Kristiansen Date: Fri, 17 Nov 2023 10:59:02 +0100 Subject: [PATCH 132/235] Update AddAnApp.md --- Workshop/AddAnApp.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Workshop/AddAnApp.md b/Workshop/AddAnApp.md index 6542967ba..3bc39f0ac 100644 --- a/Workshop/AddAnApp.md +++ b/Workshop/AddAnApp.md @@ -21,7 +21,7 @@ Enter the following values in the form: | Include Sample Code | `Y` | | Direct COMMIT | `N` | -| ![image](https://user-images.githubusercontent.com/10775043/231540732-4a1ef920-abe2-4611-a2b0-9ac9a8310e3b.png) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/3520147b-cb0c-4ee9-90f4-f6efeb81b23f) | |-| Wait a few minutes until the workflow completes and click **Pull requests** to see that there is a Pull request open for review. From 89605b03239cdf262ff4fa93982136b803478b41 Mon Sep 17 00:00:00 2001 From: Freddy Kristiansen Date: Fri, 17 Nov 2023 23:19:56 +0100 Subject: [PATCH 133/235] Update AddAnApp.md --- Workshop/AddAnApp.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Workshop/AddAnApp.md b/Workshop/AddAnApp.md index 3bc39f0ac..405223c67 100644 --- a/Workshop/AddAnApp.md +++ b/Workshop/AddAnApp.md @@ -26,12 +26,12 @@ Enter the following values in the form: Wait a few minutes until the workflow completes and click **Pull requests** to see that there is a Pull request open for review. -| ![image](https://user-images.githubusercontent.com/10775043/231541168-7f38a62a-84a3-4d31-9e44-4836f51ec9c0.png) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/b1dd7d78-d8e0-4d19-99bf-8a555a076071) | |-| Open the **Pull request** and click **Files changed** to see what the Pull request will add to your repository. -| ![image](https://user-images.githubusercontent.com/10775043/231541315-9c738120-3b16-4746-b066-1e22345fb1a8.png) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/af9ffee2-ebae-46b0-ae81-6bffb51ddd08) | |-| The changes made by the workflow includes adding the new app path to the **al.code-workspace**, and adding an app folder with **app.json**, **HelloWorld.al** (sample code) and **.vscode/launch.json**. @@ -39,12 +39,12 @@ The **Create a new app** workflow doesn't do anything else than just adding thes Select **Conversation** and merge the pull request by clicking **Merge the pull request**, **Confirm merge** and then delete the temporary branch created for the pull request, by clicking **Delete branch**. Select **Actions** and see that a merge commit workflow was kicked off: -| ![image](https://user-images.githubusercontent.com/10775043/231541665-e9a29056-e681-42fc-b272-ff0fd0ce3d94.png) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/b4cc814a-6ed4-4730-ab53-81a88a4b54b3) | |-| When the merge commit is **done**, click the workflow line and **scroll down** to see the artifacts created by this build: -| ![image](https://user-images.githubusercontent.com/10775043/231544822-71bf956d-a050-4d18-b429-69fdb08083f9.png) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/09b8013e-0cd7-46f7-b45c-a4dcaccfb788) | |-| Note that my artifacts are created with version **1.0.2.0** - that might not be the same in your repository. From 141b893ab35ce83151ec85e56d06fcecb02e9daa Mon Sep 17 00:00:00 2001 From: Freddy Kristiansen Date: Fri, 17 Nov 2023 23:22:53 +0100 Subject: [PATCH 134/235] Update Versioning.md --- Workshop/Versioning.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Workshop/Versioning.md b/Workshop/Versioning.md index 2ba35c7db..4a4a0d1e1 100644 --- a/Workshop/Versioning.md +++ b/Workshop/Versioning.md @@ -4,7 +4,7 @@ Understanding how AL-Go for GitHub is doing **versioning** and **naming** is imp As we saw earlier, the **artifacts** from the first successful build in my repository was called version **repo1-main-Apps-1.0.2.0**. Downloading the artifact and unpacking reveals the app inside. The app inside is using the same naming strategy as VS Code: `__` -| ![image](https://user-images.githubusercontent.com/10775043/231545533-be33a8f6-88ea-4b05-b343-d71aaf9ee5d4.png) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/a74da044-e6c4-4d96-8f75-6fbfa1bddaa2) | |-| Here, the app has the same version number as the artifact, but is it always like that? From d97a9d23d563166ecb9d4276e99bde178fd1ee2d Mon Sep 17 00:00:00 2001 From: Freddy Kristiansen Date: Sat, 18 Nov 2023 06:35:54 +0100 Subject: [PATCH 135/235] Update Versioning.md --- Workshop/Versioning.md | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/Workshop/Versioning.md b/Workshop/Versioning.md index 4a4a0d1e1..80bebf487 100644 --- a/Workshop/Versioning.md +++ b/Workshop/Versioning.md @@ -17,48 +17,48 @@ As you know, the build number consists of 4 tuples: **major.minor.build.revision In order to better understand this, select **Code** and navigate to the **app.json** file under the **app1** folder. Edit the file and change the version number to **1.2.5.6**. -| ![image](https://user-images.githubusercontent.com/10775043/231559564-43683818-c540-4ba3-86b4-832c67545ae4.png) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/5c758cf1-6f52-4814-81ad-0c506e63324c) | |-| -**Commit** the changes, select **Actions** and wait for the build to complete. +**Commit** the changes directly, select **Actions** and wait for the build to complete. -| ![image](https://user-images.githubusercontent.com/10775043/231547295-accc7f9d-7c19-472f-80df-71d1897d91a5.png) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/912a32fa-6ca8-4ef0-8e38-cfded6eee44d) | |-| Select the **Update app.json** workflow, **scroll down** to the artifacts and **download** the new apps artifact. -| ![image](https://user-images.githubusercontent.com/10775043/231559045-1e071522-80c3-456c-9379-9b51a550f60a.png) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/e1df08a6-5516-4923-abe9-fee93f315ff0) | |-| Now the project (in this case the repository), which really is a collection of apps, is still version **1.0** (RepoVersion never changed - is still 1.0 = default) and **app1** is **1.2** (major and minor from app.json). Build is **3** (3rd build) and revision is still **0**. Scroll back up, locate the **Re-run all jobs** button and click it. Wait for the **2nd attempt** to complete and inspect the artifact for the re-run. -| ![image](https://user-images.githubusercontent.com/10775043/231560877-bc9354ff-40e9-4705-91d4-6217133a1e73.png) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/4e4df417-e257-4a61-bc07-666f98413be1) | |-| Now revision became **1** as we had another attempt at building the app. -Next, let's create another app in the same repo. **app2** with ID range **56000..56100** and enter **Y** in **Direct COMMIT**. +Next, let's create another app, by running the **Create a new app** workflow again in the same repo. **app2** with ID range **56000..56100** and enter **Y** in **Direct COMMIT**. -| ![image](https://user-images.githubusercontent.com/10775043/231561391-7350981e-e20d-49a1-9479-4271a7e6ddd8.png) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/06d4a03c-f025-44d6-a317-b2a0a79f7e8e) | |-| -When the **Create a new app workflow** is done, select the **CI/CD** workflow and click **Run workflow** to run the workflow manually. When the workflow is complete, download and inspect the artifacts generated +When the **Create a new app** workflow is done, click **Actions**, select the **CI/CD** workflow and click **Run workflow** to run the workflow manually. When the workflow is complete, download and inspect the artifacts generated -| ![image](https://user-images.githubusercontent.com/10775043/231564490-b8c414a8-cf6b-4660-bd81-4c98571812a6.png) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/d654b75c-2e63-4bd3-a39a-dce6bf835c30) | |-| **App2** still has version **1.0** in **app.json**, hence the **1.0.4.0** version number. -If we want to increment the version number of the project and all apps, you can run the **Increment Version Number** workflow. +If we want to increment the version number of the project and all apps, you can run the **Increment Version Number** workflow, and keep the **N** in **Direct COMMIT**. -| ![image](https://user-images.githubusercontent.com/10775043/231565483-5f92751e-ed59-40c9-ba80-c90effc9a4e3.png) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/d9da5fcc-3e57-42b1-92b4-23d17ccfbbf9) | |-| Specifying **+0.1** will add 1 to the minor version of all apps and to the repo version number. Wait for the workflow to complete, select **Pull requests** and select the **Increment Version Number by 0.1** Pull request and inspect what the workflow is trying to change for you. At this time, we will **NOT** merge the Pull request as changing version numbers like this is typically done during a release. -| ![image](https://user-images.githubusercontent.com/10775043/231566085-3fd6ae4a-e88e-4dfd-be60-3ac95767d14a.png) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/1b16ac1f-1717-4ea7-9bd0-b98e5df8bfe2) | |-| Select **Conversation**, click **Close pull request** and **delete the branch**. From 13b591e82b3ba691af0e3b5a20a61a362b02a709 Mon Sep 17 00:00:00 2001 From: Freddy Kristiansen Date: Sat, 18 Nov 2023 06:36:39 +0100 Subject: [PATCH 136/235] Update Prerequisites.md --- Workshop/Prerequisites.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Workshop/Prerequisites.md b/Workshop/Prerequisites.md index 8f744676f..ee77b7047 100644 --- a/Workshop/Prerequisites.md +++ b/Workshop/Prerequisites.md @@ -15,7 +15,7 @@ You will need: { "useCompilerFolder": true, "doNotPublishApps": true, - "artifact": "https://bcartifacts.azureedge.net/sandbox/22.0.54157.55210/us" + "artifact": "https://bcartifacts.azureedge.net/sandbox/23.0.12034.13450/us" } ``` From bb966d39b0fcf1cb17f31d59768fb3156b8c1c25 Mon Sep 17 00:00:00 2001 From: Freddy Kristiansen Date: Sat, 18 Nov 2023 07:00:27 +0100 Subject: [PATCH 137/235] Update Releasing.md --- Workshop/Releasing.md | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/Workshop/Releasing.md b/Workshop/Releasing.md index 2c3e3db23..2a816559e 100644 --- a/Workshop/Releasing.md +++ b/Workshop/Releasing.md @@ -23,51 +23,52 @@ Select **Actions**, select the **Create Release** workflow and click **Run workf | New Version Number | `+1.0` | | Direct COMMIT | `N` | -After completion of the **Create release** workflow, you can select **Code** and see that you have 1 releases: +After completion of the **Create release** workflow, you can select **Code** and see that you have 1 release: + ![image](https://user-images.githubusercontent.com/10775043/231591177-d2a85451-a717-4f87-a2ae-55e26c19a17f.png) Also, you have a Pull request waiting, which increments version number by 1.0. -| ![image](https://user-images.githubusercontent.com/10775043/231591451-040c40d7-75d0-43c2-af8f-744ae29f36e8.png) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/3955d853-fc6a-447a-a5e0-8a56983462d2) | |-| **Merge the Pull request**, **delete the temporary branch** and select **Actions** to see that a Merge Pull request was kicked off. -| ![image](https://user-images.githubusercontent.com/10775043/231591751-b2ebe08a-689c-446b-84d5-3c7c285e754c.png) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/96ff7600-ec05-411f-9335-aa389feabbd7) | |-| Inspecting the build from the Pull request, you will see that the artifacts are now **2.0.5.0**, **app1** is **2.2.5.0** and **app2** is **2.0.5.0**. -| ![image](https://user-images.githubusercontent.com/10775043/231592915-f1f7e4d7-061c-42cd-9f37-dfd06c11b09d.png) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/d5382e5d-ac65-44f2-bb58-69b148764e1a) | |-| And all subsequent builds from main will now be 2.x. You will also see that the annotation stating that **No previous release found** has now gone. All builds from main will use the latest release version for upgrade testing. Inspecting the build step in the workflow, reveals that AL-Go for GitHub was able to locate the previous release -| ![image](https://user-images.githubusercontent.com/10775043/231593914-0f83255e-d027-4826-b23a-17625ee3c2fb.png) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/2d404467-9311-4cc4-97fc-99961c29f7d0) | |-| Now, if you at some point in time need to create a hotfix for version **1.0.4**, you can simply select **Code** and switch to the release branch. -| ![image](https://user-images.githubusercontent.com/10775043/231594145-f18ae77d-895b-41db-a04b-711028486896.png) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/1169ef76-dd23-49c5-8f02-098021f8951e) | |-| -Now you can navigate to the **HelloWorld.al** file, make a **simple change** and **commit the changes**. +Now you can navigate to the **HelloWorld.al** file in the **app2** app, make a **simple change** and **commit the changes**. -| ![image](https://user-images.githubusercontent.com/10775043/231594386-fbde022d-a53c-4eef-928d-92b2b2dace66.png) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/0e44c89b-041e-4260-abe0-cbf9bb59affa) | |-| Select **Actions** and see that a build was kicked off in the release branch. -| ![image](https://user-images.githubusercontent.com/10775043/231594500-1d86a0f5-a001-4244-9005-7275e1b72278.png) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/06b8e92b-21e7-424c-9208-e17722feeb15) | |-| This version will use the **latest released build**, which has a version number lower than the one you are building as previous release and will use the version numbers from the release branch for versioning. -After the build is completed, you will need to release this new build in order for CI/CD to see the new bits as a release. +After the build is completed, you will need to release this new build in order for subsequent CI/CD builds from main to see the new bits as a release. The artifacts in the hotfix build looks like this: -| ![image](https://user-images.githubusercontent.com/10775043/231595957-cd61fc0e-f7c7-4dc3-8fe7-dccad3de32a0.png) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/a53fbe6a-0ec3-4e2d-a5d6-fe89a9cb3fdd) | |-| where the branch name main has been replaced by the release branch name. From 4a560506951c55fe2b8d46f8d69634ccbc383216 Mon Sep 17 00:00:00 2001 From: Freddy Kristiansen Date: Sat, 18 Nov 2023 07:06:23 +0100 Subject: [PATCH 138/235] Update Projects.md --- Workshop/Projects.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Workshop/Projects.md b/Workshop/Projects.md index adbcb0de2..e5ff3b661 100644 --- a/Workshop/Projects.md +++ b/Workshop/Projects.md @@ -5,6 +5,11 @@ Every repository can have any number of projects, which each can have any number Up until now we have worked with a repository which contained 2 apps. This is called a single-project repository. +Things that are determined at the app level: +- Version of the app +- Dependencies to other apps +- Functionality of the app (obviously) + Things that are determined at the project level: - Version and localization of Business Central to use during build - Dependencies to other projects @@ -22,7 +27,7 @@ A multi-project repository could look like this: So, let's setup a multi-project repository like this. Navigate to **https://aka.ms/algopte** to create a new repository. Click **Use this template** and select **Create a new repository**. Select your **organization** as owner, specify a **name** and select **Public**. -| ![image](https://user-images.githubusercontent.com/10775043/231751252-51f0c80a-dd74-4f32-95d5-39a363e2b2ff.png) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/7e66ca01-0850-4031-8b80-616ee819ebde) | |-| Like when we ran GetStarted, we want to use the preview version of AL-Go for GitHub. Select **Actions**, select the **Update AL-Go System Files** workflow and click **Run workflow**. From 09c59fe10067e00efc573b2ccf507d2e49d1a2af Mon Sep 17 00:00:00 2001 From: Freddy Kristiansen Date: Sat, 18 Nov 2023 08:04:30 +0100 Subject: [PATCH 139/235] Update Projects.md --- Workshop/Projects.md | 40 +++++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/Workshop/Projects.md b/Workshop/Projects.md index e5ff3b661..33536e632 100644 --- a/Workshop/Projects.md +++ b/Workshop/Projects.md @@ -30,9 +30,7 @@ So, let's setup a multi-project repository like this. Navigate to **https://aka. | ![image](https://github.com/microsoft/AL-Go/assets/10775043/7e66ca01-0850-4031-8b80-616ee819ebde) | |-| -Like when we ran GetStarted, we want to use the preview version of AL-Go for GitHub. Select **Actions**, select the **Update AL-Go System Files** workflow and click **Run workflow**. - -Specify **microsoft/AL-Go-PTE@preview** as template repository, **Y** in Direct COMMIT and click **Run workflow**. You don't have to wait for the CI/CD workflow to complete. You can locate the **Create a new app** workflow in the list of workflows and run it with the following parameters: +You can locate the **Create a new app** workflow in the list of workflows and run it with the following parameters: | Name | Value | | :-- | :-- | @@ -43,19 +41,20 @@ Specify **microsoft/AL-Go-PTE@preview** as template repository, **Y** in Direct | Include Sample Code | `Y` | | Direct COMMIT | `N` | -| ![image](https://user-images.githubusercontent.com/10775043/231755134-303a59b3-f616-4d08-b46d-47810e459a1b.png) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/04f69e2c-de5f-45ae-89fc-48c543d14c60) | |-| -Select **Pull requests**, click the **New PTE** pull request and select **Files changed** to inspect what changes was done to the repo: +When the **Create a new app in [main]** workflow has completed, select **Pull requests**, click the **New PTE** pull request and select **Files changed** to inspect what changes was done to the repo: -![image](https://user-images.githubusercontent.com/10775043/231753510-4a0cb9a9-c1b8-4fc8-9481-4e7a4ea80c89.png) +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/8db3c739-674f-4172-9c92-52c6a0edadb3) | +|-| Notice that: 1. The .AL-Go folder was moved from the root of the repo and into the US folder. 2. A new US.code-workspace was created as a workspace for this project 3. An app was added under the US folder called mysolution.us -Go ahead and **merge the pull request** and **delete** the temporary branch. +Go ahead click **Conversation**, **merge the pull request** and **delete** the temporary branch. You don't have to wait for the **CI/CD workflow** to complete, just go ahead and run the **Create a new app** again. This time with the following parameters: @@ -79,38 +78,38 @@ and run the same workflow again with these parameters: | Include Sample Code | `Y` | | Direct COMMIT | `N` | -When the **New App (mysolution.dk)** and **New App (mysolution.w1)** pull requests are created, **merge the pull request** and **delete** the temporary branch. +When the **New PTE (mysolution.dk)** and **New PTE (mysolution.w1)** pull requests are created, merge both pull request and delete the temporary branches. Now select Actions and see that a number of workflows have been kicked off. Some are completed, some might still be running. Click the latest CI/CD commit workflow and notice the 3 jobs (you can expand the jobs by clicking show all jobs): -| ![image](https://user-images.githubusercontent.com/10775043/231756744-8952ba6b-edaa-47d8-b1ad-cf74990ba86d.png) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/19707351-d77c-4a46-8082-c0fcf6f7fc3a) | |-| At this time, all apps will be using US as localization and use the same Business Central version as we entered when setting up prerequisites. -After the build completes, you can inspecting the artifacts created from this multi-project repository: +After the build completes, you can inspect the artifacts created from this multi-project repository, by clicking Summary and scrolling down: -| ![image](https://user-images.githubusercontent.com/10775043/231757819-64d9a4b8-bda2-4b36-974b-540052007c76.png) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/aad8cbed-26ba-4155-8d3f-55aa14655a7c) | |-| -DK, US and W1 all have an artifact of the type **Apps** generated, but they are obviously wrong. We need **DK** to be build using the danish localization and **W1** using W1. +DK, US and W1 all have an artifact of the type **Apps** generated, but they are wrong, since they are all build using the US localization. We need **DK** to be build using the danish localization and **W1** using W1. Note also the CheckForUpdates annotation. AL-Go says that there are system files updates. This is because when creating a new project, AL-Go will (at the next system file update) place scripts in the .AL-Go folder for creating local and cloud development environments. Before running **Update AL-Go System Files** however, let's make some changes to the repository and we will do this from VS Code. Select **Code** and click the **Code** dropdown to copy the GIT URL for the repo: -| ![image](https://user-images.githubusercontent.com/10775043/231759163-33006212-6191-4ed6-8a96-84ff0c7d944e.png) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/d169c50a-ccc6-4236-8816-bde96036beae) | |-| Open **VS Code** and run **Git Clone** to clone your repository to your local machine: -| ![image](https://user-images.githubusercontent.com/10775043/231759374-671a9933-9602-4ec0-bc06-ea5c7236b457.png) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/ce2c8991-a371-4fd8-9c0e-05854f885cbc) | |-| Open the repository (do not open the workspace) and perform the following changes: -- in **DK/.AL-Go/settings.json**, add **"artifact": "https://bcartifacts.azureedge.net/sandbox/22.0.54157.55210/dk"** +- in **DK/.AL-Go/settings.json**, add **"artifact": "https://bcartifacts.azureedge.net/sandbox/23.0.12034.13450/dk"** - in **DK/.AL-Go/settings.json**, change **country** to **"dk"** - in **DK/mysolution.dk/HelloWorld.al**, add DK to the pageextension name (i.e. CustomerListExt to **CustomerListExtDK**) - in **US/.AL-Go/settings.json**, add **"artifact": "https://bcartifacts.azureedge.net/sandbox/22.0.54157.55210/us"** @@ -119,16 +118,19 @@ Open the repository (do not open the workspace) and perform the following change - in **W1/.AL-Go/settings.json**, change **country** to **"w1"** - in **W1/mysolution.w1/HelloWorld.al**, add W1 to the pageextension name (i.e. CustomerListExt to **CustomerListExtW1**) -**Stage the changes** in **VS Code**, **Commit** the changes and **Sync**. +**Stage the changes** in **VS Code**, **Commit** the changes and **Sync**. Wait for the **CI/CD** workflow to complete: + +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/99eb407c-497b-428a-a376-6e5cdb6f3db6) | +|-| Now, we can create a release and inspect that. Run the **Create release** workflow and release v1.0 like this: -| ![image](https://user-images.githubusercontent.com/10775043/231798204-2b7c4689-596b-42a6-ac5b-62093192e595.png) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/541bd90c-b60b-485f-9c10-c7947cfaaade) | |-| -After this is done, select **Code** and click the newly created release to see the artifacts (which also reveals a bug) +After this is done, select **Code** and click the newly created release to see the artifacts. In the auto generated release notes, you will see all merged Pull Requests under **What's Changed** and by clicking the **Full Changelog** link you will find all commits. -| ![image](https://user-images.githubusercontent.com/10775043/231798973-1ed29f6d-fb08-4b8e-b2f1-efd415b20bf1.png) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/446616b6-a464-4721-bd58-08270a18e3f8) | |-| OK - so that's fine, but normally in a solution like this, DK and US have a dependency on W1 or a common app - you don't have all code duplicated 3 times - how does AL-Go handle dependencies? From 263ae2dccaae0c3567ed1962bf8bbc77aa18fb8b Mon Sep 17 00:00:00 2001 From: Freddy Kristiansen Date: Sat, 18 Nov 2023 08:17:58 +0100 Subject: [PATCH 140/235] Update Dependencies1.md --- Workshop/Dependencies1.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Workshop/Dependencies1.md b/Workshop/Dependencies1.md index e6df23533..e0abcf2ea 100644 --- a/Workshop/Dependencies1.md +++ b/Workshop/Dependencies1.md @@ -8,19 +8,19 @@ This topic describes two ways to handle dependencies to apps within another proj ## useProjectDependencies Let's go ahead and add the dependencies and see what happens. Grab the **id**, **name**, **publisher** and **version** from the **mysolution.w1** app.json and use them to add a dependency to that app into **mysolution.dk** and **mysolution.us**. -| ![image](https://user-images.githubusercontent.com/10775043/231805415-2e8f345c-f228-4940-9f77-9a05514bd8c0.png) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/a1627453-c7c6-4877-bec7-ea322f9339dd) | |-| **Stage** your changes, **Commit** them and **Sync** your changes. -Another **CI/CD** workflow will be kicked off. Two of the jobs should fail fairly quickly. +Another **CI/CD** workflow will be kicked off. Two of the jobs (the DK and the US apps) should fail fairly quickly as AL-Go cannot find the W1 app dependency anywhere. -| ![image](https://user-images.githubusercontent.com/10775043/231809668-a914793d-3e7f-4c02-9deb-13f7a1fce3e7.png) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/9bcfaa43-64ea-4e07-9505-ad1bd463c97c) | |-| At this time, the error message displayed in the annotations isn't very clear - we will fix that. If you drill into the failing workflow and into the compile step, you will find the real error: -| ![image](https://user-images.githubusercontent.com/10775043/231810146-8ffe7305-da1d-4d43-ab2a-20952628632e.png) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/23685295-5ce3-4b08-8850-f342407316ea) | |-| It cannot find the mysolution.w1 app on which the two other apps depend, but we kind of knew that. @@ -28,7 +28,7 @@ It cannot find the mysolution.w1 app on which the two other apps depend, but we The recommended solution to this problem is to set a repository setting called **useProjectDependencies** to **true** and then run Update AL-Go System files. Repository settings are in **.github/AL-Go-Settings.json** -| ![image](https://user-images.githubusercontent.com/10775043/231811594-fd29cc88-2aed-425d-bffb-eb84bfca0463.png) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/627a68a3-2d0e-4525-a7ff-88f901d786c0) | |-| Changing the settings file will kick off another build, which also will fail. From b1601b4c7761f1ca0712dbad1f390e8ef33b831d Mon Sep 17 00:00:00 2001 From: Freddy Kristiansen Date: Sat, 18 Nov 2023 08:45:20 +0100 Subject: [PATCH 141/235] Update Dependencies1.md --- Workshop/Dependencies1.md | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/Workshop/Dependencies1.md b/Workshop/Dependencies1.md index e0abcf2ea..7c143fcde 100644 --- a/Workshop/Dependencies1.md +++ b/Workshop/Dependencies1.md @@ -36,19 +36,21 @@ Changing the settings file will kick off another build, which also will fail. To address that failure, select **Actions**, select **Update AL-Go System Files** and click **Run workflow**. No need to change any parameters, just run the workflow. Looking at the **Pull request** created by the **Update AL-Go System Files** workflow, we can see that all build workflows have been changed and now ínclude a **workflowDepth: 2** (instead of 1). -**Merge** the Pull request, **confirm** the merge and **delete** the temporary branch. -Open the latest merge commit and see that the structure of the **CI/CD** workflow has changed. Now it builds the W1 project first and any dependencies to the apps DK or US that are found in W1 will be automatically located. +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/12758ae3-2e11-46ee-ae09-9bc186887e84) | +|-| + +**Merge** the Pull request, **confirm** the merge and **delete** the temporary branch. Open the latest merge commit and see that the structure of the **CI/CD** workflow has changed. Now it builds the W1 project first and dependencies from the apps DK or US that are found in W1 will be automatically located. -![image](https://user-images.githubusercontent.com/10775043/231813913-1685f87a-a822-4830-a1d3-f35f8422bcb0.png) +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/5edbc124-9d09-4cad-9d1b-da4257ea065b) | |-| Looking at the artifacts produced by the build, we can see -| ![image](https://user-images.githubusercontent.com/10775043/231855006-a9f69995-200f-433b-8321-c0652289320d.png) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/b3d1e1aa-356a-405e-8001-07214cc3d71d) | |-| -The **thisbuild** artifacts are shortlived--they are only there so that **depending projects** can find build artifacts from other jobs in the same workflow. +The **thisbuild** artifacts are shortlived - they are only there so that **depending projects** can find build artifacts from other jobs in the same workflow. ## include The other mechanism is to *include* the dependency projects in the project we are building. This is done by using the project setting **appDependencyProbingPaths**, which specifies where to search for dependencies in general. @@ -69,20 +71,20 @@ Now, modify **DK/.AL-Go/settings.json** and **US/.AL-Go/settings.json** by addin Specifying a **"."** in **repo**, means to search in the same repository for the depdency. **Release_status** **include** means that AL-Go will include the actual source from the dependent project instead of downloading just a specific build. **Stage** the changes, **Commit** them, and **Sync**. -| ![image](https://user-images.githubusercontent.com/10775043/231878939-470d6693-218f-4cad-9cc9-001497ba1bb8.png) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/27fdeee6-3f5e-4d16-a4c9-e34001d2e26e) | |-| -The **CI/CD** workflow is again kicked off and you can see that all builds complete +The **CI/CD** workflow runs again and you can observe that all the builds finish successfully. -| ![image](https://user-images.githubusercontent.com/10775043/231880993-89a18260-430d-4b55-b6bf-e30a27c2ee34.png) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/79aebe82-31b8-4b3b-a149-b75827035597) | |-| -If you inspect the log, you will see that it is checking **appDependencyProbingPaths** and adding the **mysolution.w1** folder to the folders that it needs to build for this job. +A look at the log reveals that it adds the **mysolution.w1** folder to the list of folders it needs to build for this job, as it checks **appDependencyProbingPaths**. -| ![image](https://user-images.githubusercontent.com/10775043/231883087-64921fdc-45c2-4e4d-8e96-7be99432af41.png) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/54eb7e63-bd5c-425d-bf5b-792ffe608853) | |-| -**Note** that this means that the **mysolution.w1** will be built three times, and every project will have their own copy of that app. The apps will be identical, but they will have different package IDs. +**Note** that this implies that **mysolution.w1** will be compiled three times, and each project will contain its own copy of that app. The apps will be the same, but they will have different package IDs. --- [Index](Index.md)  [next](Dependencies2.md) From da8c6bef5ee56401ea7da72a8e39211d97e07b6c Mon Sep 17 00:00:00 2001 From: Freddy Kristiansen Date: Sun, 19 Nov 2023 06:44:30 +0100 Subject: [PATCH 142/235] Update Dependencies2.md --- Workshop/Dependencies2.md | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/Workshop/Dependencies2.md b/Workshop/Dependencies2.md index a9c875308..c54af0656 100644 --- a/Workshop/Dependencies2.md +++ b/Workshop/Dependencies2.md @@ -5,12 +5,10 @@ With AL-Go for GitHub, the recommendation is to create a Common repository, whic So, let's setup a single-project common repository like this. Navigate to https://aka.ms/algopte to create a new repository. Click Use this template and select Create a new repository. Select your organization as owner, specify a name and select Public. -| ![image](https://user-images.githubusercontent.com/10775043/232203510-095f1f0d-e407-413d-9e17-7a3e3e43b821.png) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/c79dac2e-bf52-4f3a-b86e-6a3f8cc1f392) | |-| -Run Update **AL-Go System Files** with **microsoft/AL-Go-PTE@preview** as the template URL and **Y** in Direct COMMIT. - -When upgrade is done, create 2 apps within the repository using the **Create a new app** workflow called **Common** and **Licensing**, using the following parameters: +Create 2 apps within the repository using the **Create a new app** workflow called **Common** and **Licensing**, using the following parameters: | Name | Value | | :-- | :-- | @@ -34,7 +32,7 @@ and Leaving out the sample code in order to avoid name clashes. -| ![image](https://user-images.githubusercontent.com/10775043/232205313-3e3df750-55d3-44ac-bb27-40f84971a9a0.png) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/94ec923f-9e6a-4dc4-a689-b70ab4290e55) | |-| Wait for both workflows to complete. @@ -43,7 +41,7 @@ Under **Code** locate the **app.json** file for the **Common** app and copy **id Now locate the **app.json** file for the **Licensing** app and create a dependency to the **Common** app and commit the changes. -| ![image](https://user-images.githubusercontent.com/10775043/232205817-c0c2adef-a61f-4406-8880-5d7db55c7804.png) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/f9918c5e-7363-46a1-8d3d-2a3acc7efa0c) | |-| Also copy the **id**, **name**, **publisher** and **version** from the **Licensing** app to the clipboard as well. @@ -54,7 +52,7 @@ Now, navigate back to your multi-project repository, which you created [here](Pr Add a dependency to the **Licensing** app from the **Common** repository, from the **mysolution.w1** app in the **W1** project. -| ![image](https://user-images.githubusercontent.com/10775043/232206403-bd93b016-3fe5-44fa-8aae-057323735034.png) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/6149aa2f-8bbc-4b63-9190-371a27ca593d) | |-| And as expected, the builds will fail. From 780e4ace180811284e6dc131c60f4825619e6d76 Mon Sep 17 00:00:00 2001 From: Freddy Kristiansen Date: Sun, 19 Nov 2023 07:09:07 +0100 Subject: [PATCH 143/235] Update Dependencies2.md --- Workshop/Dependencies2.md | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/Workshop/Dependencies2.md b/Workshop/Dependencies2.md index c54af0656..ae727bc20 100644 --- a/Workshop/Dependencies2.md +++ b/Workshop/Dependencies2.md @@ -57,7 +57,7 @@ Add a dependency to the **Licensing** app from the **Common** repository, from t And as expected, the builds will fail. -| ![image](https://user-images.githubusercontent.com/10775043/232211698-943bdad0-18e8-4163-94b7-3e77a4bad486.png) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/352d9170-43dc-431f-8e3d-503caab289d7) | |-| In this example using the **include** mechanism, but builds would also fail when using **useProjectDependencies**. @@ -66,33 +66,38 @@ In this workshop, I will describe two ways to to make this work. ## Using appDependencyProbingPaths -Now your organization variable ALGoOrgSettings, and add: +In the MySolution repository, navigate to Settings -> Secrets and Variables -> Actions and select Variables. Create a new repository variable called **ALGOREPOSETTINGS** with this content: -``` +```json +{ "appDependencyProbingPaths": [ { "repo": "freddydkorg/Common", "release_status": "latestBuild" } ] +} ``` -| ![image](https://user-images.githubusercontent.com/10775043/232247041-b9e20016-b734-4a39-9f87-e28a7af9d354.png) | +replacing **freddydkorg** with your organization name obviously. + +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/2dee232d-5e00-4349-a581-e02828eed4b0) | |-| -This setting means that all repositories in this organization will download the **latest build** from **freddydkorg/Common** and a subsequent build will succeed. +This setting means that all projects in this repository will download the **latest build** from **freddydkorg/Common** and a subsequent build will succeed. -| ![image](https://user-images.githubusercontent.com/10775043/232249808-bed9cb0c-e73d-422e-a629-1373dc128c13.png) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/f1cca350-9177-4d88-adb7-572bcd14b116) | |-| -If we had added the**appDependencyProbingPaths** only to the **W1** project, then the **W1** project would **succeed** and the **DK** and **US** projects **fail**. The reason for this is that we are using the **include** mechanism, which includes the source of **W1** in **DK** and **US**, but it doesn't add the **appDependencyProbingPaths** from **W1**. +If we had added the**appDependencyProbingPaths** only to the **W1** project, then the **W1** project would **succeed** and the **DK** and **US** projects **fail**. The reason for this is that we are using the **include** mechanism, which includes the source of **W1** in **DK** and **US**, but it doesn't add the **appDependencyProbingPaths** and other settings from **W1**. ## Using GitHub Packages If you already added appDependencyProbingPaths, then please remove these settings before continuing, making your build fail again. In order to use GitHub Packages for dependency resolution, we need to create an organizational secret called **GitHubPackagesContext**. The format of this secret needs to be **compressed JSON** containing two values: **serverUrl** and **token**. Example: -``` + +```json {"token":"ghp_XXXX","serverUrl":"https://nuget.pkg.github.com/freddydkorg/index.json"} ``` From 7685e3df2e2c262f3bb2c2e91cf890e22281de0f Mon Sep 17 00:00:00 2001 From: Freddy Kristiansen Date: Sun, 19 Nov 2023 07:09:26 +0100 Subject: [PATCH 144/235] Update Prerequisites.md --- Workshop/Prerequisites.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Workshop/Prerequisites.md b/Workshop/Prerequisites.md index ee77b7047..a5489351a 100644 --- a/Workshop/Prerequisites.md +++ b/Workshop/Prerequisites.md @@ -11,7 +11,8 @@ You will need: - The secret should be available to all public repositories (you cannot have organizational secret accessible for private repos in Free GitHub) 1. An organizational variable called ALGOORGSETTINGS - Containing the following JSON structure (for performance reasons) -``` + +```json { "useCompilerFolder": true, "doNotPublishApps": true, From 05ed2170626b2b47dfd4d61382e000d90a4aa516 Mon Sep 17 00:00:00 2001 From: Freddy Kristiansen Date: Sun, 19 Nov 2023 07:17:19 +0100 Subject: [PATCH 145/235] Update Dependencies1.md --- Workshop/Dependencies1.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Workshop/Dependencies1.md b/Workshop/Dependencies1.md index 7c143fcde..82077af30 100644 --- a/Workshop/Dependencies1.md +++ b/Workshop/Dependencies1.md @@ -59,7 +59,7 @@ If you already set up **useProjectDependencies**, please remove this setting fro Now, modify **DK/.AL-Go/settings.json** and **US/.AL-Go/settings.json** by adding this property -``` +```json "appDependencyProbingPaths": [ { "repo": ".", From b3128d7753f3ad145140e28ad668ea8350d54283 Mon Sep 17 00:00:00 2001 From: Freddy Kristiansen Date: Sun, 19 Nov 2023 08:47:49 +0100 Subject: [PATCH 146/235] Update Dependencies2.md --- Workshop/Dependencies2.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Workshop/Dependencies2.md b/Workshop/Dependencies2.md index ae727bc20..bee8d6f81 100644 --- a/Workshop/Dependencies2.md +++ b/Workshop/Dependencies2.md @@ -101,13 +101,16 @@ In order to use GitHub Packages for dependency resolution, we need to create an {"token":"ghp_XXXX","serverUrl":"https://nuget.pkg.github.com/freddydkorg/index.json"} ``` -Where **ghp_XXX** should be replaced by your **personal access token** with permissions to **Packages** and **freddydkorg** should be replaced by your **organization name**. +Where **ghp_XXX** should be replaced by a **personal access token** with permissions to **write:packages** and **freddydkorg** should be replaced by your **organization name**. + +> [!NOTE] +> Fine-grained personal access tokens doesn't support packages at this time, you need to use classic personal access tokens. You can also use BcContainerHelper and the function **New-ALGoNuGetContext** to create a JSON structure in the right format. Go to your organization settings and create an **organizational secret** called **GitHubPackagesContext** with the value above. -| ![image](https://user-images.githubusercontent.com/10775043/232253023-7131dba1-1be1-4cac-8786-27715899200b.png) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/bd7ae71b-88b8-490c-a7bf-12792c59634b) | |-| Now, navigate to your **Common** repository and run the **CI/CD** Workflow. Inspect the workflow summary after completion: From a37a70647e269378a6a85c3003aa13985420ac54 Mon Sep 17 00:00:00 2001 From: Freddy Kristiansen Date: Sun, 19 Nov 2023 08:54:36 +0100 Subject: [PATCH 147/235] Update Prerequisites.md --- Workshop/Prerequisites.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Workshop/Prerequisites.md b/Workshop/Prerequisites.md index a5489351a..34a77bc44 100644 --- a/Workshop/Prerequisites.md +++ b/Workshop/Prerequisites.md @@ -6,8 +6,9 @@ You will need: - Free should be enough to follow the workshop 1. A GitHub organizational account - Free should be enough to follow the workshop -1. An organizational secret called GHTOKENWORKFLOW - - Containing a personal access token with permissions to modify workflows. +1. An organizational secret called GHTOKENWORKFLOW containing a personal access token (classic or fine-grained) + - Using classic tokens, the token should have **workflow** permissions (automatically includes repo permissions) + - Using Fine-grained tokens, the token should have **Read and Write** access to **Contents**, **Pull Requests** and **Workflows** (automatically includes Read-only access to Metadata) - The secret should be available to all public repositories (you cannot have organizational secret accessible for private repos in Free GitHub) 1. An organizational variable called ALGOORGSETTINGS - Containing the following JSON structure (for performance reasons) From 10b26179097f6c0cab8a44c0924bf121b5899f9e Mon Sep 17 00:00:00 2001 From: Freddy Kristiansen Date: Sun, 19 Nov 2023 09:15:06 +0100 Subject: [PATCH 148/235] Update Dependencies2.md --- Workshop/Dependencies2.md | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/Workshop/Dependencies2.md b/Workshop/Dependencies2.md index bee8d6f81..0b7416be9 100644 --- a/Workshop/Dependencies2.md +++ b/Workshop/Dependencies2.md @@ -115,28 +115,32 @@ Go to your organization settings and create an **organizational secret** called Now, navigate to your **Common** repository and run the **CI/CD** Workflow. Inspect the workflow summary after completion: -| ![image](https://user-images.githubusercontent.com/10775043/232253742-7728e4a2-587e-40fa-a547-4c95ba4e9951.png) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/4a449287-2521-49b1-b5c9-e57d7047319f) | |-| -Notice the **Deliver to GitHub Packages** job, by creating the **GitHubPackagesContext** secret, you have enabled Continuous Delivery to GitHub Packages. +Notice the **Deliver to GitHubPackages** job. By creating the **GitHubPackagesContext** secret, you have enabled Continuous Delivery to GitHub Packages. -Now, navigate to your organization and select **Packages** and you will see GitHub Packages created for the two apps in **Common**. +Now, click **Code** and see that you have 2 Packages delivered from the repository: -| ![image](https://user-images.githubusercontent.com/10775043/232253790-7aee6c91-a858-4dd9-b85c-5f22a67394b5.png) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/eeeb6675-f565-47c6-8582-5c94c2b26971) | |-| -Next, navigate to your **MySolution** repository and run the **CI/CD** workflow and magically, all dependencies are now also resolved. +Click **Packages**, which will take you to Packages in your organizational profile. All packages are stored on the organization with a link to the owning repository: -| ![image](https://user-images.githubusercontent.com/10775043/232286871-845f02ea-a59a-46e8-b720-5ff1d6927ffe.png) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/010defe6-b3a7-4585-9326-d0d1de303157) | |-| -And GitHub Packages have been published for the 3 apps in MySolution as well +Next, navigate to your **MySolution** repository (where you deleted the ALGOREPOSETTINGS repository variable) and run the **CI/CD** workflow and magically, all dependencies are now also resolved. -| ![image](https://user-images.githubusercontent.com/10775043/232286814-4d4572f3-fa14-460e-84ba-f18fa071860f.png) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/4ebbc94e-a55c-47cd-a361-4e78828bed7c) | +|-| + +Looking into the logs under the RunPipeline step, you will find that Resolving Dependencies will find that it is missing the Licensing dependency and then, it searches GitHub Packages to locate the missing dependencies. + +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/c2e48b09-7239-4cb2-881e-cd52ee5d6508) | |-| Continuous Delivery is not only GitHub Packages. Let's have a look at continuous delivery... --- [Index](Index.md)  [next](ContinuousDelivery.md) - From 252e762058feb3e6413838978c570592c5453e8d Mon Sep 17 00:00:00 2001 From: Freddy Kristiansen Date: Sun, 19 Nov 2023 09:16:47 +0100 Subject: [PATCH 149/235] Update Dependencies2.md --- Workshop/Dependencies2.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Workshop/Dependencies2.md b/Workshop/Dependencies2.md index 0b7416be9..1cc944364 100644 --- a/Workshop/Dependencies2.md +++ b/Workshop/Dependencies2.md @@ -135,7 +135,7 @@ Next, navigate to your **MySolution** repository (where you deleted the ALGOREPO | ![image](https://github.com/microsoft/AL-Go/assets/10775043/4ebbc94e-a55c-47cd-a361-4e78828bed7c) | |-| -Looking into the logs under the RunPipeline step, you will find that Resolving Dependencies will find that it is missing the Licensing dependency and then, it searches GitHub Packages to locate the missing dependencies. +Looking into the logs under the **RunPipeline** step, you will find that **Resolving Dependencies** will find that it is missing the **Licensing** dependency and then, under **installing app dependencies**, it searches GitHub Packages to locate the missing dependencies (+ their dependencies) | ![image](https://github.com/microsoft/AL-Go/assets/10775043/c2e48b09-7239-4cb2-881e-cd52ee5d6508) | |-| From 8db8714ef2c428a8280e0ba80bc57061589a1727 Mon Sep 17 00:00:00 2001 From: Freddy Kristiansen Date: Mon, 20 Nov 2023 15:04:47 +0100 Subject: [PATCH 150/235] Update Dependencies2.md --- Workshop/Dependencies2.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Workshop/Dependencies2.md b/Workshop/Dependencies2.md index 1cc944364..d63e7c0a5 100644 --- a/Workshop/Dependencies2.md +++ b/Workshop/Dependencies2.md @@ -140,6 +140,21 @@ Looking into the logs under the **RunPipeline** step, you will find that **Resol | ![image](https://github.com/microsoft/AL-Go/assets/10775043/c2e48b09-7239-4cb2-881e-cd52ee5d6508) | |-| +and looking at packages for the organization, we will now see that there are 5 packages - 3 of them published from the MySolutions repository: + +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/a94bac82-cc70-40b6-acb6-682623e061c1) | +|-| + +Now, if we remove the **appDependencyProbingPaths** settting in the **DK** and **US** project in **MySolution**, we will see that all projects still build. The reason for this is, that they will now download the W1 package from GitHub Packages, instead of including the W1 project when building DK and US: + +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/6bf22151-321f-4494-8acf-da28763932da) | +|-| + +Note though that this means that the DK and US projects will use the previously delivered version of the W1 dependency and not the one that is build in parallel with DK and US. If we set **useProjectDependencies** to true and run **Update AL-Go System Files**, projects will now be build in order and project dependencies from the same repository will be taken from the same build, while external dependencies will be taken from GitHub Packages. In the summary, we can also see that the newly build apps are also delivered to GitHub packages: + +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/3342e737-24a8-416e-98ea-355d8f6a6a5d) | +|-| + Continuous Delivery is not only GitHub Packages. Let's have a look at continuous delivery... --- From 96aadd3d5434950b69cf13c7aff398fdaa64304e Mon Sep 17 00:00:00 2001 From: Freddy Kristiansen Date: Mon, 20 Nov 2023 15:59:32 +0100 Subject: [PATCH 151/235] Update ContinuousDelivery.md --- Workshop/ContinuousDelivery.md | 41 +++++++++++++++++++++++++++------- 1 file changed, 33 insertions(+), 8 deletions(-) diff --git a/Workshop/ContinuousDelivery.md b/Workshop/ContinuousDelivery.md index da21bd5d0..449f7c0b8 100644 --- a/Workshop/ContinuousDelivery.md +++ b/Workshop/ContinuousDelivery.md @@ -12,30 +12,55 @@ This workshop has already described how to setup continuous delivery for GitHub ## Storage Setting up continuous delivery to a storage account is done in the same mechanism as we did with GitHub Packages. -Create an organizational secret called **StorageContext**. The format of the secret needs to be **compressed JSON**, containing 4 values: **StorageAccountName**, **StorageAccountKey**, **ContainerName** and **BlobName**. Example: -``` +Create an organizational secret called **StorageContext**. The format of the secret needs to be **compressed JSON**, containing 4 values: **storageAccountName**, **containerName**, **blobName** and either **storageAccountKey** or **sasToken**. Example: + +```json {"StorageAccountName":"accountnanme","StorageAccountKey":"HOaRhoNXXX==","containerName":"{project}","blobName":"{version}/{project}-{type}.zip"} ``` -ContainerName and BlobName can contain "variable", like {project}, {version} and {type} which will be replaced by the real values when delivering. +or + +```json +{"storageAccountName":"accountnanme","sasToken":""?sv=2021-10-04\u0026ss=b\u0026srt=sco...","containerName":"{project}","blobName":"{version}/{project}-{type}.zip"} +``` + +ContainerName and BlobName can contain placeholders, like {project}, {version} and {type} which will be replaced by the real values when delivering. + +In order to setup **continuous delivery** to a **storage account**, you need to have an Azure Account and setup a storage account in the **Azure Portal**. You can create a **blob container** with the name of the the calculated container (based on containerName in the StorageContext) or you can add a setting called DeliverToStorage with a property called CreateContainerIfNotExist set to true for auto generation of the blob container. After this, create the secret value above manually or use the **New-ALGoStorageContext** from BcContainerHelper. + +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/7287e068-b2d5-4fc2-b428-d0ddd4ffa0e3) | +|-| -In order to setup **continuous delivery** to a **storage account**, you need to have an Azure Account and setup a storage account in the **Azure Portal**, and create a **blob container** with the name of the the calculated container (based on containerName in the StorageContext). After this, create the secret above manually or use the **New-ALGoStorageContext** from BcContainerHelper. +Now create an organizational secret called **StorageContext** with the secret value. -| ![image](https://user-images.githubusercontent.com/10775043/232289028-e73c8395-b39d-49d7-9e5b-52eb8e8c8db4.png) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/8631d67f-d772-43f5-bae3-a0f342f89fdd) | |-| -and when running **CI/CD** afterwards, you will see that continuous delivery is now setup for a storage account as well +and add the deliverToStorage setting to the ALGOORGSETTINGS organizational variable: -| ![image](https://user-images.githubusercontent.com/10775043/232289443-9109d260-8009-470f-950a-b8960ab2a44e.png) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/9975ebbd-a98d-4bed-a57f-dae1c26546bd) | +|-| + +When re-running **CI/CD** afterwards, you will see that continuous delivery is now setup for a storage account as well + +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/2ec22ccd-76fa-4705-8e64-6b16a5867934) | +|-| + +Checking the storage account using Storage Explorer reveals the new container and the new app. + +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/60db8d6e-7b4e-46cb-b426-aa1290b498aa) | |-| ## AppSource Continuous delivery to **AppSource** is supported by the AppSource template and will be included in the workshop later, but basically, creating a secret called **AppSourceContext** and setting a **AppSourceContinuousDelivery** to true in the repository settings file. +## NuGet +Still work-in-progress. Delivery to NuGet is supposed to be delivery to a NuGet feed, where your partners can get access to your apps or runtime packages. + ## Custom delivery Custom delivery will be handled in an advanced part of this workshop later. -OK, so **CD** stands for **Continuous Delivery**, I thought it was **Continuous Deployment**? Well, it is both, so let's talk about **Continuous Deployment**... +OK, so **CD** stands for **Continuous Delivery**, I thought it was **Continuous Deployment**? Well, it is actually both, so let's talk about **Continuous Deployment**... --- [Index](Index.md)  [next](ContinuousDeployment.md) From 63305b4d46b27b2eb565a2d3a0e3fade7a1cd05a Mon Sep 17 00:00:00 2001 From: Freddy Kristiansen Date: Mon, 20 Nov 2023 16:00:23 +0100 Subject: [PATCH 152/235] Update ContinuousDelivery.md --- Workshop/ContinuousDelivery.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Workshop/ContinuousDelivery.md b/Workshop/ContinuousDelivery.md index 449f7c0b8..668bef27b 100644 --- a/Workshop/ContinuousDelivery.md +++ b/Workshop/ContinuousDelivery.md @@ -55,7 +55,7 @@ Checking the storage account using Storage Explorer reveals the new container an Continuous delivery to **AppSource** is supported by the AppSource template and will be included in the workshop later, but basically, creating a secret called **AppSourceContext** and setting a **AppSourceContinuousDelivery** to true in the repository settings file. ## NuGet -Still work-in-progress. Delivery to NuGet is supposed to be delivery to a NuGet feed, where your partners can get access to your apps or runtime packages. +Still work-in-progress. Delivery to NuGet is supposed to be delivery to a NuGet feed, where your partners can get access to your apps or runtime packages. This section will be updated when we release delivery to NuGet in it's final version. ## Custom delivery Custom delivery will be handled in an advanced part of this workshop later. From be944bb6c29c37cc880b0ca4ce0839c06dc76095 Mon Sep 17 00:00:00 2001 From: Freddy Kristiansen Date: Mon, 20 Nov 2023 16:04:00 +0100 Subject: [PATCH 153/235] Update ContinuousDeployment.md --- Workshop/ContinuousDeployment.md | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/Workshop/ContinuousDeployment.md b/Workshop/ContinuousDeployment.md index 5520edbad..bc730c50e 100644 --- a/Workshop/ContinuousDeployment.md +++ b/Workshop/ContinuousDeployment.md @@ -1,12 +1,10 @@ # Continuous Deployment -Continuous Deployment is currently only supporting sandox environments (like **QA** or **FAT** environments) +Using Continuous Deployment you can deploy your apps to an online environment continuously. Much like with continuous delivery, you need to setup an authentication context and then you need to setup an environment. -Much like with continuous delivery, you need to setup an authentication context and then you need to setup an environment. +The authentication context can use **impersonation** (which uses a **refreshtoken**, which typically is valid for **90** days) or **S2S** (which uses **ClientId** and **ClientSecret**, which needs to be **registered** inside your **Business Central Environment**. -The authentication context can use **impersonation** (which uses a **refreshtoken** that is valid for **90** days) or **S2S** (which uses **ClientId** and **ClientSecret**, which needs to be **registered** inside your **Business Central Environment**. - -First thing we need to do is to create an **environment** in your **GitHub repository**, which the same name as your Business Central environment. +First thing we need to do is to create an **environment** in your **GitHub repository** with a name, which identifies your Business Central environment for you. Navigate to your single-project repository (**repo1**), select **Settings** and **Environments** and click **New environment**. Enter the name of your Business Central environment and click **Configure environment** From 47a704cdef5d372e6cc1c2ae8a87904a5dda3d62 Mon Sep 17 00:00:00 2001 From: Freddy Kristiansen Date: Mon, 20 Nov 2023 17:41:31 +0100 Subject: [PATCH 154/235] Update ContinuousDeployment.md --- Workshop/ContinuousDeployment.md | 52 +++++++++++++++++++++++--------- 1 file changed, 37 insertions(+), 15 deletions(-) diff --git a/Workshop/ContinuousDeployment.md b/Workshop/ContinuousDeployment.md index bc730c50e..f7c44b0e9 100644 --- a/Workshop/ContinuousDeployment.md +++ b/Workshop/ContinuousDeployment.md @@ -4,50 +4,72 @@ Using Continuous Deployment you can deploy your apps to an online environment co The authentication context can use **impersonation** (which uses a **refreshtoken**, which typically is valid for **90** days) or **S2S** (which uses **ClientId** and **ClientSecret**, which needs to be **registered** inside your **Business Central Environment**. -First thing we need to do is to create an **environment** in your **GitHub repository** with a name, which identifies your Business Central environment for you. +First thing we need to do is to create an **environment** in your **GitHub repository** with a name, which identifies your Business Central environment. -Navigate to your single-project repository (**repo1**), select **Settings** and **Environments** and click **New environment**. Enter the name of your Business Central environment and click **Configure environment** +Navigate to your single-project repository (**repo1**), select **Settings** -> **Environments** and click **New environment**. Enter a name for your Business Central environment and click **Configure environment** -| ![image](https://user-images.githubusercontent.com/10775043/232294280-cc92b21b-f5ae-4381-b63b-e05b72159486.png) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/4076c014-2443-4cb1-837d-a85d436b596f) | |-| -In the environment configuration screen, Click **Add secret** under **environment secrets**. Create a secret called AUTHCONTEXT and use one of the two mechanisms described below to create the auth context value: +In the environment configuration screen, Click **Add secret** under **Environment secrets**. Create a secret called AUTHCONTEXT and use one of the two mechanisms described below to create the auth context value: -## Using Impersonation -Easiest way to create an authentication context with impersonation for AL-Go for GitHub is to use the following PowerShell line from a machine with the BcContainerHelper module installed: +After creating the environment and the AUTHCONTEXT secret, you should create a setting structure called DeployTo followed by your GitHub environment name. Read more about the DeployTo setting [here](https://aka.ms/algosettings#DeployTo)). +If your actual Business Central environment has a different name than your GitHub environment, you can add an EnvironmentName property to the DeliverTo settings like: +```json +{ + "DeployToMy-QA": { + "EnvironmentName": "QA", + "ContinuousDeployment": true + } +} ``` + +At this time, these settings cannot be added as environment variables, we might add this in the future. + +## Creating an AUTHCONTEXT that uses impersonation +Easiest way to create an authentication context with impersonation for AL-Go for GitHub is to use the following PowerShell line from a machine with the latest BcContainerHelper module installed: + +```powershell New-BcAuthContext -includeDeviceLogin | New-ALGoAuthContext | set-Clipboard ``` -This command will display the well-known device login text: To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code XXXXXXX to authenticate. +This command will display the well-known device login text: **To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code XXXXXXX to authenticate.** Complete the login with a Business Central user, which has access to deploy applications in the environment setup for continuous deployment. This will generate an Aothorization context for the environment and Copy it automatically to your clipboard. Return to the "Add Secret" dialog from the environment configuration screen, paste the secret into the "Value" field, and click **Add secret**. -| ![image](https://user-images.githubusercontent.com/10775043/232296180-7ef20c2c-6a2a-4127-b524-7646512994e2.png) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/89d65117-d93a-4551-9ad5-83f4de60d596) | |-| Now, select **Actions** and select the **CI/CD** workflow and click **Run workflow**. Inspect the workflow and see that deployment now also deploys your apps: -| ![image](https://user-images.githubusercontent.com/10775043/232300284-49ca8a4c-bd91-46b8-9608-76f4a6289f0f.png) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/fb12b77a-8c01-4432-b411-5047815b81e7) | |-| -Note that you need to update the AuthContext secret every 90 days for now. +The URL under the deployment will navigate to the environment. -## Using S2S -For using **S2S**, you need to do some preparation first. Follow [this](https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/administration/automation-apis-using-s2s-authentication) description to setup an **AAD App** and register it inside the **Business Central environment** you want to deploy to. +> [!NOTE] +> You need to update the AuthContext secret every 90 days for now. -Once this is done, you can then create an Authentication context secret by using this PowerShell line from a machine with the BcContainerHelper module installed: +## Creating an AUTHCONTEXT that uses S2S +For using **S2S**, you need to do some preparation first. Follow [this](https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/administration/automation-apis-using-s2s-authentication) description to setup a **Microsoft Entra application** and register it inside the **Business Central environment** you want to deploy to. -``` +Once this is done, you can then create an Authentication context secret by using this PowerShell line from a machine with the latest BcContainerHelper module installed: + +```powershell New-BcAuthContext -clientID $clientID -clientSecret $clientSecret -tenantID $tenantID | New-ALGoAuthContext | Set-Clipboard ``` Paste the value from the clipboard into the "Value" field of the **AuthContext** secret for the environment and you should be good to go. -**Note** The Environments tab in repository **Settings** is only supported in **paid SKUs** of GitHub or for **public repositories**. It is possible to use repository or organizational secrets for authenticating to environments defined in **Settings**, as an alternative to using environment secrets as we have done here, but this is not part of this workshop. +> [!NOTE] +> The Environments tab in repository **Settings** is only supported in **paid SKUs** of GitHub or for **public repositories**. It is possible to use repository or organizational secrets for authenticating to environments defined in **Settings**, as an alternative to using environment secrets as we have done here, but this is not part of this workshop. + +## What about deployments to on-premises installations of Business Central + +Currently Now you might think, if this only supports sandbox environments, how do you then publish to production? From acba9c019881e5ca979d70dded31d6e929d759b8 Mon Sep 17 00:00:00 2001 From: Freddy Kristiansen Date: Mon, 20 Nov 2023 17:42:01 +0100 Subject: [PATCH 155/235] Update ContinuousDelivery.md --- Workshop/ContinuousDelivery.md | 1 + 1 file changed, 1 insertion(+) diff --git a/Workshop/ContinuousDelivery.md b/Workshop/ContinuousDelivery.md index 668bef27b..3e1a9ad75 100644 --- a/Workshop/ContinuousDelivery.md +++ b/Workshop/ContinuousDelivery.md @@ -5,6 +5,7 @@ Currently, the following targets are supported: - GitHub Packages - Storage - AppSource +- NuGet (work in progress) - Custom This workshop has already described how to setup continuous delivery for GitHub Packages [here](Dependencies2.md). From cde70e01f52304bce3308e19d998184b02b227ea Mon Sep 17 00:00:00 2001 From: Freddy Kristiansen Date: Mon, 20 Nov 2023 17:59:39 +0100 Subject: [PATCH 156/235] Update ContinuousDeployment.md --- Workshop/ContinuousDeployment.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Workshop/ContinuousDeployment.md b/Workshop/ContinuousDeployment.md index f7c44b0e9..98bc19685 100644 --- a/Workshop/ContinuousDeployment.md +++ b/Workshop/ContinuousDeployment.md @@ -67,9 +67,9 @@ Paste the value from the clipboard into the "Value" field of the **AuthContext** > [!NOTE] > The Environments tab in repository **Settings** is only supported in **paid SKUs** of GitHub or for **public repositories**. It is possible to use repository or organizational secrets for authenticating to environments defined in **Settings**, as an alternative to using environment secrets as we have done here, but this is not part of this workshop. -## What about deployments to on-premises installations of Business Central +## Custom Deployments -Currently +The Now you might think, if this only supports sandbox environments, how do you then publish to production? From e64548e8fc1e9d9253a9316d27640064f1f93d27 Mon Sep 17 00:00:00 2001 From: Freddy Kristiansen Date: Mon, 20 Nov 2023 18:00:56 +0100 Subject: [PATCH 157/235] Update ContinuousDeployment.md --- Workshop/ContinuousDeployment.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Workshop/ContinuousDeployment.md b/Workshop/ContinuousDeployment.md index 98bc19685..147371907 100644 --- a/Workshop/ContinuousDeployment.md +++ b/Workshop/ContinuousDeployment.md @@ -69,7 +69,7 @@ Paste the value from the clipboard into the "Value" field of the **AuthContext** ## Custom Deployments -The +AL-Go can also be setup for custom deployment when you want to deploy to non-SaaS environments. More about this in the advanced section. Now you might think, if this only supports sandbox environments, how do you then publish to production? From a2fb67c65d0f285cec894c627372723f2cdf53c6 Mon Sep 17 00:00:00 2001 From: Freddy Kristiansen Date: Mon, 20 Nov 2023 18:02:44 +0100 Subject: [PATCH 158/235] Update ContinuousDeployment.md --- Workshop/ContinuousDeployment.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Workshop/ContinuousDeployment.md b/Workshop/ContinuousDeployment.md index 147371907..c6f7a7bff 100644 --- a/Workshop/ContinuousDeployment.md +++ b/Workshop/ContinuousDeployment.md @@ -71,7 +71,8 @@ Paste the value from the clipboard into the "Value" field of the **AuthContext** AL-Go can also be setup for custom deployment when you want to deploy to non-SaaS environments. More about this in the advanced section. -Now you might think, if this only supports sandbox environments, how do you then publish to production? + +This section was about Continuous Deployment, but you might not want to deploy to production environments continuously - how can we publish to production on demand? --- [Index](Index.md)  [next](PublishToProduction.md) From e51125493bbee4396d32e4577d6ae31906a99586 Mon Sep 17 00:00:00 2001 From: Freddy Kristiansen Date: Mon, 20 Nov 2023 23:29:34 +0100 Subject: [PATCH 159/235] Update PublishToProduction.md --- Workshop/PublishToProduction.md | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/Workshop/PublishToProduction.md b/Workshop/PublishToProduction.md index 96ea64bf7..a24c3e158 100644 --- a/Workshop/PublishToProduction.md +++ b/Workshop/PublishToProduction.md @@ -1,12 +1,24 @@ # Publish To Production In [this](ContinuousDeployment.md) section you learned how to setup a QA environment for continuous deployment. -If you follow the same process for setting up an environment, but postfix your environment name with **(Production)**, like: +If you follow the same process and setup an environment called PROD: -| ![image](https://user-images.githubusercontent.com/10775043/232310956-96179562-e101-4b90-9a01-12c8c316cfd3.png) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/98d4a06f-05cb-489b-afcf-4a46d9a06020) | |-| -Then that environment will not be picked up for **continuous deployment**, but can only be deployed to using the **Publish To Environment** workflow. +By default, all environments will be picked up for **continuous deployment**, but production environments will be skipped unless you add the ContinuousDeployment setting from the previous chapter. The Deployment job will succeed, but looking into the step, you will see: + +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/4b4f70ec-b503-44d9-b417-5c0ba3e65c0d) | +|-| + +By adding a setting like: + +```json + + +``` + +should be but can only be deployed to using the **Publish To Environment** workflow. **Note** that there are plans to update the mechanism for when an environment is picked up for deployment, to allow deployment to environments postfixed with **(Production)**. This will be done by including some settings. But until those settings are present, the mechanism will work as described here. From b363ae808aba5a9aeb594d4b7ac7b87b8417b8c1 Mon Sep 17 00:00:00 2001 From: Freddy Kristiansen Date: Mon, 20 Nov 2023 23:45:10 +0100 Subject: [PATCH 160/235] Update PublishToProduction.md --- Workshop/PublishToProduction.md | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/Workshop/PublishToProduction.md b/Workshop/PublishToProduction.md index a24c3e158..f665e7ac7 100644 --- a/Workshop/PublishToProduction.md +++ b/Workshop/PublishToProduction.md @@ -6,7 +6,7 @@ If you follow the same process and setup an environment called PROD: | ![image](https://github.com/microsoft/AL-Go/assets/10775043/98d4a06f-05cb-489b-afcf-4a46d9a06020) | |-| -By default, all environments will be picked up for **continuous deployment**, but production environments will be skipped unless you add the ContinuousDeployment setting from the previous chapter. The Deployment job will succeed, but looking into the step, you will see: +By default, all environments will be picked up for **continuous deployment**, but production environments will be skipped unless you add the ContinuousDeployment setting from the previous chapter. The Deployment job will succeed, but looking into the step, you will see that the PROD environment is ignored: | ![image](https://github.com/microsoft/AL-Go/assets/10775043/4b4f70ec-b503-44d9-b417-5c0ba3e65c0d) | |-| @@ -14,25 +14,35 @@ By default, all environments will be picked up for **continuous deployment**, bu By adding a setting like: ```json - - +{ + "DeployToPROD": { + "ContinuousDeployment": false + } +} ``` -should be but can only be deployed to using the **Publish To Environment** workflow. +The PROD environment is not even included in the CI/CD workflow, and again, setting the ContinuousDeployment to true will enable continuous deployment to the production environment. -**Note** that there are plans to update the mechanism for when an environment is picked up for deployment, to allow deployment to environments postfixed with **(Production)**. This will be done by including some settings. But until those settings are present, the mechanism will work as described here. +## Publish to Environment -Publish to the production environment by running the workflow and specifying which version to deploy, and which environment to deploy to. +Menually publishing to environments is done by running the **Publish To Environment** workflow and specifying which version to publish. -**Note** that the default version is "current". This will deploy the **current release**. If you specify *latest* you will get the **latest build** +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/57f8441b-d414-4225-9cf4-dc2f7ce185a0) | +|-| -> Current is the **current release**, which is the release tagged with *Latest* in your repository +> [!NOTE] +> The default version is **current**. This will deploy the **current release**, which is the release tagged with *Latest* in your repository > > ![image](https://github.com/microsoft/AL-Go/assets/10775043/236f1eac-3045-4b19-90a1-1f81e2ad26a6) -And... again, if you want to just use the latest *build*, you would specify "latest": +If you want to deploy the latest *build*, you would specify "latest" and if you want to deploy a specific version, you should specify the project version number to deploy. + +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/ab6878fb-3480-46ec-948e-2f55efc572a5) | +|-| + +Investigating the **Publish To Environment** workflow run, you will see a Deploy step like the one in CI/CD, which also includes a link to the environment. -| ![image](https://user-images.githubusercontent.com/10775043/232312134-0028a08d-1004-43f2-8127-aeeee8ed1a5e.png) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/de8958a5-c9fb-4c9b-912c-bf037096c0bd) | |-| But... - would you do that without running automated tests? From 0d44b01636c0484b8ce04adc974f0c715695859d Mon Sep 17 00:00:00 2001 From: Freddy Kristiansen Date: Tue, 21 Nov 2023 00:14:59 +0100 Subject: [PATCH 161/235] Update AutomatedTests.md --- Workshop/AutomatedTests.md | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/Workshop/AutomatedTests.md b/Workshop/AutomatedTests.md index f3e20796a..f5e6ae51e 100644 --- a/Workshop/AutomatedTests.md +++ b/Workshop/AutomatedTests.md @@ -1,25 +1,29 @@ # Automated Tests In order to run automated tests, you need to change a few things in settings. -During prerequisites we added two AL-Go settings: +During prerequisites we added two AL-Go settings to the ALGOORGSETTINGS organizational variable: -``` - "useCompilerFolder": true - "doNotPublishApps": true +```json +{ + "useCompilerFolder": true, + "doNotPublishApps": true +} ``` -These settings means that AL-Go will use a CompilerFolder to compile the apps instead of a container and that we will never actually publish the apps (meaning that Test runs are also disabled). +These settings means that AL-Go will use a CompilerFolder functionality to compile the apps instead of a container and that we will never actually publish the apps (meaning that Test runs are also disabled). In this step, we will add a test app to the single-project repository and see how AL-Go handles test runs and test results. -So, navigate to your single-project repository, locate the .github/AL-Go-Settings.json file and add the following two settings: +So, navigate single-project repository, locate the .github/AL-Go-Settings.json file and add the following two settings: -``` - "useCompilerFolder": false - "doNotPublishApps": false +```json +{ + "useCompilerFolder": false, + "doNotPublishApps": false +} ``` -| ![image](https://user-images.githubusercontent.com/10775043/232327081-6c6f7be3-fa18-41d2-98b3-ff540a953125.png) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/f94be356-0187-4add-9c3e-f3eaf1423cd8) | |-| Now select **Actions** and locate the **Create a new test app** action and click **Run workflow** and use the following parameters: @@ -33,17 +37,18 @@ Now select **Actions** and locate the **Create a new test app** action and click | Include Sample Code | `Y` | | Direct COMMIT | `N` | -| ![image](https://user-images.githubusercontent.com/10775043/232327235-bd4350f7-d05f-423b-a69b-0b0c226180b3.png) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/eab3a42e-a73c-4c13-bc05-7cc2c7a4b05e) | |-| Inspect and **merge** the pull request. Now completion of the merge pull request **will be much slower than before**, as the GitHub hosted runners needs to download the Business Central Generic image and the artifacts every single time. When the workflow is done, you should see that below the artifacts produced by the **CI/CD** workflow, there is a summary field with the test results. -| ![image](https://user-images.githubusercontent.com/10775043/232337935-f20f3e8b-94a7-42cf-a97a-37ce09f9a479.png) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/f0f570ae-bd2b-4f41-b3e0-a9bc406d9ad3) | |-| As already mentioned, running complete builds with full tests does take more time than containerless compiling. We are working on improving this. -Our recommendation is that you run your full test suite during **CI/CD**, but it is possible with **AL-Go for GitHub**, to not run the tests during **CI/CD** and then postpone them to a nightly test run using a scheduled run of the **Test Current** workflow. +> [!NOTE] +> Our recommendation is that you run your full test suite during **CI/CD**, but it is possible with **AL-Go for GitHub**, to not run the tests during **CI/CD** and then postpone them to a nightly test run using a scheduled run of the **Test Current** workflow. So, let's see what it takes to setup scheduled runs for running the tests with **latest** or **future versions** of Business Central? From 6c0f3d353533c238132421f4b569e4f857c60335 Mon Sep 17 00:00:00 2001 From: Freddy Kristiansen Date: Tue, 21 Nov 2023 06:13:36 +0100 Subject: [PATCH 162/235] Update ScheduledTestRuns.md --- Workshop/ScheduledTestRuns.md | 33 ++++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/Workshop/ScheduledTestRuns.md b/Workshop/ScheduledTestRuns.md index 1fde3e56b..dec193aeb 100644 --- a/Workshop/ScheduledTestRuns.md +++ b/Workshop/ScheduledTestRuns.md @@ -1,30 +1,49 @@ # Scheduled Test Runs + Building and testing your apps with the latest and the upcoming versions of Business Central is a crucial part of your DevOps setup. You will know when your app will be broken and can be prepared for the next version way ahead of time, making sure that your customers are not held up by your apps. -To be able to run the workflows for testing against **Next Minor** and **Next Major** versions of Business Central, you will need an **insider SAS Token**, which is available on https://aka.ms/collaborate (Select **Packages** and **Working with Business Central insider builds**). The Direct URL is [here](https://partner.microsoft.com/en-us/dashboard/collaborate/packages/9387), but you will have to have an account with collaborate in order to use the link. +AL-Go for GitHub includes 3 workflows for this purpose: **Test Current**, **Test Next Minor** and **Test Next Major**, which will build and test your app against the corresponding versions of Business Central. + +These workflows can be run manually by simply selecting the workflow and clicking **Run workflow**. + +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/5cec9a1b-04d0-4010-a647-bb631903e80e) | +|-| -Use **https://crontab.guru** to create a crontab for the schedule you want to run your workflows on. I have selected the following: +Microsoft recommands running these workflows on a schedule to ensure that your app is ready for upcoming releases at all times and at the same time keeping compatibility with the versions you want to support. + +Use **https://crontab.guru** to create a crontab for the schedule you want to run your workflows on. I have selected the following for some of my apps: - I want to run the **Test Current** workflow every day at 2 in the morning. The crontab for that is: 0 2 * * * - I want to run the **Test Next Minor** workflow every Saturday at 2 in the morning. The crontab for that is: 0 2 * * 6 - I want to run the **Test Next Major** workflow every Sunday at 2 in the morning. The crontab for that is: 0 2 * * 0 -In your single-project repository, select **Code**, navigate to **.github/AL-Go-Settings.json**, remove the 2 settings (**useCompilerFolder** and **doNotPublishApps**) we added to run tests and add 3 new settings: +In your single-project repository, select **Code**, navigate to **.github/AL-Go-Settings.json**, remove the 2 settings (**useCompilerFolder** and **doNotPublishApps** ) we added to run tests and add 3 new settings: + +```json +"CurrentSchedule": "0 2 * * *", +"NextMinorSchedule": "0 2 * * 6", +"NextMajorSchedule": "0 2 * * 0" +``` -| ![image](https://user-images.githubusercontent.com/10775043/232339274-3c295485-ccc3-48b1-ab57-cd9ad85c5e04.png) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/480c759b-c276-439e-9d89-af26ce4780dd) | |-| Now, select **Actions** and run the **Update AL-Go System Files** workflow in order for the schedule to take effect. You can see the changes to the workflows done by the **Update AL-Go System Files** workflow in the **pull request**. -| ![image](https://user-images.githubusercontent.com/10775043/232339690-047441f5-cd65-43f9-a40a-5b46e923c77d.png) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/e868a217-010d-4fea-8be8-e707e5e76900) | |-| -Now, modify .github/Test Current.settings.json and add the two settings (useCompilerFolder and doNotPublishApps) in that one +Now, modify **.github/Test Current.settings.json** and add the two settings (useCompilerFolder and doNotPublishApps) in that one -| ![image](https://user-images.githubusercontent.com/10775043/232340747-6eb81ab9-0bb2-4947-9416-8af2108de834.png) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/1028a813-87db-438e-a271-ef8e87415799) | |-| Which now means that your Test Current workflow, which runs every night will run all tests and other workflows will not. +> [!NOTE] +> While the name of the workflow specific settings file is based on the workflow title, the workflow schedule setting needs to be in AL-Go-Settings.json and is based on the filename of the workflow (NextMajor.yaml here): +> +> ![image](https://github.com/microsoft/AL-Go/assets/10775043/b3abf297-2ee6-4160-b1c1-ddeeab985cda) + Now we know when our app gets broken and doesn't work anymore, but what about performance regressions? --- From 6637a3426fed28d29f92dcff80aa0f10e03c8495 Mon Sep 17 00:00:00 2001 From: Freddy Kristiansen Date: Tue, 21 Nov 2023 06:15:41 +0100 Subject: [PATCH 163/235] Update ScheduledTestRuns.md --- Workshop/ScheduledTestRuns.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Workshop/ScheduledTestRuns.md b/Workshop/ScheduledTestRuns.md index dec193aeb..603029b53 100644 --- a/Workshop/ScheduledTestRuns.md +++ b/Workshop/ScheduledTestRuns.md @@ -40,7 +40,7 @@ Now, modify **.github/Test Current.settings.json** and add the two settings (use Which now means that your Test Current workflow, which runs every night will run all tests and other workflows will not. > [!NOTE] -> While the name of the workflow specific settings file is based on the workflow title, the workflow schedule setting needs to be in AL-Go-Settings.json and is based on the filename of the workflow (NextMajor.yaml here): +> While the name of the workflow specific settings file is based on the workflow title (**Test Next Major.settings.json**), the workflow schedule setting needs to be in AL-Go-Settings.json and is based on the filename of the workflow (**NextMajorSchedule**): > > ![image](https://github.com/microsoft/AL-Go/assets/10775043/b3abf297-2ee6-4160-b1c1-ddeeab985cda) From 9d47d634626fe4bb7175dedefd525c763d172d0d Mon Sep 17 00:00:00 2001 From: Freddy Kristiansen Date: Tue, 21 Nov 2023 06:18:44 +0100 Subject: [PATCH 164/235] Update Dependencies2.md --- Workshop/Dependencies2.md | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/Workshop/Dependencies2.md b/Workshop/Dependencies2.md index d63e7c0a5..ae6274cce 100644 --- a/Workshop/Dependencies2.md +++ b/Workshop/Dependencies2.md @@ -69,14 +69,12 @@ In this workshop, I will describe two ways to to make this work. In the MySolution repository, navigate to Settings -> Secrets and Variables -> Actions and select Variables. Create a new repository variable called **ALGOREPOSETTINGS** with this content: ```json -{ - "appDependencyProbingPaths": [ - { - "repo": "freddydkorg/Common", - "release_status": "latestBuild" - } - ] -} + "appDependencyProbingPaths": [ + { + "repo": "freddydkorg/Common", + "release_status": "latestBuild" + } + ] ``` replacing **freddydkorg** with your organization name obviously. From 7656478cbb41deeec58105d273150ce55840e3e9 Mon Sep 17 00:00:00 2001 From: Freddy Kristiansen Date: Tue, 21 Nov 2023 06:19:13 +0100 Subject: [PATCH 165/235] Update Prerequisites.md --- Workshop/Prerequisites.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Workshop/Prerequisites.md b/Workshop/Prerequisites.md index 34a77bc44..b5df911d3 100644 --- a/Workshop/Prerequisites.md +++ b/Workshop/Prerequisites.md @@ -14,11 +14,11 @@ You will need: - Containing the following JSON structure (for performance reasons) ```json - { - "useCompilerFolder": true, - "doNotPublishApps": true, - "artifact": "https://bcartifacts.azureedge.net/sandbox/23.0.12034.13450/us" - } + { + "useCompilerFolder": true, + "doNotPublishApps": true, + "artifact": "https://bcartifacts.azureedge.net/sandbox/23.0.12034.13450/us" + } ``` The combination of useCompilerFolder and doNotPublishApps, means that AL-Go will never actually create a container, which saves a great amount of time. From 2331d99f57f81b2c3198a07766f7a379333ba5a7 Mon Sep 17 00:00:00 2001 From: Freddy Kristiansen Date: Tue, 21 Nov 2023 06:19:57 +0100 Subject: [PATCH 166/235] Update ContinuousDelivery.md --- Workshop/ContinuousDelivery.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Workshop/ContinuousDelivery.md b/Workshop/ContinuousDelivery.md index 3e1a9ad75..30d978723 100644 --- a/Workshop/ContinuousDelivery.md +++ b/Workshop/ContinuousDelivery.md @@ -22,7 +22,7 @@ Create an organizational secret called **StorageContext**. The format of the sec or ```json -{"storageAccountName":"accountnanme","sasToken":""?sv=2021-10-04\u0026ss=b\u0026srt=sco...","containerName":"{project}","blobName":"{version}/{project}-{type}.zip"} +{"storageAccountName":"accountnanme","sasToken":"?sv=2021-10-04\u0026ss=b\u0026srt=sco...","containerName":"{project}","blobName":"{version}/{project}-{type}.zip"} ``` ContainerName and BlobName can contain placeholders, like {project}, {version} and {type} which will be replaced by the real values when delivering. From 9aef640f6ed9781066d657058d1eb70faa5153f8 Mon Sep 17 00:00:00 2001 From: Freddy Kristiansen Date: Tue, 21 Nov 2023 06:20:34 +0100 Subject: [PATCH 167/235] Update ContinuousDeployment.md --- Workshop/ContinuousDeployment.md | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/Workshop/ContinuousDeployment.md b/Workshop/ContinuousDeployment.md index c6f7a7bff..6b59d9d5d 100644 --- a/Workshop/ContinuousDeployment.md +++ b/Workshop/ContinuousDeployment.md @@ -17,12 +17,10 @@ After creating the environment and the AUTHCONTEXT secret, you should create a s If your actual Business Central environment has a different name than your GitHub environment, you can add an EnvironmentName property to the DeliverTo settings like: ```json -{ - "DeployToMy-QA": { - "EnvironmentName": "QA", - "ContinuousDeployment": true - } -} + "DeployToMy-QA": { + "EnvironmentName": "QA", + "ContinuousDeployment": true + } ``` At this time, these settings cannot be added as environment variables, we might add this in the future. From 411fe475de212ae332697d22317d45962e84bffb Mon Sep 17 00:00:00 2001 From: Freddy Kristiansen Date: Tue, 21 Nov 2023 06:20:56 +0100 Subject: [PATCH 168/235] Update PublishToProduction.md --- Workshop/PublishToProduction.md | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/Workshop/PublishToProduction.md b/Workshop/PublishToProduction.md index f665e7ac7..cbc84f8c3 100644 --- a/Workshop/PublishToProduction.md +++ b/Workshop/PublishToProduction.md @@ -14,11 +14,9 @@ By default, all environments will be picked up for **continuous deployment**, bu By adding a setting like: ```json -{ - "DeployToPROD": { - "ContinuousDeployment": false - } -} + "DeployToPROD": { + "ContinuousDeployment": false + } ``` The PROD environment is not even included in the CI/CD workflow, and again, setting the ContinuousDeployment to true will enable continuous deployment to the production environment. From a68c460efe25e19a5bfb934090ed98e7bd6d52ad Mon Sep 17 00:00:00 2001 From: Freddy Kristiansen Date: Tue, 21 Nov 2023 06:21:34 +0100 Subject: [PATCH 169/235] Update AutomatedTests.md --- Workshop/AutomatedTests.md | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/Workshop/AutomatedTests.md b/Workshop/AutomatedTests.md index f5e6ae51e..96d480960 100644 --- a/Workshop/AutomatedTests.md +++ b/Workshop/AutomatedTests.md @@ -4,10 +4,8 @@ In order to run automated tests, you need to change a few things in settings. During prerequisites we added two AL-Go settings to the ALGOORGSETTINGS organizational variable: ```json -{ - "useCompilerFolder": true, - "doNotPublishApps": true -} + "useCompilerFolder": true, + "doNotPublishApps": true ``` These settings means that AL-Go will use a CompilerFolder functionality to compile the apps instead of a container and that we will never actually publish the apps (meaning that Test runs are also disabled). @@ -17,10 +15,8 @@ In this step, we will add a test app to the single-project repository and see ho So, navigate single-project repository, locate the .github/AL-Go-Settings.json file and add the following two settings: ```json -{ - "useCompilerFolder": false, - "doNotPublishApps": false -} + "useCompilerFolder": false, + "doNotPublishApps": false ``` | ![image](https://github.com/microsoft/AL-Go/assets/10775043/f94be356-0187-4add-9c3e-f3eaf1423cd8) | From 704d843be0159c95f1c5793387abc59c29a07b86 Mon Sep 17 00:00:00 2001 From: Freddy Kristiansen Date: Tue, 21 Nov 2023 06:22:07 +0100 Subject: [PATCH 170/235] Update ScheduledTestRuns.md --- Workshop/ScheduledTestRuns.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Workshop/ScheduledTestRuns.md b/Workshop/ScheduledTestRuns.md index 603029b53..e4c611245 100644 --- a/Workshop/ScheduledTestRuns.md +++ b/Workshop/ScheduledTestRuns.md @@ -19,9 +19,9 @@ Use **https://crontab.guru** to create a crontab for the schedule you want to ru In your single-project repository, select **Code**, navigate to **.github/AL-Go-Settings.json**, remove the 2 settings (**useCompilerFolder** and **doNotPublishApps** ) we added to run tests and add 3 new settings: ```json -"CurrentSchedule": "0 2 * * *", -"NextMinorSchedule": "0 2 * * 6", -"NextMajorSchedule": "0 2 * * 0" + "CurrentSchedule": "0 2 * * *", + "NextMinorSchedule": "0 2 * * 6", + "NextMajorSchedule": "0 2 * * 0" ``` | ![image](https://github.com/microsoft/AL-Go/assets/10775043/480c759b-c276-439e-9d89-af26ce4780dd) | From aa6b28605276d66ba9003e6a79afc4e0b4002718 Mon Sep 17 00:00:00 2001 From: Freddy Kristiansen Date: Tue, 21 Nov 2023 07:07:16 +0100 Subject: [PATCH 171/235] Update Versioning.md --- Workshop/Versioning.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Workshop/Versioning.md b/Workshop/Versioning.md index 80bebf487..f724b2126 100644 --- a/Workshop/Versioning.md +++ b/Workshop/Versioning.md @@ -44,7 +44,7 @@ Next, let's create another app, by running the **Create a new app** workflow aga | ![image](https://github.com/microsoft/AL-Go/assets/10775043/06d4a03c-f025-44d6-a317-b2a0a79f7e8e) | |-| -When the **Create a new app** workflow is done, click **Actions**, select the **CI/CD** workflow and click **Run workflow** to run the workflow manually. When the workflow is complete, download and inspect the artifacts generated +When the **Create a new app** workflow is done, navigate to Code and modify the name of the object in the **HelloWorld.al** file to **CustomerListExt2**. This will kick off another CI/CD workflow. When the workflow is complete, download and inspect the artifacts generated | ![image](https://github.com/microsoft/AL-Go/assets/10775043/d654b75c-2e63-4bd3-a39a-dce6bf835c30) | |-| From d51ae72a26c8876b3f94ba0f32b3b98608683247 Mon Sep 17 00:00:00 2001 From: Freddy Kristiansen Date: Tue, 21 Nov 2023 08:06:26 +0100 Subject: [PATCH 172/235] Update ReferenceDoc.md --- Workshop/ReferenceDoc.md | 49 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) diff --git a/Workshop/ReferenceDoc.md b/Workshop/ReferenceDoc.md index 5746af9da..6b6d1e04b 100644 --- a/Workshop/ReferenceDoc.md +++ b/Workshop/ReferenceDoc.md @@ -2,7 +2,54 @@ A vital part of your development processes is reference documentation. AL-Go for GitHub supports the ALDoc tool for reference documentation generation, either continuously as part of CI/CD, manually or scheduled. -The ALDoc tool generates content based on the source code. Generating content based on source code has many advantages such as accuracy, 100% reflection of the current codebase, less error prone documentation, and it saves time. The ALDoc tool generates documentation from symbolic and syntactical information, code comments, and overall application structure based on input .app file(s). The tool also generates a help site with these reference articles, sorted by the application structure, based on the provided template. +> [!NOTE] +> The [ALDoc tool](https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/help/help-aldoc-generate-help) generates content based on the source code. Generating content based on source code has many advantages such as accuracy, 100% reflection of the current codebase, less error prone documentation, and it saves time. The ALDoc tool generates documentation from symbolic and syntactical information, code comments, and overall application structure based on input .app file(s). The tool also generates a help site with these reference articles, sorted by the application structure, based on the provided template. + +AL-Go for GitHub supports deploying the reference documentation to GitHub Pages. GitHub Pages is websites for you and your projects, hosted directly from your GitHub repository. It is also possible to deploy the reference documentation to other static HTML hosting providers, but this requires some scripting and is not included here. + +## GitHub Pages + +> [!NOTE} +> GitHub Pages is available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub’s plans](https://docs.github.com/en/get-started/learning-about-github/githubs-plans). + +Navigate to your Common repository, go to **Settings** -> **Pages** and under **Build and deployment** select **GitHub Actions** as the source. + +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/c6dad393-bdb2-4106-9a04-6651347a6005) | +|-| + +Choose Actions, select the **Deploy Reference Documentation** workflow and click **Run workflow** + +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/43535bdd-4f3d-42f2-88cc-db9c501e48c9) | +|-| + +When the workflow is done, click the workflow to open workflow details and you will find a URL to your reference documentation in the deploy step. There is also an artifact called github-pages, which is the artifact deployed to the GitHub pages website. This artifact can be deployed to any other hosting provider if needed. + +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/238e568c-02c9-4c3b-815b-d25b7b30b470) | +|-| + +Clicking the link to your reference documentation reveals the website + +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/b59f5b08-f30f-41ba-a845-571267da741a) | +|-| + +Now, there isn't much documentation in the Common repository as the apps doesn't contain any objects, so let's repeat the above steps with Repo1 (single-project) and MySolution (multi-project) repository. + +In all repositories, click the settings icon in the About section to open repository details, specify a description and check **Use your GitHub Pages website** + +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/d592e77f-a158-4a24-8856-d93c1e69907a) | +|-| + +After this, the link to the reference documentation is available in the upper right corner of your repository landing page. + +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/d39b95a8-c73c-4c7e-8008-7b4f65655e37) | +|-| + +Clicking the link on the multi-project repository, in which we did a release earlier, shows that AL-Go for GitHub includes reference documentation for prior releases as well as the current main repository. + +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/021e7b5d-139b-40bb-8e4c-a93379c60718) | +|-| + +You will see the three projects as "folders" and the apps, which are built in these projects, are listed below. You will also find a **Releases** folder under which earlier versions of the apps from the repository are listed. From c1a6fa147aa120fa48895d291b4eed66ebfdceed Mon Sep 17 00:00:00 2001 From: Freddy Kristiansen Date: Tue, 21 Nov 2023 08:23:00 +0100 Subject: [PATCH 173/235] Update ReferenceDoc.md --- Workshop/ReferenceDoc.md | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/Workshop/ReferenceDoc.md b/Workshop/ReferenceDoc.md index 6b6d1e04b..ad7d3b691 100644 --- a/Workshop/ReferenceDoc.md +++ b/Workshop/ReferenceDoc.md @@ -51,9 +51,41 @@ Clicking the link on the multi-project repository, in which we did a release ear You will see the three projects as "folders" and the apps, which are built in these projects, are listed below. You will also find a **Releases** folder under which earlier versions of the apps from the repository are listed. +## Deploying the reference documentation daily +To allow daily generation of the reference documentation, modify the .github/AL-Go-Settings.json and add a setting like this: +```json + "DeployReferenceDocumentationSchedule": "0 4 * * *" +``` +> [!NOTE] +> This will update the reference documentation every night at 4 + +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/5b3a1c0a-6696-483c-857a-590e39dfa860) | +|-| + +## Deploying the reference documentation continuously + +If you want to setup continuous deployment of the reference documentation, you can add this setting: + +```json + "ALDoc": { + "ContinuousDeployment": true + } +``` + +Adding this to the ALGOORGSETTINGS organizational variable causes all repositories to continuously deploy reference documentation: + +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/898a58ab-f560-4507-9924-c34985d608cb) | +|-| + +But you can also add the setting to a repository settings variable called **ALGOREPOSETTINGS** or to the repository settings file **.github/AL-Go-Settings.json** if you only want to enable this for a single repository. + +Running CI/CD after enabling continuous deployment reveals the **Deploy Reference Docuemntation** job being run and the link to the reference documentation is available in the job. + +| | +|-| Maybe it is about time to actually explain how you create a development environment and code your app? From a686dc216077c4cfaf35cfbf8f2d97998bce9d88 Mon Sep 17 00:00:00 2001 From: Freddy Kristiansen Date: Tue, 21 Nov 2023 08:28:55 +0100 Subject: [PATCH 174/235] Update ScheduledTestRuns.md --- Workshop/ScheduledTestRuns.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Workshop/ScheduledTestRuns.md b/Workshop/ScheduledTestRuns.md index e4c611245..89cd894bc 100644 --- a/Workshop/ScheduledTestRuns.md +++ b/Workshop/ScheduledTestRuns.md @@ -11,7 +11,7 @@ These workflows can be run manually by simply selecting the workflow and clickin Microsoft recommands running these workflows on a schedule to ensure that your app is ready for upcoming releases at all times and at the same time keeping compatibility with the versions you want to support. -Use **https://crontab.guru** to create a crontab for the schedule you want to run your workflows on. I have selected the following for some of my apps: +Use **Bing Copilot Chat** and ask it to generate the crontab you want (ex. *Create a crontab which triggers every saturday at 2am*) or use **https://crontab.guru** to create a crontab for the schedule you want to run your workflows on. I have selected the following for some of my apps: - I want to run the **Test Current** workflow every day at 2 in the morning. The crontab for that is: 0 2 * * * - I want to run the **Test Next Minor** workflow every Saturday at 2 in the morning. The crontab for that is: 0 2 * * 6 - I want to run the **Test Next Major** workflow every Sunday at 2 in the morning. The crontab for that is: 0 2 * * 0 From d751e02683ddac3a5fff79e13364c83da4fcb3ea Mon Sep 17 00:00:00 2001 From: Freddy Kristiansen Date: Tue, 21 Nov 2023 08:29:57 +0100 Subject: [PATCH 175/235] Update ReferenceDoc.md --- Workshop/ReferenceDoc.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Workshop/ReferenceDoc.md b/Workshop/ReferenceDoc.md index ad7d3b691..393927968 100644 --- a/Workshop/ReferenceDoc.md +++ b/Workshop/ReferenceDoc.md @@ -84,10 +84,9 @@ But you can also add the setting to a repository settings variable called **ALGO Running CI/CD after enabling continuous deployment reveals the **Deploy Reference Docuemntation** job being run and the link to the reference documentation is available in the job. -| | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/8a89e9b8-95db-4747-8136-fda4fa78350a) | |-| - Maybe it is about time to actually explain how you create a development environment and code your app? --- From f87f35709ae2eaa9dc379ae50f133b50eae3fcf5 Mon Sep 17 00:00:00 2001 From: Freddy Kristiansen Date: Tue, 21 Nov 2023 08:30:28 +0100 Subject: [PATCH 176/235] Update ReferenceDoc.md --- Workshop/ReferenceDoc.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Workshop/ReferenceDoc.md b/Workshop/ReferenceDoc.md index 393927968..d03f3b0f7 100644 --- a/Workshop/ReferenceDoc.md +++ b/Workshop/ReferenceDoc.md @@ -82,7 +82,7 @@ Adding this to the ALGOORGSETTINGS organizational variable causes all repositori But you can also add the setting to a repository settings variable called **ALGOREPOSETTINGS** or to the repository settings file **.github/AL-Go-Settings.json** if you only want to enable this for a single repository. -Running CI/CD after enabling continuous deployment reveals the **Deploy Reference Docuemntation** job being run and the link to the reference documentation is available in the job. +Running CI/CD after enabling continuous deployment reveals the **Deploy Reference Documentation** job being run and the link to the reference documentation is available in the job. | ![image](https://github.com/microsoft/AL-Go/assets/10775043/8a89e9b8-95db-4747-8136-fda4fa78350a) | |-| From 49cf0aa797229ccabd297c09cb7b28f835b7b558 Mon Sep 17 00:00:00 2001 From: Freddy Kristiansen Date: Tue, 21 Nov 2023 08:32:04 +0100 Subject: [PATCH 177/235] Update ReferenceDoc.md --- Workshop/ReferenceDoc.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Workshop/ReferenceDoc.md b/Workshop/ReferenceDoc.md index d03f3b0f7..f98b27f2a 100644 --- a/Workshop/ReferenceDoc.md +++ b/Workshop/ReferenceDoc.md @@ -75,6 +75,9 @@ If you want to setup continuous deployment of the reference documentation, you c } ``` +> [!NOTE] +> There are other settings in the ALDoc settings structure, which controls the generation of the reference documentation. Inspect [https://aka.ms/algosettings#aldoc](https://aka.ms/algosettings#aldoc) to see them all. + Adding this to the ALGOORGSETTINGS organizational variable causes all repositories to continuously deploy reference documentation: | ![image](https://github.com/microsoft/AL-Go/assets/10775043/898a58ab-f560-4507-9924-c34985d608cb) | From 2e9e5cfbf4e0c0c2e36802a4937027ffc321a83f Mon Sep 17 00:00:00 2001 From: Freddy Kristiansen Date: Tue, 21 Nov 2023 14:45:29 +0100 Subject: [PATCH 178/235] Update ReferenceDoc.md --- Workshop/ReferenceDoc.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Workshop/ReferenceDoc.md b/Workshop/ReferenceDoc.md index f98b27f2a..6e52f142c 100644 --- a/Workshop/ReferenceDoc.md +++ b/Workshop/ReferenceDoc.md @@ -9,7 +9,7 @@ AL-Go for GitHub supports deploying the reference documentation to GitHub Pages. ## GitHub Pages -> [!NOTE} +> [!NOTE] > GitHub Pages is available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub’s plans](https://docs.github.com/en/get-started/learning-about-github/githubs-plans). Navigate to your Common repository, go to **Settings** -> **Pages** and under **Build and deployment** select **GitHub Actions** as the source. From ac5b286566d69531ce8eb96d04b5392ff2540431 Mon Sep 17 00:00:00 2001 From: Freddy Kristiansen Date: Wed, 22 Nov 2023 13:50:24 +0100 Subject: [PATCH 179/235] Update Workshop/GetStarted.md Co-authored-by: Maria Zhelezova <43066499+mazhelez@users.noreply.github.com> --- Workshop/GetStarted.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Workshop/GetStarted.md b/Workshop/GetStarted.md index 7cb85ba6d..e89e36fdc 100644 --- a/Workshop/GetStarted.md +++ b/Workshop/GetStarted.md @@ -6,7 +6,8 @@ In a browser, navigate to https://aka.ms/algopte: | ![image](https://github.com/microsoft/AL-Go/assets/10775043/e00a3a4e-0443-4369-9cad-6a4041fd9c58) | |-| -And you shouold see: +And you should see: + | ![image](https://github.com/microsoft/AL-Go/assets/10775043/ba6520ef-2c24-454e-9227-2298a26931e2) | |-| From 9bd07858354804f0e43c1d20074f3bb5bc3e631f Mon Sep 17 00:00:00 2001 From: freddydk Date: Wed, 22 Nov 2023 14:25:30 +0100 Subject: [PATCH 180/235] review --- Actions/AddExistingApp/action.yaml | 4 ++-- Actions/AnalyzeTests/action.yaml | 4 ++-- Actions/BuildALDoc/BuildALDoc.ps1 | 7 ++----- Actions/BuildALDoc/action.yaml | 4 ++-- Actions/CalculateArtifactNames/action.yaml | 2 +- Actions/CheckForUpdates/action.yaml | 4 ++-- Actions/CreateApp/action.yaml | 4 ++-- Actions/CreateDevelopmentEnvironment/action.yaml | 4 ++-- Actions/CreateReleaseNotes/action.yaml | 4 ++-- Actions/Deliver/action.yaml | 4 ++-- Actions/Deploy/action.yaml | 4 ++-- Actions/DetermineArtifactUrl/action.yaml | 2 +- Actions/IncrementVersionNumber/action.yaml | 4 ++-- Actions/PipelineCleanup/action.yaml | 4 ++-- Actions/ReadSecrets/action.yaml | 4 ++-- Actions/ReadSettings/action.yaml | 4 ++-- Actions/RunPipeline/action.yaml | 4 ++-- Actions/VerifyPRChanges/action.yaml | 2 +- Actions/WorkflowInitialize/action.yaml | 4 ++-- Actions/WorkflowPostProcess/action.yaml | 4 ++-- 20 files changed, 37 insertions(+), 40 deletions(-) diff --git a/Actions/AddExistingApp/action.yaml b/Actions/AddExistingApp/action.yaml index 3c7b00526..4ad50e599 100644 --- a/Actions/AddExistingApp/action.yaml +++ b/Actions/AddExistingApp/action.yaml @@ -1,5 +1,5 @@ -name: PowerShell script -author: Freddy Kristiansen +name: Add Existing App +author: Microsoft Corporation permissions: contents: write pull-requests: write diff --git a/Actions/AnalyzeTests/action.yaml b/Actions/AnalyzeTests/action.yaml index dcf5d2213..7e4f21123 100644 --- a/Actions/AnalyzeTests/action.yaml +++ b/Actions/AnalyzeTests/action.yaml @@ -1,5 +1,5 @@ -name: PowerShell script -author: Freddy Kristiansen +name: Analyze Tests +author: Microsoft Corporation inputs: shell: description: Shell in which you want to run the action (powershell or pwsh) diff --git a/Actions/BuildALDoc/BuildALDoc.ps1 b/Actions/BuildALDoc/BuildALDoc.ps1 index abdcc0127..b895d5071 100644 --- a/Actions/BuildALDoc/BuildALDoc.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.ps1 @@ -15,13 +15,10 @@ $excludeProjects = $settings.ALDoc.ExcludeProjects $maxReleases = $settings.ALDoc.MaxReleases $artifactsFolder = Join-Path $ENV:GITHUB_WORKSPACE ".artifacts" $artifactsFolderCreated = $false -if ($artifacts -eq ".artifacts") { - $artifacts = $artifactsFolder -} -else { +if ($artifacts -ne ".artifacts") { $artifactsFolderCreated = $true New-Item $artifactsFolder -ItemType Directory | Out-Null - $allArtifacts = @(GetArtifacts -token $token -api_url $ENV:GITHUB_API_URL -repository $ENV:GITHUB_REPOSITORY -mask "Apps" -projects '*' -Version 'latest' -branch $ENV:GITHUB_REF_NAME) + $allArtifacts = @(GetArtifacts -token $token -api_url $ENV:GITHUB_API_URL -repository $ENV:GITHUB_REPOSITORY -mask "Apps" -projects '*' -Version $artifacts -branch $ENV:GITHUB_REF_NAME) if ($allArtifacts) { $allArtifacts | ForEach-Object { $filename = DownloadArtifact -token $token -artifact $_ -path $artifactsFolder diff --git a/Actions/BuildALDoc/action.yaml b/Actions/BuildALDoc/action.yaml index 16b3624d5..db6899ff7 100644 --- a/Actions/BuildALDoc/action.yaml +++ b/Actions/BuildALDoc/action.yaml @@ -1,5 +1,5 @@ -name: PowerShell script -author: Freddy Kristiansen +name: Build Reference Documentation +author: Microsoft Corporation inputs: shell: description: Shell in which you want to run the action (powershell or pwsh) diff --git a/Actions/CalculateArtifactNames/action.yaml b/Actions/CalculateArtifactNames/action.yaml index 2f17dfc82..143f786c4 100644 --- a/Actions/CalculateArtifactNames/action.yaml +++ b/Actions/CalculateArtifactNames/action.yaml @@ -1,4 +1,4 @@ -name: PowerShell script +name: Calculate Artifact Names author: Microsoft Corporation inputs: shell: diff --git a/Actions/CheckForUpdates/action.yaml b/Actions/CheckForUpdates/action.yaml index 63ae9660c..b899270bc 100644 --- a/Actions/CheckForUpdates/action.yaml +++ b/Actions/CheckForUpdates/action.yaml @@ -1,5 +1,5 @@ -name: PowerShell script -author: Freddy Kristiansen +name: Check For Updates +author: Microsoft Corporation permissions: contents: write pull-requests: write diff --git a/Actions/CreateApp/action.yaml b/Actions/CreateApp/action.yaml index 47c886c6e..265f246ae 100644 --- a/Actions/CreateApp/action.yaml +++ b/Actions/CreateApp/action.yaml @@ -1,5 +1,5 @@ -name: PowerShell script -author: Freddy Kristiansen +name: Create App +author: Microsoft Corporation permissions: contents: write pull-requests: write diff --git a/Actions/CreateDevelopmentEnvironment/action.yaml b/Actions/CreateDevelopmentEnvironment/action.yaml index 613f714f3..be9381872 100644 --- a/Actions/CreateDevelopmentEnvironment/action.yaml +++ b/Actions/CreateDevelopmentEnvironment/action.yaml @@ -1,5 +1,5 @@ -name: PowerShell script -author: Freddy Kristiansen +name: Create Development Environment +author: Microsoft Corporation permissions: contents: write pull-requests: write diff --git a/Actions/CreateReleaseNotes/action.yaml b/Actions/CreateReleaseNotes/action.yaml index 673eea5c9..33f563715 100644 --- a/Actions/CreateReleaseNotes/action.yaml +++ b/Actions/CreateReleaseNotes/action.yaml @@ -1,5 +1,5 @@ -name: PowerShell script -author: Pooya Kharamesh +name: Create Release Notes +author: Microsoft Corporation permissions: contents: write pull-requests: write diff --git a/Actions/Deliver/action.yaml b/Actions/Deliver/action.yaml index 0f2b2be2f..f6328a00e 100644 --- a/Actions/Deliver/action.yaml +++ b/Actions/Deliver/action.yaml @@ -1,5 +1,5 @@ -name: PowerShell script -author: Freddy Kristiansen +name: Deliver +author: Microsoft Corporation inputs: shell: description: Shell in which you want to run the action (powershell or pwsh) diff --git a/Actions/Deploy/action.yaml b/Actions/Deploy/action.yaml index 84ed69a86..b4d4a8cea 100644 --- a/Actions/Deploy/action.yaml +++ b/Actions/Deploy/action.yaml @@ -1,5 +1,5 @@ -name: PowerShell script -author: Freddy Kristiansen +name: Deploy +author: Microsoft Corporation inputs: shell: description: Shell in which you want to run the action (powershell or pwsh) diff --git a/Actions/DetermineArtifactUrl/action.yaml b/Actions/DetermineArtifactUrl/action.yaml index 5e922d783..936181bbe 100644 --- a/Actions/DetermineArtifactUrl/action.yaml +++ b/Actions/DetermineArtifactUrl/action.yaml @@ -1,4 +1,4 @@ -name: Determine ArtifactUrl to use +name: Determine ArtifactUrl author: Microsoft Corporation inputs: shell: diff --git a/Actions/IncrementVersionNumber/action.yaml b/Actions/IncrementVersionNumber/action.yaml index 21d356dc0..c528ac33b 100644 --- a/Actions/IncrementVersionNumber/action.yaml +++ b/Actions/IncrementVersionNumber/action.yaml @@ -1,5 +1,5 @@ -name: PowerShell script -author: Freddy Kristiansen +name: Increment Version Number +author: Microsoft Corporation permissions: contents: write pull-requests: write diff --git a/Actions/PipelineCleanup/action.yaml b/Actions/PipelineCleanup/action.yaml index 49502c26a..fb085fd58 100644 --- a/Actions/PipelineCleanup/action.yaml +++ b/Actions/PipelineCleanup/action.yaml @@ -1,5 +1,5 @@ -name: PowerShell script -author: Freddy Kristiansen +name: Pipeline Cleanup +author: Microsoft Corporation inputs: shell: description: Shell in which you want to run the action (powershell or pwsh) diff --git a/Actions/ReadSecrets/action.yaml b/Actions/ReadSecrets/action.yaml index fd6090aa1..b418d2314 100644 --- a/Actions/ReadSecrets/action.yaml +++ b/Actions/ReadSecrets/action.yaml @@ -1,5 +1,5 @@ -name: PowerShell script -author: Freddy Kristiansen +name: Read Secrets +author: Microsoft Corporation inputs: shell: description: Shell in which you want to run the action (powershell or pwsh) diff --git a/Actions/ReadSettings/action.yaml b/Actions/ReadSettings/action.yaml index 6208c5c98..1f0230912 100644 --- a/Actions/ReadSettings/action.yaml +++ b/Actions/ReadSettings/action.yaml @@ -1,5 +1,5 @@ -name: PowerShell script -author: Freddy Kristiansen +name: Read Settings +author: Microsoft Corporation inputs: shell: description: Shell in which you want to run the action (powershell or pwsh) diff --git a/Actions/RunPipeline/action.yaml b/Actions/RunPipeline/action.yaml index 0369cb949..65448da9c 100644 --- a/Actions/RunPipeline/action.yaml +++ b/Actions/RunPipeline/action.yaml @@ -1,5 +1,5 @@ -name: PowerShell script -author: Freddy Kristiansen +name: Run Pipeline +author: Microsoft Corporation inputs: shell: description: Shell in which you want to run the action (powershell or pwsh) diff --git a/Actions/VerifyPRChanges/action.yaml b/Actions/VerifyPRChanges/action.yaml index d1f552dcb..af1cb8b61 100644 --- a/Actions/VerifyPRChanges/action.yaml +++ b/Actions/VerifyPRChanges/action.yaml @@ -1,4 +1,4 @@ -name: PowerShell script +name: Verify PR Changes author: Microsoft Corporation inputs: shell: diff --git a/Actions/WorkflowInitialize/action.yaml b/Actions/WorkflowInitialize/action.yaml index 739286f9b..d55fa37b9 100644 --- a/Actions/WorkflowInitialize/action.yaml +++ b/Actions/WorkflowInitialize/action.yaml @@ -1,5 +1,5 @@ -name: PowerShell script -author: Pooya Kharamesh +name: Workflow Initialize +author: Microsoft Corporation inputs: shell: description: Shell in which you want to run the action (powershell or pwsh) diff --git a/Actions/WorkflowPostProcess/action.yaml b/Actions/WorkflowPostProcess/action.yaml index b26e8411f..d1a30a3b4 100644 --- a/Actions/WorkflowPostProcess/action.yaml +++ b/Actions/WorkflowPostProcess/action.yaml @@ -1,5 +1,5 @@ -name: PowerShell script -author: Pooya Kharamesh +name: Workflow Post Process +author: Microsoft Corporation inputs: shell: description: Shell in which you want to run the action (powershell or pwsh) From 4de026e8c20c27d967242d3d7875da6b2f46671a Mon Sep 17 00:00:00 2001 From: freddydk Date: Wed, 22 Nov 2023 14:32:09 +0100 Subject: [PATCH 181/235] review --- Templates/AppSource App/.github/workflows/CICD.yaml | 2 +- Templates/Per Tenant Extension/.github/workflows/CICD.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Templates/AppSource App/.github/workflows/CICD.yaml b/Templates/AppSource App/.github/workflows/CICD.yaml index a64d4d762..5b5883147 100644 --- a/Templates/AppSource App/.github/workflows/CICD.yaml +++ b/Templates/AppSource App/.github/workflows/CICD.yaml @@ -148,7 +148,7 @@ jobs: buildMode: ${{ matrix.buildMode }} projectDependenciesJson: ${{ needs.Initialization.outputs.projectDependenciesJson }} secrets: 'licenseFileUrl,codeSignCertificateUrl,*codeSignCertificatePassword,keyVaultCertificateUrl,*keyVaultCertificatePassword,keyVaultClientId,gitHubPackagesContext,applicationInsightsConnectionString' - publishThisBuildArtifacts: true + publishThisBuildArtifacts: ${{ needs.Initialization.outputs.workflowDepth > 1 }} publishArtifacts: ${{ github.ref_name == 'main' || startswith(github.ref_name, 'release/') || needs.Initialization.outputs.deliveryTargetsJson != '[]' || needs.Initialization.outputs.environmentCount > 0 }} signArtifacts: true useArtifactCache: true diff --git a/Templates/Per Tenant Extension/.github/workflows/CICD.yaml b/Templates/Per Tenant Extension/.github/workflows/CICD.yaml index a64d4d762..5b5883147 100644 --- a/Templates/Per Tenant Extension/.github/workflows/CICD.yaml +++ b/Templates/Per Tenant Extension/.github/workflows/CICD.yaml @@ -148,7 +148,7 @@ jobs: buildMode: ${{ matrix.buildMode }} projectDependenciesJson: ${{ needs.Initialization.outputs.projectDependenciesJson }} secrets: 'licenseFileUrl,codeSignCertificateUrl,*codeSignCertificatePassword,keyVaultCertificateUrl,*keyVaultCertificatePassword,keyVaultClientId,gitHubPackagesContext,applicationInsightsConnectionString' - publishThisBuildArtifacts: true + publishThisBuildArtifacts: ${{ needs.Initialization.outputs.workflowDepth > 1 }} publishArtifacts: ${{ github.ref_name == 'main' || startswith(github.ref_name, 'release/') || needs.Initialization.outputs.deliveryTargetsJson != '[]' || needs.Initialization.outputs.environmentCount > 0 }} signArtifacts: true useArtifactCache: true From b1e1984d1ee1dfd7f5b38c485175529bcc3257bb Mon Sep 17 00:00:00 2001 From: freddydk Date: Wed, 22 Nov 2023 14:35:24 +0100 Subject: [PATCH 182/235] review --- Scenarios/settings.md | 1 + 1 file changed, 1 insertion(+) diff --git a/Scenarios/settings.md b/Scenarios/settings.md index f000cdb27..2a9bed5c6 100644 --- a/Scenarios/settings.md +++ b/Scenarios/settings.md @@ -51,6 +51,7 @@ The repository settings are only read from the repository settings file (.github | nextMajorSchedule | CRON schedule for when NextMajor workflow should run. Default is no scheduled run, only manual trigger. Build your CRON string here: [https://crontab.guru](https://crontab.guru) | | nextMinorSchedule | CRON schedule for when NextMinor workflow should run. Default is no scheduled run, only manual trigger. Build your CRON string here: [https://crontab.guru](https://crontab.guru) | | currentSchedule | CRON schedule for when Current workflow should run. Default is no scheduled run, only manual trigger. Build your CRON string here: [https://crontab.guru](https://crontab.guru) | +| currentSchedule | CRON schedule for when the Deploy Reference Documentation workflow should run. Default is no scheduled run, only manual trigger. Build your CRON string here: [https://crontab.guru](https://crontab.guru) | | runs-on | Specifies which github runner will be used for all non-build/test jobs in all workflows (except the Update AL-Go System Files workflow). The default is to use the GitHub hosted runner _windows-latest_. You can specify a special GitHub Runner for the build job using the GitHubRunner setting. Read [this](SelfHostedGitHubRunner.md) for more information.
Setting runs-on to _ubuntu-latest_ will run all non-build/test jobs on Linux, build jobs will still run _windows-latest_ (or whatever you have set in **githubRunner**) | | shell | Specifies which shell will be used as the default in all jobs. **powershell** is the default, which results in using _PowerShell 5.1_ (unless you selected _ubuntu-latest_, then **pwsh** is used, which results in using _PowerShell 7_) | | githubRunner | Specifies which github runner will be used for the build/test jobs in workflows including a build job. This is the most time consuming task. By default this job uses the _Windows-latest_ github runner (unless overridden by the runs-on setting). This settings takes precedence over runs-on so that you can use different runners for the build job and the housekeeping jobs. See **runs-on** setting. | From bc4bcbc24731d055a851baa1eb7d8258abbaaa4d Mon Sep 17 00:00:00 2001 From: freddydk Date: Wed, 22 Nov 2023 14:47:10 +0100 Subject: [PATCH 183/235] review --- .../BuildALDoc/BuildALDoc.HelperFunctions.ps1 | 30 ++----------------- 1 file changed, 2 insertions(+), 28 deletions(-) diff --git a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 index 6ea9e42fd..60c81f806 100644 --- a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 @@ -1,28 +1,4 @@ -function RunningOnLinux { - $isPsCore = $PSVersionTable.PSVersion -ge "6.0.0" - return ($isPsCore -and $isLinux) -} - -function FixBackslashes { - Param( - [string] $docfxPath - ) - - if (-not (RunningOnLinux)) { - return - } - $allFiles = @(get-childitem -path "$docfxPath/*" -Recurse -File | ForEach-Object { $_.FullName }) - $allFiles | Where-Object { $_.Contains('\') } | ForEach-Object { - $newName = $_.Replace('\','/') - $folder = Split-Path -Path $newName -Parent - if (-not (Test-Path $folder -PathType Container)) { - New-Item -Path $folder -ItemType Directory | Out-Null - } - & cp $_ $newName - & rm $_ - } -} -function DownloadAlDoc { +function DownloadAlDoc { if ("$ENV:aldocPath" -eq "") { Write-Host "Locating aldoc" $artifactUrl = Get-BCArtifactUrl -storageAccount bcinsider -type sandbox -country core -select Latest -accept_insiderEula @@ -35,7 +11,7 @@ function DownloadAlDoc { Write-Host "Extracting aldoc" Expand-Archive -Path "$($tempFolder).zip" -DestinationPath $tempFolder -Force Remove-Item -Path "$($tempFolder).zip" -Force - if (RunningOnLinux) { + if ($IsLinux) { $ENV:aldocPath = Join-Path $tempFolder 'extension/bin/linux/aldoc' & /usr/bin/env sudo pwsh -command "& chmod +x $ENV:aldocPath" } @@ -154,7 +130,6 @@ function GenerateDocsSite { $arguments = @("init","--output ""$docfxpath""","--loglevel $loglevel","--targetpackages ""$($apps -join '","')""") Write-Host "invoke aldoc $arguments" CmdDo -command $aldocPath -arguments $arguments - FixBackslashes -docfxPath $docfxPath # Update docfx.json Write-Host "Update docfx.json" @@ -183,7 +158,6 @@ function GenerateDocsSite { $arguments = @("build","--output ""$docfxpath""","--loglevel $loglevel","--source ""$_""") Write-Host "invoke aldoc $arguments" CmdDo -command $aldocPath -arguments $arguments - FixBackslashes -docfxPath $docfxPath } # Set release notes From b1f16a3ab121e37394dfdbc8a27ec91c95f6568b Mon Sep 17 00:00:00 2001 From: freddydk Date: Wed, 22 Nov 2023 16:00:05 +0100 Subject: [PATCH 184/235] review --- .../BuildALDoc/BuildALDoc.HelperFunctions.ps1 | 58 +++++++++++++++---- .../AppSource App/.github/workflows/CICD.yaml | 9 ++- .../.github/workflows/CICD.yaml | 9 ++- 3 files changed, 58 insertions(+), 18 deletions(-) diff --git a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 index 60c81f806..da81de12f 100644 --- a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 @@ -20,7 +20,7 @@ } Write-Host "Installing/Updating docfx" - CmdDo -command dotnet -arguments @('tool','update','-g docfx') + CmdDo -command dotnet -arguments @("tool","update","-g docfx") } $ENV:aldocPath } @@ -99,11 +99,21 @@ function GenerateDocsSite { if ($version) { $prefix = "../../" } - $newTocYml = @('items:') + $newTocYml = @( + "items:" + ) if ($allVersions.Count -gt 0) { - $newTocYml += @(" - name: Releases"," items:"," - name: main"," href: $($prefix)index.html") + $newTocYml += @( + " - name: Releases" + " items:" + " - name: main" + " href: $($prefix)index.html" + ) foreach($ver in $allVersions) { - $newTocYml += @(" - name: $ver"," href: $($prefix)releases/$ver/index.html") + $newTocYml += @( + " - name: $ver" + " href: $($prefix)releases/$ver/index.html" + ) } } $allApps | ConvertTo-Json -Depth 99 | Out-Host @@ -112,22 +122,36 @@ function GenerateDocsSite { foreach($appFile in $allApps."$repoName") { $apps += @($appFile) $appName, $appFolder = GetAppNameAndFolder -appFile $appFile - $newTocYml += @(" - name: $appName"," href: reference/$appFolder/toc.yml") + $newTocYml += @( + " - name: $appName" + " href: reference/$appFolder/toc.yml" + ) } } else { # Multi project repo add all apps foreach($project in $allApps.Keys) { - $newTocYml += @(" - name: $project",' items:') + $newTocYml += @( + " - name: $project" + " items:" + ) foreach($appFile in $allApps."$project") { $apps += @($appFile) $appName, $appFolder = GetAppNameAndFolder -appFile $appFile - $newTocYml += @(" - name: $appName"," href: reference/$appFolder/toc.yml") + $newTocYml += @( + " - name: $appName" + " href: reference/$appFolder/toc.yml" + ) } } } - $arguments = @("init","--output ""$docfxpath""","--loglevel $loglevel","--targetpackages ""$($apps -join '","')""") + $arguments = @( + "init" + "--output ""$docfxpath""" + "--loglevel $loglevel" + "--targetpackages ""$($apps -join '","')""" + ) Write-Host "invoke aldoc $arguments" CmdDo -command $aldocPath -arguments $arguments @@ -155,7 +179,12 @@ function GenerateDocsSite { Get-Content $tocYmlFile | Out-Host $apps | ForEach-Object { - $arguments = @("build","--output ""$docfxpath""","--loglevel $loglevel","--source ""$_""") + $arguments = @( + "build" + "--output ""$docfxpath""" + "--loglevel $loglevel" + "--source ""$_""" + ) Write-Host "invoke aldoc $arguments" CmdDo -command $aldocPath -arguments $arguments } @@ -169,9 +198,14 @@ function GenerateDocsSite { Get-Content $indexMdFile | Out-Host - $arguments = @("build", "--output ""$docsPath""", "--logLevel $loglevel", """$docfxJsonFile""") + $arguments = @( + "build" + "--output ""$docsPath""" + "--logLevel $loglevel" + """$docfxJsonFile""" + ) if ($hostIt) { - $arguments += @('-s') + $arguments += @("-s") Write-Host "Generate and host site" } Write-Host "invoke doxfx $arguments" @@ -189,7 +223,7 @@ function CalculateProjectsAndApps { [string[]] $excludeProjects ) - if ($projects.Count -eq 0) { $projects = @('*') } + if ($projects.Count -eq 0) { $projects = @("*") } $projectList = @($projects | ForEach-Object { $_.Replace('\','_').Replace('/','_') }) $excludeProjectList = @($excludeProjects | ForEach-Object { $_.Replace('\','_').Replace('/','_') }) foreach($mask in 'Apps','Dependencies') { diff --git a/Templates/AppSource App/.github/workflows/CICD.yaml b/Templates/AppSource App/.github/workflows/CICD.yaml index 5b5883147..699e35db9 100644 --- a/Templates/AppSource App/.github/workflows/CICD.yaml +++ b/Templates/AppSource App/.github/workflows/CICD.yaml @@ -14,10 +14,8 @@ defaults: shell: powershell permissions: - contents: write + contents: read actions: read - pages: write - id-token: write env: workflowDepth: 1 @@ -158,6 +156,11 @@ jobs: if: always() && needs.Build.result == 'Success' && needs.Initialization.outputs.generateALDocArtifact == 1 runs-on: windows-latest name: Deploy Reference Documentation + permissions: + contents: write + actions: read + pages: write + id-token: write environment: name: github-pages url: ${{ steps.deployment.outputs.page_url }} diff --git a/Templates/Per Tenant Extension/.github/workflows/CICD.yaml b/Templates/Per Tenant Extension/.github/workflows/CICD.yaml index 5b5883147..699e35db9 100644 --- a/Templates/Per Tenant Extension/.github/workflows/CICD.yaml +++ b/Templates/Per Tenant Extension/.github/workflows/CICD.yaml @@ -14,10 +14,8 @@ defaults: shell: powershell permissions: - contents: write + contents: read actions: read - pages: write - id-token: write env: workflowDepth: 1 @@ -158,6 +156,11 @@ jobs: if: always() && needs.Build.result == 'Success' && needs.Initialization.outputs.generateALDocArtifact == 1 runs-on: windows-latest name: Deploy Reference Documentation + permissions: + contents: write + actions: read + pages: write + id-token: write environment: name: github-pages url: ${{ steps.deployment.outputs.page_url }} From 00840303d6ef5ac615bc5d89b8917512d5739250 Mon Sep 17 00:00:00 2001 From: Freddy Kristiansen Date: Wed, 22 Nov 2023 20:54:32 +0100 Subject: [PATCH 185/235] Update Actions/Github-Helper.psm1 Co-authored-by: Alexander Holstrup <117829001+aholstrup1@users.noreply.github.com> --- Actions/Github-Helper.psm1 | 1 - 1 file changed, 1 deletion(-) diff --git a/Actions/Github-Helper.psm1 b/Actions/Github-Helper.psm1 index 7b3eb7275..53602f203 100644 --- a/Actions/Github-Helper.psm1 +++ b/Actions/Github-Helper.psm1 @@ -598,7 +598,6 @@ function DownloadRelease { [string] $mask = "Apps", [switch] $unpack, $release - ) if ($projects -eq "") { $projects = "*" } From ae29dca19a65b548a523b6f829a1a03dcfb660d3 Mon Sep 17 00:00:00 2001 From: Freddy Kristiansen Date: Wed, 22 Nov 2023 21:07:40 +0100 Subject: [PATCH 186/235] Update Scenarios/settings.md Co-authored-by: Maria Zhelezova <43066499+mazhelez@users.noreply.github.com> --- Scenarios/settings.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Scenarios/settings.md b/Scenarios/settings.md index 2a9bed5c6..ca809656c 100644 --- a/Scenarios/settings.md +++ b/Scenarios/settings.md @@ -51,7 +51,7 @@ The repository settings are only read from the repository settings file (.github | nextMajorSchedule | CRON schedule for when NextMajor workflow should run. Default is no scheduled run, only manual trigger. Build your CRON string here: [https://crontab.guru](https://crontab.guru) | | nextMinorSchedule | CRON schedule for when NextMinor workflow should run. Default is no scheduled run, only manual trigger. Build your CRON string here: [https://crontab.guru](https://crontab.guru) | | currentSchedule | CRON schedule for when Current workflow should run. Default is no scheduled run, only manual trigger. Build your CRON string here: [https://crontab.guru](https://crontab.guru) | -| currentSchedule | CRON schedule for when the Deploy Reference Documentation workflow should run. Default is no scheduled run, only manual trigger. Build your CRON string here: [https://crontab.guru](https://crontab.guru) | +| deployReferenceDocumentationSchedule | CRON schedule for when the Deploy Reference Documentation workflow should run. Default is no scheduled run, only manual trigger. Build your CRON string here: [https://crontab.guru](https://crontab.guru) | | runs-on | Specifies which github runner will be used for all non-build/test jobs in all workflows (except the Update AL-Go System Files workflow). The default is to use the GitHub hosted runner _windows-latest_. You can specify a special GitHub Runner for the build job using the GitHubRunner setting. Read [this](SelfHostedGitHubRunner.md) for more information.
Setting runs-on to _ubuntu-latest_ will run all non-build/test jobs on Linux, build jobs will still run _windows-latest_ (or whatever you have set in **githubRunner**) | | shell | Specifies which shell will be used as the default in all jobs. **powershell** is the default, which results in using _PowerShell 5.1_ (unless you selected _ubuntu-latest_, then **pwsh** is used, which results in using _PowerShell 7_) | | githubRunner | Specifies which github runner will be used for the build/test jobs in workflows including a build job. This is the most time consuming task. By default this job uses the _Windows-latest_ github runner (unless overridden by the runs-on setting). This settings takes precedence over runs-on so that you can use different runners for the build job and the housekeeping jobs. See **runs-on** setting. | From b412f9a3b4be6ad6c685214b9a4451e1f56b2ee3 Mon Sep 17 00:00:00 2001 From: Freddy Kristiansen Date: Wed, 22 Nov 2023 21:45:12 +0100 Subject: [PATCH 187/235] Update Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 Co-authored-by: Maria Zhelezova <43066499+mazhelez@users.noreply.github.com> --- Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 index da81de12f..326212b55 100644 --- a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 @@ -118,7 +118,7 @@ function GenerateDocsSite { } $allApps | ConvertTo-Json -Depth 99 | Out-Host if ($allApps.Keys.Count -eq 1 -and $allApps.Keys[0] -eq $repoName) { - # Single prokect repo + # Single project repo foreach($appFile in $allApps."$repoName") { $apps += @($appFile) $appName, $appFolder = GetAppNameAndFolder -appFile $appFile From ead309b4f178a265cffa9bd9b31b24133b4781a6 Mon Sep 17 00:00:00 2001 From: freddydk Date: Wed, 22 Nov 2023 21:45:37 +0100 Subject: [PATCH 188/235] review --- Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 | 4 ++-- Actions/BuildALDoc/BuildALDoc.ps1 | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 index da81de12f..026fad75d 100644 --- a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 @@ -118,7 +118,7 @@ function GenerateDocsSite { } $allApps | ConvertTo-Json -Depth 99 | Out-Host if ($allApps.Keys.Count -eq 1 -and $allApps.Keys[0] -eq $repoName) { - # Single prokect repo + # Single project repo foreach($appFile in $allApps."$repoName") { $apps += @($appFile) $appName, $appFolder = GetAppNameAndFolder -appFile $appFile @@ -170,7 +170,7 @@ function GenerateDocsSite { Write-Host "Create new toc.yml" $tocYmlFile = Join-Path $docfxpath 'toc.yml' - Write-Host "ORGTOC:" + Write-Host "Original TOC (from aldoc)):" Get-Content $tocYmlFile | Out-Host Set-Content -Path $tocYmlFile -Value ($newTocYml -join "`n") -Encoding utf8 diff --git a/Actions/BuildALDoc/BuildALDoc.ps1 b/Actions/BuildALDoc/BuildALDoc.ps1 index b895d5071..c6d3c34d8 100644 --- a/Actions/BuildALDoc/BuildALDoc.ps1 +++ b/Actions/BuildALDoc/BuildALDoc.ps1 @@ -58,7 +58,7 @@ foreach($release in $releases) { } Write-Host "Version: $($release.Name):" Get-ChildItem -Path $tempFolder -Recurse -File | ForEach-Object { Write-Host "- $($_.FullName.Substring($tempFolder.Length+1))" } - $allApps,$allDependencies = CalculateProjectsAndApps -tempFolder $tempFolder -projects $projects -excludeProjects $excludeProjects -refname $ENV:GITHUB_REF_NAME + $allApps = 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 @@ -85,7 +85,7 @@ foreach($version in $versions) { } Get-ChildItem -Path $artifactsFolder -Depth 1 -File | ForEach-Object { Write-Host "- $($_.FullName.Substring($artifactsFolder.Length))" } -$allApps,$allDependencies = CalculateProjectsAndApps -tempFolder $artifactsFolder -projects $projects -excludeProjects $excludeProjects -refname $ENV:GITHUB_REF_NAME +$allApps = CalculateProjectsAndApps -tempFolder $artifactsFolder -projects $projects -excludeProjects $excludeProjects $releaseNotes = '' if ($latestReleaseTag) { try { From df8cd20abbb4cbfd9c3327502cadcf97457a5668 Mon Sep 17 00:00:00 2001 From: freddydk Date: Thu, 23 Nov 2023 10:37:35 +0100 Subject: [PATCH 189/235] rename action + script --- .../BuildReferenceDocumentation.HelperFunction.ps1} | 0 .../BuildReferenceDocumentation.ps1} | 2 +- Actions/{BuildALDoc => BuildReferenceDocumentation}/README.md | 2 +- .../{BuildALDoc => BuildReferenceDocumentation}/action.yaml | 4 ++-- Templates/AppSource App/.github/workflows/CICD.yaml | 2 +- .../.github/workflows/DeployReferenceDocumentation.yaml | 2 +- Templates/Per Tenant Extension/.github/workflows/CICD.yaml | 2 +- .../.github/workflows/DeployReferenceDocumentation.yaml | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) rename Actions/{BuildALDoc/BuildALDoc.HelperFunctions.ps1 => BuildReferenceDocumentation/BuildReferenceDocumentation.HelperFunction.ps1} (100%) rename Actions/{BuildALDoc/BuildALDoc.ps1 => BuildReferenceDocumentation/BuildReferenceDocumentation.ps1} (97%) rename Actions/{BuildALDoc => BuildReferenceDocumentation}/README.md (94%) rename Actions/{BuildALDoc => BuildReferenceDocumentation}/action.yaml (87%) diff --git a/Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 b/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.HelperFunction.ps1 similarity index 100% rename from Actions/BuildALDoc/BuildALDoc.HelperFunctions.ps1 rename to Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.HelperFunction.ps1 diff --git a/Actions/BuildALDoc/BuildALDoc.ps1 b/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.ps1 similarity index 97% rename from Actions/BuildALDoc/BuildALDoc.ps1 rename to Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.ps1 index c6d3c34d8..ab3980137 100644 --- a/Actions/BuildALDoc/BuildALDoc.ps1 +++ b/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.ps1 @@ -6,7 +6,7 @@ ) . (Join-Path -Path $PSScriptRoot -ChildPath "..\AL-Go-Helper.ps1" -Resolve) -. (Join-Path -Path $PSScriptRoot -ChildPath "BuildALDoc.HelperFunctions.ps1" -Resolve) +. (Join-Path -Path $PSScriptRoot -ChildPath "BuildReferenceDocumentation.HelperFunctions.ps1" -Resolve) DownloadAndImportBcContainerHelper $settings = $env:Settings | ConvertFrom-Json diff --git a/Actions/BuildALDoc/README.md b/Actions/BuildReferenceDocumentation/README.md similarity index 94% rename from Actions/BuildALDoc/README.md rename to Actions/BuildReferenceDocumentation/README.md index 4321d7070..4fc339398 100644 --- a/Actions/BuildALDoc/README.md +++ b/Actions/BuildReferenceDocumentation/README.md @@ -1,4 +1,4 @@ -# BuildALDoc +# BuildReferenceDocumentation Build documentation using [ALDoc](https://go.microsoft.com/fwlink/?linkid=2247728) and [DocFx](https://dotnet.github.io/docfx) ## INPUT diff --git a/Actions/BuildALDoc/action.yaml b/Actions/BuildReferenceDocumentation/action.yaml similarity index 87% rename from Actions/BuildALDoc/action.yaml rename to Actions/BuildReferenceDocumentation/action.yaml index db6899ff7..cd0601296 100644 --- a/Actions/BuildALDoc/action.yaml +++ b/Actions/BuildReferenceDocumentation/action.yaml @@ -17,14 +17,14 @@ runs: steps: - name: run shell: ${{ inputs.shell }} - id: BuildALDoc + id: BuildReferenceDocumentation env: _token: ${{ inputs.token }} _artifacts: ${{ inputs.artifacts }} run: | $errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0 try { - ${{ github.action_path }}/BuildALDoc.ps1 -token $ENV:_token -artifacts $ENV:_artifacts + ${{ github.action_path }}/BuildReferenceDocumentation.ps1 -token $ENV:_token -artifacts $ENV:_artifacts } catch { Write-Host "::ERROR::Unexpected error when running action. Error Message: $($_.Exception.Message.Replace("`r",'').Replace("`n",' ')), StackTrace: $($_.ScriptStackTrace.Replace("`r",'').Replace("`n",' <- '))"; diff --git a/Templates/AppSource App/.github/workflows/CICD.yaml b/Templates/AppSource App/.github/workflows/CICD.yaml index 699e35db9..ad43e3f27 100644 --- a/Templates/AppSource App/.github/workflows/CICD.yaml +++ b/Templates/AppSource App/.github/workflows/CICD.yaml @@ -183,7 +183,7 @@ jobs: uses: actions/configure-pages@v3 - name: Build Reference Documentation - uses: microsoft/AL-Go-Actions/BuildALDoc@main + uses: microsoft/AL-Go-Actions/BuildReferenceDocumentation@main with: shell: powershell artifacts: '.artifacts' diff --git a/Templates/AppSource App/.github/workflows/DeployReferenceDocumentation.yaml b/Templates/AppSource App/.github/workflows/DeployReferenceDocumentation.yaml index 29df5da8b..61dda3328 100644 --- a/Templates/AppSource App/.github/workflows/DeployReferenceDocumentation.yaml +++ b/Templates/AppSource App/.github/workflows/DeployReferenceDocumentation.yaml @@ -55,7 +55,7 @@ jobs: uses: actions/configure-pages@v3 - name: Build Reference Documentation - uses: microsoft/AL-Go-Actions/BuildALDoc@main + uses: microsoft/AL-Go-Actions/BuildReferenceDocumentation@main with: shell: powershell artifacts: 'latest' diff --git a/Templates/Per Tenant Extension/.github/workflows/CICD.yaml b/Templates/Per Tenant Extension/.github/workflows/CICD.yaml index 699e35db9..ad43e3f27 100644 --- a/Templates/Per Tenant Extension/.github/workflows/CICD.yaml +++ b/Templates/Per Tenant Extension/.github/workflows/CICD.yaml @@ -183,7 +183,7 @@ jobs: uses: actions/configure-pages@v3 - name: Build Reference Documentation - uses: microsoft/AL-Go-Actions/BuildALDoc@main + uses: microsoft/AL-Go-Actions/BuildReferenceDocumentation@main with: shell: powershell artifacts: '.artifacts' diff --git a/Templates/Per Tenant Extension/.github/workflows/DeployReferenceDocumentation.yaml b/Templates/Per Tenant Extension/.github/workflows/DeployReferenceDocumentation.yaml index 29df5da8b..61dda3328 100644 --- a/Templates/Per Tenant Extension/.github/workflows/DeployReferenceDocumentation.yaml +++ b/Templates/Per Tenant Extension/.github/workflows/DeployReferenceDocumentation.yaml @@ -55,7 +55,7 @@ jobs: uses: actions/configure-pages@v3 - name: Build Reference Documentation - uses: microsoft/AL-Go-Actions/BuildALDoc@main + uses: microsoft/AL-Go-Actions/BuildReferenceDocumentation@main with: shell: powershell artifacts: 'latest' From 069e1ce514486cc5d88f66aaa053d975280eb75d Mon Sep 17 00:00:00 2001 From: freddydk Date: Thu, 23 Nov 2023 14:50:10 +0100 Subject: [PATCH 190/235] rename --- ...nction.ps1 => BuildReferenceDocumentation.HelperFunctions.ps1} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Actions/BuildReferenceDocumentation/{BuildReferenceDocumentation.HelperFunction.ps1 => BuildReferenceDocumentation.HelperFunctions.ps1} (100%) diff --git a/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.HelperFunction.ps1 b/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.HelperFunctions.ps1 similarity index 100% rename from Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.HelperFunction.ps1 rename to Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.HelperFunctions.ps1 From 47d7c854840000eee5e2d82b5af88aba2fee15b0 Mon Sep 17 00:00:00 2001 From: freddydk Date: Thu, 23 Nov 2023 14:53:42 +0100 Subject: [PATCH 191/235] dep --- .../BuildReferenceDocumentation.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.ps1 b/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.ps1 index ab3980137..f3e417e05 100644 --- a/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.ps1 +++ b/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.ps1 @@ -58,7 +58,7 @@ foreach($release in $releases) { } Write-Host "Version: $($release.Name):" Get-ChildItem -Path $tempFolder -Recurse -File | ForEach-Object { Write-Host "- $($_.FullName.Substring($tempFolder.Length+1))" } - $allApps = CalculateProjectsAndApps -tempFolder $tempFolder -projects $projects -excludeProjects $excludeProjects + $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 @@ -85,7 +85,7 @@ foreach($version in $versions) { } Get-ChildItem -Path $artifactsFolder -Depth 1 -File | ForEach-Object { Write-Host "- $($_.FullName.Substring($artifactsFolder.Length))" } -$allApps = CalculateProjectsAndApps -tempFolder $artifactsFolder -projects $projects -excludeProjects $excludeProjects +$allApps, $allDependencies = CalculateProjectsAndApps -tempFolder $artifactsFolder -projects $projects -excludeProjects $excludeProjects $releaseNotes = '' if ($latestReleaseTag) { try { From 4d3e913d993c1f86f607f822d1d92adcff0b64a6 Mon Sep 17 00:00:00 2001 From: freddydk Date: Thu, 23 Nov 2023 15:34:37 +0100 Subject: [PATCH 192/235] check project --- .../BuildReferenceDocumentation.HelperFunctions.ps1 | 4 ++++ Actions/Github-Helper.psm1 | 8 ++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.HelperFunctions.ps1 b/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.HelperFunctions.ps1 index 026fad75d..e1ef70a9e 100644 --- a/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.HelperFunctions.ps1 +++ b/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.HelperFunctions.ps1 @@ -225,7 +225,11 @@ function CalculateProjectsAndApps { if ($projects.Count -eq 0) { $projects = @("*") } $projectList = @($projects | ForEach-Object { $_.Replace('\','_').Replace('/','_') }) + Write-Host "Include Project Patterns" + $projectList | ForEach-Object { Write-Host "- $_" } $excludeProjectList = @($excludeProjects | ForEach-Object { $_.Replace('\','_').Replace('/','_') }) + Write-Host "Exclude Project Patterns" + $excludeProjectList | ForEach-Object { Write-Host "- $_" } foreach($mask in 'Apps','Dependencies') { $allApps = @{} Get-ChildItem -Path $tempFolder -Directory | ForEach-Object { diff --git a/Actions/Github-Helper.psm1 b/Actions/Github-Helper.psm1 index 53602f203..a6c2afbe3 100644 --- a/Actions/Github-Helper.psm1 +++ b/Actions/Github-Helper.psm1 @@ -738,6 +738,7 @@ function CheckBuildJobsInWorkflowRun { $per_page = 100 $page = 1 + $anySuccessful = $false $allSuccessful = $true while($true) { @@ -751,7 +752,10 @@ function CheckBuildJobsInWorkflowRun { } $buildJobs = @($workflowJobs.jobs | Where-Object { $_.name.StartsWith('Build ') }) - if($buildJobs.conclusion -ne 'success') { + if($buildJobs.conclusion -eq 'success') { + $anySuccessful = $true + } + else { # If there is a build job that is not successful, there is not need to check further $allSuccessful = $false } @@ -764,7 +768,7 @@ function CheckBuildJobsInWorkflowRun { $page += 1 } - return $allSuccessful + return ($allSuccessful -and $anySuccessful) } <# From 2615bb063ff679b254e6127124092785188f82de Mon Sep 17 00:00:00 2001 From: freddydk Date: Thu, 23 Nov 2023 19:58:06 +0100 Subject: [PATCH 193/235] use projectname for artifacts --- Actions/CalculateArtifactNames/CalculateArtifactNames.ps1 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Actions/CalculateArtifactNames/CalculateArtifactNames.ps1 b/Actions/CalculateArtifactNames/CalculateArtifactNames.ps1 index 58b189abc..e0491a58a 100644 --- a/Actions/CalculateArtifactNames/CalculateArtifactNames.ps1 +++ b/Actions/CalculateArtifactNames/CalculateArtifactNames.ps1 @@ -17,6 +17,9 @@ $settings = $env:Settings | ConvertFrom-Json if ($project -eq ".") { $project = $settings.repoName } +elseif ($settings.projectName) { + $project = $settings.projectName +} $branchName = $ENV:GITHUB_HEAD_REF # $ENV:GITHUB_HEAD_REF is specified only for pull requests, so if it is not specified, use GITHUB_REF_NAME From a0765c9d62d9ff7c0f4457c8dd16f4eeda0f7237 Mon Sep 17 00:00:00 2001 From: freddydk Date: Thu, 23 Nov 2023 20:53:35 +0100 Subject: [PATCH 194/235] review --- .../DetermineDeploymentEnvironments.ps1 | 6 +++++- .../.github/workflows/DeployReferenceDocumentation.yaml | 2 +- .../.github/workflows/DeployReferenceDocumentation.yaml | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Actions/DetermineDeploymentEnvironments/DetermineDeploymentEnvironments.ps1 b/Actions/DetermineDeploymentEnvironments/DetermineDeploymentEnvironments.ps1 index b6372eac1..71a956b82 100644 --- a/Actions/DetermineDeploymentEnvironments/DetermineDeploymentEnvironments.ps1 +++ b/Actions/DetermineDeploymentEnvironments/DetermineDeploymentEnvironments.ps1 @@ -67,11 +67,15 @@ Write-Host "GenerateALDocArtifact=$([int]$generateALDocArtifact)" $deployToGitHubPages = $settings.ALDoc.DeployToGitHubPages if ($deployToGitHubPages) { $deployToGitHubPages = IsGitHubPagesAvailable + if (!$deployToGitHubPages) { + Write-Host "::Warning::GitHub Pages is not available in this repository (or GitHub Pages is not set to use GitHub Actions). Go to Settings -> Pages and set Source to GitHub Actions" + } } Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "DeployALDocArtifact=$([int]$deployToGitHubPages)" Write-Host "DeployALDocArtifact=$([int]$deployToGitHubPages)" -if ($getEnvironments -eq '-') { +if ($getEnvironments -eq 'github-pages') { + # if github-pages is specified as environment - only include if GitHub Pages is available exit 0 } diff --git a/Templates/AppSource App/.github/workflows/DeployReferenceDocumentation.yaml b/Templates/AppSource App/.github/workflows/DeployReferenceDocumentation.yaml index 61dda3328..a78c7407c 100644 --- a/Templates/AppSource App/.github/workflows/DeployReferenceDocumentation.yaml +++ b/Templates/AppSource App/.github/workflows/DeployReferenceDocumentation.yaml @@ -47,7 +47,7 @@ jobs: GITHUB_TOKEN: ${{ github.token }} with: shell: powershell - getEnvironments: '-' + getEnvironments: 'github-pages' type: 'Publish' - name: Setup Pages diff --git a/Templates/Per Tenant Extension/.github/workflows/DeployReferenceDocumentation.yaml b/Templates/Per Tenant Extension/.github/workflows/DeployReferenceDocumentation.yaml index 61dda3328..a78c7407c 100644 --- a/Templates/Per Tenant Extension/.github/workflows/DeployReferenceDocumentation.yaml +++ b/Templates/Per Tenant Extension/.github/workflows/DeployReferenceDocumentation.yaml @@ -47,7 +47,7 @@ jobs: GITHUB_TOKEN: ${{ github.token }} with: shell: powershell - getEnvironments: '-' + getEnvironments: 'github-pages' type: 'Publish' - name: Setup Pages From 80f4f5bec12302c4a19dded23e159a865a373eb1 Mon Sep 17 00:00:00 2001 From: freddydk Date: Thu, 23 Nov 2023 21:47:24 +0100 Subject: [PATCH 195/235] review --- .../BuildReferenceDocumentation.HelperFunctions.ps1 | 6 +++++- Templates/AppSource App/.github/workflows/CICD.yaml | 2 +- Templates/Per Tenant Extension/.github/workflows/CICD.yaml | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.HelperFunctions.ps1 b/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.HelperFunctions.ps1 index e1ef70a9e..1ebfc9a09 100644 --- a/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.HelperFunctions.ps1 +++ b/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.HelperFunctions.ps1 @@ -42,6 +42,10 @@ function GetAppNameAndFolder { Remove-Item -Path $tmpFolder -Recurse -Force } +# +# Generate Reference documentation for a branch or a release. +# All Apps to use for the ref. doc. are downloaded from the release or latest build of the branch. +# function GenerateDocsSite { Param( [string] $version, @@ -97,6 +101,7 @@ function GenerateDocsSite { # Generate new toc.yml and calculate apps - releases and projects $prefix = '' if ($version) { + # If $version is set, then we are generating reference documentation for a release $prefix = "../../" } $newTocYml = @( @@ -197,7 +202,6 @@ function GenerateDocsSite { Write-Host "index.md:" Get-Content $indexMdFile | Out-Host - $arguments = @( "build" "--output ""$docsPath""" diff --git a/Templates/AppSource App/.github/workflows/CICD.yaml b/Templates/AppSource App/.github/workflows/CICD.yaml index ad43e3f27..ac6659979 100644 --- a/Templates/AppSource App/.github/workflows/CICD.yaml +++ b/Templates/AppSource App/.github/workflows/CICD.yaml @@ -153,7 +153,7 @@ jobs: DeployALDoc: needs: [ Initialization, Build ] - if: always() && needs.Build.result == 'Success' && needs.Initialization.outputs.generateALDocArtifact == 1 + if: always() && needs.Build.result == 'Success' && needs.Initialization.outputs.generateALDocArtifact == 1 && github.ref_name == 'main' runs-on: windows-latest name: Deploy Reference Documentation permissions: diff --git a/Templates/Per Tenant Extension/.github/workflows/CICD.yaml b/Templates/Per Tenant Extension/.github/workflows/CICD.yaml index ad43e3f27..ac6659979 100644 --- a/Templates/Per Tenant Extension/.github/workflows/CICD.yaml +++ b/Templates/Per Tenant Extension/.github/workflows/CICD.yaml @@ -153,7 +153,7 @@ jobs: DeployALDoc: needs: [ Initialization, Build ] - if: always() && needs.Build.result == 'Success' && needs.Initialization.outputs.generateALDocArtifact == 1 + if: always() && needs.Build.result == 'Success' && needs.Initialization.outputs.generateALDocArtifact == 1 && github.ref_name == 'main' runs-on: windows-latest name: Deploy Reference Documentation permissions: From b7b009abd63a2342f4256cfa9c9d0df36cbbfe31 Mon Sep 17 00:00:00 2001 From: freddydk Date: Fri, 24 Nov 2023 06:34:58 +0100 Subject: [PATCH 196/235] review --- Actions/CalculateArtifactNames/CalculateArtifactNames.ps1 | 3 --- 1 file changed, 3 deletions(-) diff --git a/Actions/CalculateArtifactNames/CalculateArtifactNames.ps1 b/Actions/CalculateArtifactNames/CalculateArtifactNames.ps1 index e0491a58a..58b189abc 100644 --- a/Actions/CalculateArtifactNames/CalculateArtifactNames.ps1 +++ b/Actions/CalculateArtifactNames/CalculateArtifactNames.ps1 @@ -17,9 +17,6 @@ $settings = $env:Settings | ConvertFrom-Json if ($project -eq ".") { $project = $settings.repoName } -elseif ($settings.projectName) { - $project = $settings.projectName -} $branchName = $ENV:GITHUB_HEAD_REF # $ENV:GITHUB_HEAD_REF is specified only for pull requests, so if it is not specified, use GITHUB_REF_NAME From 6d9ee6dcc3d24fa313dc3fea90ceae9d7fe1d058 Mon Sep 17 00:00:00 2001 From: freddydk Date: Fri, 24 Nov 2023 23:22:46 +0100 Subject: [PATCH 197/235] 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" ] | From b8accd3dc4e1c006b9278cf37d1d67c5c76d2a14 Mon Sep 17 00:00:00 2001 From: freddydk Date: Sat, 25 Nov 2023 00:08:34 +0100 Subject: [PATCH 198/235] dumps --- .../BuildReferenceDocumentation.HelperFunctions.ps1 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.HelperFunctions.ps1 b/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.HelperFunctions.ps1 index fb9337ec0..e18984a42 100644 --- a/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.HelperFunctions.ps1 +++ b/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.HelperFunctions.ps1 @@ -236,8 +236,10 @@ function CalculateProjectsAndApps { Get-ChildItem -Path $tempFolder -Directory | ForEach-Object { if ($_.Name -match "^(.*)-main-$mask-(\d*\.\d*\.\d*\.\d*)$") { $project = $Matches[1] + Write-Host "Project: $project" if ($projectList | Where-Object { $project -like $_ }) { if (-not ($excludeProjectList | Where-Object { $project -like $_ })) { + Write-Host "inlude" $allApps."$project" = @() Get-ChildItem -Path $_.FullName -Filter '*.app' | ForEach-Object { $allApps."$project" += @($_.FullName) From 60abdc8fd1ca5684598c534e2c2404c103c3113b Mon Sep 17 00:00:00 2001 From: freddydk Date: Sat, 25 Nov 2023 06:48:25 +0100 Subject: [PATCH 199/235] sort apps --- ...ReferenceDocumentation.HelperFunctions.ps1 | 20 ++++++++++++++----- .../BuildReferenceDocumentation.ps1 | 4 ++-- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.HelperFunctions.ps1 b/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.HelperFunctions.ps1 index e18984a42..dca3eab84 100644 --- a/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.HelperFunctions.ps1 +++ b/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.HelperFunctions.ps1 @@ -127,7 +127,8 @@ function GenerateDocsSite { # Single project repo - do not use project names as folders $useProjectsAsFolders = $false } - foreach($project in $allApps.Keys) { + $projects = @($allApps.Keys.GetEnumerator() | Sort-Object) + foreach($project in $projects) { if ($useProjectsAsFolders) { $newTocYml += @( " - name: $project" @@ -138,12 +139,18 @@ function GenerateDocsSite { else { $indent = " " } + $theseApps = @{} + # Get all apps for this project foreach($appFile in $allApps."$project") { $apps += @($appFile) $appName, $appFolder = GetAppNameAndFolder -appFile $appFile + $theseApps."$appName" = $appFolder + } + # Add all apps sorted by name + $theseApps.Keys.GetEnumerator() | Sort-Object | ForEach-Object { $newTocYml += @( - "$($indent)- name: $appName" - "$($indent) href: reference/$appFolder/toc.yml" + "$($indent)- name: $($_.key)" + "$($indent) href: reference/$($_.value)/toc.yml" ) } } @@ -221,7 +228,8 @@ function CalculateProjectsAndApps { Param( [string] $tempFolder, [string[]] $projects, - [string[]] $excludeProjects + [string[]] $excludeProjects, + [switch] $useProjectsAsFolders ) if ($projects.Count -eq 0) { $projects = @("*") } @@ -239,7 +247,9 @@ function CalculateProjectsAndApps { Write-Host "Project: $project" if ($projectList | Where-Object { $project -like $_ }) { if (-not ($excludeProjectList | Where-Object { $project -like $_ })) { - Write-Host "inlude" + if (-not $useProjectsAsFolders) { + $project = 'dummy' + } $allApps."$project" = @() Get-ChildItem -Path $_.FullName -Filter '*.app' | ForEach-Object { $allApps."$project" += @($_.FullName) diff --git a/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.ps1 b/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.ps1 index 834859106..59c8d8edd 100644 --- a/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.ps1 +++ b/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.ps1 @@ -58,7 +58,7 @@ foreach($release in $releases) { } Write-Host "Version: $($release.Name):" Get-ChildItem -Path $tempFolder -Recurse -File | ForEach-Object { Write-Host "- $($_.FullName.Substring($tempFolder.Length+1))" } - $allApps, $allDependencies = CalculateProjectsAndApps -tempFolder $tempFolder -projects $projects -excludeProjects $excludeProjects + $allApps, $allDependencies = CalculateProjectsAndApps -tempFolder $tempFolder -projects $projects -excludeProjects $excludeProjects -useProjectsAsFolders:$settings.ALDoc.useProjectsAsFolders $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 -useProjectsAsFolders:$settings.ALDoc.useProjectsAsFolders @@ -85,7 +85,7 @@ foreach($version in $versions) { } Get-ChildItem -Path $artifactsFolder -Depth 1 -File | ForEach-Object { Write-Host "- $($_.FullName.Substring($artifactsFolder.Length))" } -$allApps, $allDependencies = CalculateProjectsAndApps -tempFolder $artifactsFolder -projects $projects -excludeProjects $excludeProjects +$allApps, $allDependencies = CalculateProjectsAndApps -tempFolder $artifactsFolder -projects $projects -excludeProjects $excludeProjects -useProjectsAsFolders:$settings.ALDoc.useProjectsAsFolders $releaseNotes = '' if ($latestReleaseTag) { try { From 07179de14246c1526da1e93a24513ffd23cff7f4 Mon Sep 17 00:00:00 2001 From: freddydk Date: Sat, 25 Nov 2023 06:53:45 +0100 Subject: [PATCH 200/235] use key --- .../BuildReferenceDocumentation.HelperFunctions.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.HelperFunctions.ps1 b/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.HelperFunctions.ps1 index dca3eab84..59f666be8 100644 --- a/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.HelperFunctions.ps1 +++ b/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.HelperFunctions.ps1 @@ -149,8 +149,8 @@ function GenerateDocsSite { # Add all apps sorted by name $theseApps.Keys.GetEnumerator() | Sort-Object | ForEach-Object { $newTocYml += @( - "$($indent)- name: $($_.key)" - "$($indent) href: reference/$($_.value)/toc.yml" + "$($indent)- name: $($_)" + "$($indent) href: reference/$($theseApps."$_")/toc.yml" ) } } From 6c2b81d2f4737946472f1cf647e783f7ac0e02bb Mon Sep 17 00:00:00 2001 From: freddydk Date: Sat, 25 Nov 2023 06:58:47 +0100 Subject: [PATCH 201/235] do not clear --- .../BuildReferenceDocumentation.HelperFunctions.ps1 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.HelperFunctions.ps1 b/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.HelperFunctions.ps1 index 59f666be8..5cad04e5b 100644 --- a/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.HelperFunctions.ps1 +++ b/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.HelperFunctions.ps1 @@ -247,10 +247,12 @@ function CalculateProjectsAndApps { Write-Host "Project: $project" if ($projectList | Where-Object { $project -like $_ }) { if (-not ($excludeProjectList | Where-Object { $project -like $_ })) { - if (-not $useProjectsAsFolders) { + if ($useProjectsAsFolders) { $project = 'dummy' } - $allApps."$project" = @() + if (-not $allApps.ContainsKey("$project")) { + $allApps."$project" = @() + } Get-ChildItem -Path $_.FullName -Filter '*.app' | ForEach-Object { $allApps."$project" += @($_.FullName) } From c6a57adc2701a2a925228140c2b0a216570c2597 Mon Sep 17 00:00:00 2001 From: freddydk Date: Sat, 25 Nov 2023 06:59:30 +0100 Subject: [PATCH 202/235] not --- .../BuildReferenceDocumentation.HelperFunctions.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.HelperFunctions.ps1 b/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.HelperFunctions.ps1 index 5cad04e5b..3e2476a56 100644 --- a/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.HelperFunctions.ps1 +++ b/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.HelperFunctions.ps1 @@ -247,7 +247,7 @@ function CalculateProjectsAndApps { Write-Host "Project: $project" if ($projectList | Where-Object { $project -like $_ }) { if (-not ($excludeProjectList | Where-Object { $project -like $_ })) { - if ($useProjectsAsFolders) { + if (-not $useProjectsAsFolders) { $project = 'dummy' } if (-not $allApps.ContainsKey("$project")) { From 36b9aebf47bae86c790ff239b5a9995675f36426 Mon Sep 17 00:00:00 2001 From: freddydk Date: Sat, 25 Nov 2023 07:06:49 +0100 Subject: [PATCH 203/235] add repo to footer --- Actions/AL-Go-Helper.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Actions/AL-Go-Helper.ps1 b/Actions/AL-Go-Helper.ps1 index dc0ce03bb..da86a6a21 100644 --- a/Actions/AL-Go-Helper.ps1 +++ b/Actions/AL-Go-Helper.ps1 @@ -630,7 +630,7 @@ function ReadSettings { "Projects" = @() "ExcludeProjects" = @() "Header" = "Documentation for {REPOSITORY} {VERSION}" - "Footer" = "Made with AL-Go for GitHub, ALDoc and DocFx" + "Footer" = "Documentation for [{REPOSITORY}](https://github.com/{REPOSITORY}) made with AL-Go for GitHub, ALDoc and DocFx" "DefaultIndexMD" = "## Reference documentation\n\nThis is the generated reference documentation for [{REPOSITORY}](https://github.com/{REPOSITORY}).\n\nYou can use the navigation bar at the top and the table of contents to the left to navigate your documentation.\n\nYou can change this content by creating/editing the **{INDEXTEMPLATERELATIVEPATH}** file in your repository or use the ALDoc:DefaultIndexMD setting in your repository settings file (.github/AL-Go-Settings.json)\n\n{RELEASENOTES}" "DefaultReleaseMD" = "## Release reference documentation\n\nThis is the generated reference documentation for [{REPOSITORY}](https://github.com/{REPOSITORY}).\n\nYou can use the navigation bar at the top and the table of contents to the left to navigate your documentation.\n\nYou can change this content by creating/editing the **{INDEXTEMPLATERELATIVEPATH}** file in your repository or use the ALDoc:DefaultReleaseMD setting in your repository settings file (.github/AL-Go-Settings.json)\n\n{RELEASENOTES}" } From b1214e1a5af978d75e02883bc5942dd835e6734f Mon Sep 17 00:00:00 2001 From: freddydk Date: Sat, 25 Nov 2023 07:12:25 +0100 Subject: [PATCH 204/235] footer is html --- Actions/AL-Go-Helper.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Actions/AL-Go-Helper.ps1 b/Actions/AL-Go-Helper.ps1 index da86a6a21..1cbe5abfc 100644 --- a/Actions/AL-Go-Helper.ps1 +++ b/Actions/AL-Go-Helper.ps1 @@ -630,7 +630,7 @@ function ReadSettings { "Projects" = @() "ExcludeProjects" = @() "Header" = "Documentation for {REPOSITORY} {VERSION}" - "Footer" = "Documentation for [{REPOSITORY}](https://github.com/{REPOSITORY}) made with AL-Go for GitHub, ALDoc and DocFx" + "Footer" = "Documentation for {REPOSITORY} made with AL-Go for GitHub, ALDoc and DocFx" "DefaultIndexMD" = "## Reference documentation\n\nThis is the generated reference documentation for [{REPOSITORY}](https://github.com/{REPOSITORY}).\n\nYou can use the navigation bar at the top and the table of contents to the left to navigate your documentation.\n\nYou can change this content by creating/editing the **{INDEXTEMPLATERELATIVEPATH}** file in your repository or use the ALDoc:DefaultIndexMD setting in your repository settings file (.github/AL-Go-Settings.json)\n\n{RELEASENOTES}" "DefaultReleaseMD" = "## Release reference documentation\n\nThis is the generated reference documentation for [{REPOSITORY}](https://github.com/{REPOSITORY}).\n\nYou can use the navigation bar at the top and the table of contents to the left to navigate your documentation.\n\nYou can change this content by creating/editing the **{INDEXTEMPLATERELATIVEPATH}** file in your repository or use the ALDoc:DefaultReleaseMD setting in your repository settings file (.github/AL-Go-Settings.json)\n\n{RELEASENOTES}" } From bfd34e2e4c39eef59f75c0ca1dfe46bc9fd73a38 Mon Sep 17 00:00:00 2001 From: freddydk Date: Sat, 25 Nov 2023 07:54:21 +0100 Subject: [PATCH 205/235] use foreach --- .../BuildReferenceDocumentation.HelperFunctions.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.HelperFunctions.ps1 b/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.HelperFunctions.ps1 index 3e2476a56..0c7d8262c 100644 --- a/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.HelperFunctions.ps1 +++ b/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.HelperFunctions.ps1 @@ -241,8 +241,8 @@ function CalculateProjectsAndApps { $excludeProjectList | ForEach-Object { Write-Host "- $_" } foreach($mask in 'Apps','Dependencies') { $allApps = @{} - Get-ChildItem -Path $tempFolder -Directory | ForEach-Object { - if ($_.Name -match "^(.*)-main-$mask-(\d*\.\d*\.\d*\.\d*)$") { + foreach($ci in (Get-ChildItem -Path $tempFolder -Directory)) { + if ($ci.Name -match "^(.*)-main-$mask-(\d*\.\d*\.\d*\.\d*)$") { $project = $Matches[1] Write-Host "Project: $project" if ($projectList | Where-Object { $project -like $_ }) { From 2ed3c01a73e7d6aa97b90ea01e49f5225d19e1c3 Mon Sep 17 00:00:00 2001 From: freddydk Date: Sat, 25 Nov 2023 07:57:27 +0100 Subject: [PATCH 206/235] ci --- .../BuildReferenceDocumentation.HelperFunctions.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.HelperFunctions.ps1 b/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.HelperFunctions.ps1 index 0c7d8262c..e465d1302 100644 --- a/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.HelperFunctions.ps1 +++ b/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.HelperFunctions.ps1 @@ -253,8 +253,8 @@ function CalculateProjectsAndApps { if (-not $allApps.ContainsKey("$project")) { $allApps."$project" = @() } - Get-ChildItem -Path $_.FullName -Filter '*.app' | ForEach-Object { - $allApps."$project" += @($_.FullName) + Get-ChildItem -Path $ci.FullName -Filter '*.app' | ForEach-Object { + $allApps."$project" += @($ci.FullName) } } } From 23858e667776594efce1dcff8d0504b9de4eb157 Mon Sep 17 00:00:00 2001 From: freddydk Date: Sat, 25 Nov 2023 08:05:21 +0100 Subject: [PATCH 207/235] fix --- .../BuildReferenceDocumentation.HelperFunctions.ps1 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.HelperFunctions.ps1 b/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.HelperFunctions.ps1 index e465d1302..e227b1f33 100644 --- a/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.HelperFunctions.ps1 +++ b/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.HelperFunctions.ps1 @@ -241,8 +241,8 @@ function CalculateProjectsAndApps { $excludeProjectList | ForEach-Object { Write-Host "- $_" } foreach($mask in 'Apps','Dependencies') { $allApps = @{} - foreach($ci in (Get-ChildItem -Path $tempFolder -Directory)) { - if ($ci.Name -match "^(.*)-main-$mask-(\d*\.\d*\.\d*\.\d*)$") { + foreach($folder in (Get-ChildItem -Path $tempFolder -Directory)) { + if ($folder.Name -match "^(.*)-main-$mask-(\d*\.\d*\.\d*\.\d*)$") { $project = $Matches[1] Write-Host "Project: $project" if ($projectList | Where-Object { $project -like $_ }) { @@ -253,8 +253,8 @@ function CalculateProjectsAndApps { if (-not $allApps.ContainsKey("$project")) { $allApps."$project" = @() } - Get-ChildItem -Path $ci.FullName -Filter '*.app' | ForEach-Object { - $allApps."$project" += @($ci.FullName) + Get-ChildItem -Path $folder.FullName -Filter '*.app' | ForEach-Object { + $allApps."$project" += @($_.FullName) } } } From ab71d7572d12d16d1cac52c431970c9b3acd7f05 Mon Sep 17 00:00:00 2001 From: freddydk Date: Sun, 26 Nov 2023 10:39:35 +0100 Subject: [PATCH 208/235] add test --- .../BuildReferenceDocumentation/action.yaml | 1 - ...uildReferenceDocumentation.Action.Test.ps1 | 64 +++++++++++++++++++ 2 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 Tests/BuildReferenceDocumentation.Action.Test.ps1 diff --git a/Actions/BuildReferenceDocumentation/action.yaml b/Actions/BuildReferenceDocumentation/action.yaml index cd0601296..dc7e3504b 100644 --- a/Actions/BuildReferenceDocumentation/action.yaml +++ b/Actions/BuildReferenceDocumentation/action.yaml @@ -17,7 +17,6 @@ runs: steps: - name: run shell: ${{ inputs.shell }} - id: BuildReferenceDocumentation env: _token: ${{ inputs.token }} _artifacts: ${{ inputs.artifacts }} diff --git a/Tests/BuildReferenceDocumentation.Action.Test.ps1 b/Tests/BuildReferenceDocumentation.Action.Test.ps1 new file mode 100644 index 000000000..d5e56711d --- /dev/null +++ b/Tests/BuildReferenceDocumentation.Action.Test.ps1 @@ -0,0 +1,64 @@ +Get-Module TestActionsHelper | Remove-Module -Force +Import-Module (Join-Path $PSScriptRoot 'TestActionsHelper.psm1') + +Describe "BuildReferenceDocumentation Action Tests" { + BeforeAll { + $actionName = "BuildReferenceDocumentation" + $scriptRoot = Join-Path $PSScriptRoot "..\Actions\$actionName" -Resolve + $scriptName = "$actionName.ps1" + [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', 'scriptPath', Justification = 'False positive.')] + $scriptPath = Join-Path $scriptRoot $scriptName + [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', 'actionScript', Justification = 'False positive.')] + $actionScript = GetActionScript -scriptRoot $scriptRoot -scriptName $scriptName + } + + It 'Compile Action' { + Invoke-Expression $actionScript + } + + It 'Test action.yaml matches script' { + $permissions = [ordered]@{ + } + $outputs = [ordered]@{ + } + YamlTest -scriptRoot $scriptRoot -actionName $actionName -actionScript $actionScript -permissions $permissions -outputs $outputs + } + + It 'CalculateProjectsAndApps' { + . (Join-Path $scriptRoot 'BuildReferenceDocumentation.HelperFunctions.ps1') + + Mock Get-ChildItem { + if ($directory) { + return @( + [PSCustomObject]@{ Name = 'P1-main-Apps-1.0.0.0'; FullName = Join-Path $path 'P1-main-Apps-1.0.0.0' } + [PSCustomObject]@{ Name = 'P2-main-Apps-1.0.0.0'; FullName = Join-Path $path 'P2-main-Apps-1.0.0.0' } + [PSCustomObject]@{ Name = 'P3-main-Apps-1.0.0.0'; FullName = Join-Path $path 'P3-main-Apps-1.0.0.0' } + [PSCustomObject]@{ Name = 'P4-main-Apps-1.0.0.0'; FullName = Join-Path $path 'P4-main-Apps-1.0.0.0' } + ) + } + else { + $project = $path.Substring($path.LastIndexOf('\')+1,2) + $noOfApps = [int]$project.substring(1,1) + $apps = @() + for($i=1; $i -le $noOfApps; $i++) { + $apps += [PSCustomObject]@{ FullName = Join-Path $path "$($project)_app$i.app" } + } + return $apps + } + } + + $allApps = CalculateProjectsAndApps -tempFolder 'c:\temp' -projects @('P1','P2') -excludeProjects @('P3') + $allApps.Count | Should -Be 2 + $allApps[0].Keys.Count | Should -be 1 + $allApps[0].ContainsKey('dummy') | Should -be $true + $allApps[0]."dummy".Count | Should -be 3 + + $allApps = CalculateProjectsAndApps -tempFolder 'c:\temp' -projects @('*') -excludeProjects @('P3') -useProjectsAsFolders + $allApps.Count | Should -Be 2 + $allApps[0].Keys.Count | Should -be 3 + $allApps[0].ContainsKey('dummy') | Should -be $false + $allApps[0]."P1".Count | Should -be 1 + $allApps[0]."P2".Count | Should -be 2 + $allApps[0]."P4".Count | Should -be 4 + } +} From d33443eca96fa58e7ad58a2b5899c8842bea0f27 Mon Sep 17 00:00:00 2001 From: freddydk Date: Sun, 26 Nov 2023 22:28:02 +0100 Subject: [PATCH 209/235] test fail --- ...dReferenceDocumentation.HelperFunctions.ps1 | 2 +- ...BuildReferenceDocumentation.Action.Test.ps1 | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.HelperFunctions.ps1 b/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.HelperFunctions.ps1 index e227b1f33..f8062380b 100644 --- a/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.HelperFunctions.ps1 +++ b/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.HelperFunctions.ps1 @@ -241,7 +241,7 @@ function CalculateProjectsAndApps { $excludeProjectList | ForEach-Object { Write-Host "- $_" } foreach($mask in 'Apps','Dependencies') { $allApps = @{} - foreach($folder in (Get-ChildItem -Path $tempFolder -Directory)) { + foreach($folder in (Get-ChildItem -Path $tempFolder -Filter '*' | Where-Object { $_.PSIsContainer })) { if ($folder.Name -match "^(.*)-main-$mask-(\d*\.\d*\.\d*\.\d*)$") { $project = $Matches[1] Write-Host "Project: $project" diff --git a/Tests/BuildReferenceDocumentation.Action.Test.ps1 b/Tests/BuildReferenceDocumentation.Action.Test.ps1 index d5e56711d..e9540232a 100644 --- a/Tests/BuildReferenceDocumentation.Action.Test.ps1 +++ b/Tests/BuildReferenceDocumentation.Action.Test.ps1 @@ -28,15 +28,7 @@ Describe "BuildReferenceDocumentation Action Tests" { . (Join-Path $scriptRoot 'BuildReferenceDocumentation.HelperFunctions.ps1') Mock Get-ChildItem { - if ($directory) { - return @( - [PSCustomObject]@{ Name = 'P1-main-Apps-1.0.0.0'; FullName = Join-Path $path 'P1-main-Apps-1.0.0.0' } - [PSCustomObject]@{ Name = 'P2-main-Apps-1.0.0.0'; FullName = Join-Path $path 'P2-main-Apps-1.0.0.0' } - [PSCustomObject]@{ Name = 'P3-main-Apps-1.0.0.0'; FullName = Join-Path $path 'P3-main-Apps-1.0.0.0' } - [PSCustomObject]@{ Name = 'P4-main-Apps-1.0.0.0'; FullName = Join-Path $path 'P4-main-Apps-1.0.0.0' } - ) - } - else { + if ($filter -eq '*.app') { $project = $path.Substring($path.LastIndexOf('\')+1,2) $noOfApps = [int]$project.substring(1,1) $apps = @() @@ -45,6 +37,14 @@ Describe "BuildReferenceDocumentation Action Tests" { } return $apps } + else { + return @( + [PSCustomObject]@{ Name = 'P1-main-Apps-1.0.0.0'; FullName = Join-Path $path 'P1-main-Apps-1.0.0.0'; "PsIsContainer" = $true } + [PSCustomObject]@{ Name = 'P2-main-Apps-1.0.0.0'; FullName = Join-Path $path 'P2-main-Apps-1.0.0.0'; "PsIsContainer" = $true } + [PSCustomObject]@{ Name = 'P3-main-Apps-1.0.0.0'; FullName = Join-Path $path 'P3-main-Apps-1.0.0.0'; "PsIsContainer" = $true } + [PSCustomObject]@{ Name = 'P4-main-Apps-1.0.0.0'; FullName = Join-Path $path 'P4-main-Apps-1.0.0.0'; "PsIsContainer" = $true } + ) + } } $allApps = CalculateProjectsAndApps -tempFolder 'c:\temp' -projects @('P1','P2') -excludeProjects @('P3') From 83c3c7ca7b47b6d889fa30aeaa7a5c3c3d085a80 Mon Sep 17 00:00:00 2001 From: freddydk Date: Sun, 26 Nov 2023 22:54:18 +0100 Subject: [PATCH 210/235] test failure --- Tests/BuildReferenceDocumentation.Action.Test.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Tests/BuildReferenceDocumentation.Action.Test.ps1 b/Tests/BuildReferenceDocumentation.Action.Test.ps1 index e9540232a..69b934492 100644 --- a/Tests/BuildReferenceDocumentation.Action.Test.ps1 +++ b/Tests/BuildReferenceDocumentation.Action.Test.ps1 @@ -47,13 +47,13 @@ Describe "BuildReferenceDocumentation Action Tests" { } } - $allApps = CalculateProjectsAndApps -tempFolder 'c:\temp' -projects @('P1','P2') -excludeProjects @('P3') + $allApps = CalculateProjectsAndApps -tempFolder (Get-Location).Path -projects @('P1','P2') -excludeProjects @('P3') $allApps.Count | Should -Be 2 $allApps[0].Keys.Count | Should -be 1 $allApps[0].ContainsKey('dummy') | Should -be $true $allApps[0]."dummy".Count | Should -be 3 - $allApps = CalculateProjectsAndApps -tempFolder 'c:\temp' -projects @('*') -excludeProjects @('P3') -useProjectsAsFolders + $allApps = CalculateProjectsAndApps -tempFolder (Get-Location).Path -projects @('*') -excludeProjects @('P3') -useProjectsAsFolders $allApps.Count | Should -Be 2 $allApps[0].Keys.Count | Should -be 3 $allApps[0].ContainsKey('dummy') | Should -be $false From c5d605337a55910ca58f0cddd42b0292251f9d0e Mon Sep 17 00:00:00 2001 From: freddydk Date: Sun, 26 Nov 2023 22:58:26 +0100 Subject: [PATCH 211/235] linux --- Tests/BuildReferenceDocumentation.Action.Test.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/BuildReferenceDocumentation.Action.Test.ps1 b/Tests/BuildReferenceDocumentation.Action.Test.ps1 index 69b934492..76d1e0244 100644 --- a/Tests/BuildReferenceDocumentation.Action.Test.ps1 +++ b/Tests/BuildReferenceDocumentation.Action.Test.ps1 @@ -29,7 +29,7 @@ Describe "BuildReferenceDocumentation Action Tests" { Mock Get-ChildItem { if ($filter -eq '*.app') { - $project = $path.Substring($path.LastIndexOf('\')+1,2) + $project = [System.IO.Path]::GetFileName($path).Substring(0,2) $noOfApps = [int]$project.substring(1,1) $apps = @() for($i=1; $i -le $noOfApps; $i++) { From 346ae3a47562a9c36b4c4da1a4c68ff6000d2ddf Mon Sep 17 00:00:00 2001 From: Freddy Kristiansen Date: Tue, 28 Nov 2023 13:11:00 +0100 Subject: [PATCH 212/235] Update RELEASENOTES.md Co-authored-by: Maria Zhelezova <43066499+mazhelez@users.noreply.github.com> --- RELEASENOTES.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RELEASENOTES.md b/RELEASENOTES.md index ddf1fbd15..385928874 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -20,7 +20,7 @@ If false, the templateSha repository setting is used to download specific AL-Go ### New Settings -- `alDoc` : Structure with properties for the ALDoc reference document generation +- `alDoc` : JSON object with properties for the ALDoc reference document generation - **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) From 5ed2c6511b06fe940107382dbb7ee225fc77e581 Mon Sep 17 00:00:00 2001 From: Freddy Kristiansen Date: Tue, 28 Nov 2023 13:11:10 +0100 Subject: [PATCH 213/235] Update RELEASENOTES.md Co-authored-by: Maria Zhelezova <43066499+mazhelez@users.noreply.github.com> --- RELEASENOTES.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RELEASENOTES.md b/RELEASENOTES.md index 385928874..59b6da845 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -22,7 +22,7 @@ If false, the templateSha repository setting is used to download specific AL-Go - `alDoc` : JSON object with properties for the ALDoc reference document generation - **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) + - **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 Actions. (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) From 19e157bc6d8f05360a941f1b92254d8d088c062c Mon Sep 17 00:00:00 2001 From: freddydk Date: Tue, 28 Nov 2023 13:15:34 +0100 Subject: [PATCH 214/235] review comments --- Actions/AL-Go-Helper.ps1 | 2 +- ...uildReferenceDocumentation.HelperFunctions.ps1 | 15 ++++++++++++--- .../BuildReferenceDocumentation.ps1 | 10 +++++----- Actions/BuildReferenceDocumentation/README.md | 1 + Actions/BuildReferenceDocumentation/action.yaml | 2 +- Actions/Deliver/Deliver.ps1 | 2 +- Actions/Deliver/README.md | 2 +- Actions/Deliver/action.yaml | 2 +- Actions/Deploy/Deploy.ps1 | 2 +- Actions/Deploy/README.md | 2 +- Actions/Deploy/action.yaml | 2 +- RELEASENOTES.md | 2 +- 12 files changed, 27 insertions(+), 17 deletions(-) diff --git a/Actions/AL-Go-Helper.ps1 b/Actions/AL-Go-Helper.ps1 index 945e11216..b170da417 100644 --- a/Actions/AL-Go-Helper.ps1 +++ b/Actions/AL-Go-Helper.ps1 @@ -627,7 +627,7 @@ function ReadSettings { "ContinuousDeployment" = $false "DeployToGitHubPages" = $true "MaxReleases" = 3 - "useProjectsAsFolders" = $true + "UseProjectsAsFolders" = $true "Projects" = @() "ExcludeProjects" = @() "Header" = "Documentation for {REPOSITORY} {VERSION}" diff --git a/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.HelperFunctions.ps1 b/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.HelperFunctions.ps1 index f8062380b..97a829696 100644 --- a/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.HelperFunctions.ps1 +++ b/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.HelperFunctions.ps1 @@ -103,6 +103,9 @@ function GenerateDocsSite { $prefix = '' if ($version) { # If $version is set, then we are generating reference documentation for a release + # all releases will be in a subfolder called releases/$version + # prefix is used to reference links in the root of the site relative to the site we are building now + # We cannot use / as prefix, because that will not work when hosting the site on GitHub pages $prefix = "../../" } $newTocYml = @( @@ -224,6 +227,10 @@ function GenerateDocsSite { } } +# Build a list of all projects (folders) and apps to use when building reference documentation +# return value is a hashtable for all apps and a hashtable for all dependencies +# Every hashtable has project name as key and an array of app files as value +# if useProjectsAsFolders is false, all apps will be collected in one "project" called "dummy", which is never displayed function CalculateProjectsAndApps { Param( [string] $tempFolder, @@ -244,10 +251,12 @@ function CalculateProjectsAndApps { foreach($folder in (Get-ChildItem -Path $tempFolder -Filter '*' | Where-Object { $_.PSIsContainer })) { if ($folder.Name -match "^(.*)-main-$mask-(\d*\.\d*\.\d*\.\d*)$") { $project = $Matches[1] - Write-Host "Project: $project" - if ($projectList | Where-Object { $project -like $_ }) { - if (-not ($excludeProjectList | Where-Object { $project -like $_ })) { + $includeIt = $null -ne ($projectList | Where-Object { $project -like $_ }) + if ($includeIt) { + $excludeIt = $null -ne ($excludeProjectList | Where-Object { $project -like $_ }) + if (-not $excludeIt) { if (-not $useProjectsAsFolders) { + # use project name dummy for all apps when not using projects as folders $project = 'dummy' } if (-not $allApps.ContainsKey("$project")) { diff --git a/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.ps1 b/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.ps1 index 59c8d8edd..6115fd3cf 100644 --- a/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.ps1 +++ b/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.ps1 @@ -1,7 +1,7 @@ Param( [Parameter(HelpMessage = "The GitHub token running the action", Mandatory = $false)] [string] $token, - [Parameter(HelpMessage = "Artifacts to build documentation for", Mandatory = $true)] + [Parameter(HelpMessage = "The artifacts to build documentation for or a folder in which the artifacts have been downloaded", Mandatory = $true)] [string] $artifacts ) @@ -58,10 +58,10 @@ foreach($release in $releases) { } Write-Host "Version: $($release.Name):" Get-ChildItem -Path $tempFolder -Recurse -File | ForEach-Object { Write-Host "- $($_.FullName.Substring($tempFolder.Length+1))" } - $allApps, $allDependencies = CalculateProjectsAndApps -tempFolder $tempFolder -projects $projects -excludeProjects $excludeProjects -useProjectsAsFolders:$settings.ALDoc.useProjectsAsFolders + $allApps, $allDependencies = CalculateProjectsAndApps -tempFolder $tempFolder -projects $projects -excludeProjects $excludeProjects -useProjectsAsFolders:$settings.ALDoc.UseProjectsAsFolders $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 -useProjectsAsFolders:$settings.ALDoc.useProjectsAsFolders + 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 @@ -85,7 +85,7 @@ foreach($version in $versions) { } Get-ChildItem -Path $artifactsFolder -Depth 1 -File | ForEach-Object { Write-Host "- $($_.FullName.Substring($artifactsFolder.Length))" } -$allApps, $allDependencies = CalculateProjectsAndApps -tempFolder $artifactsFolder -projects $projects -excludeProjects $excludeProjects -useProjectsAsFolders:$settings.ALDoc.useProjectsAsFolders +$allApps, $allDependencies = CalculateProjectsAndApps -tempFolder $artifactsFolder -projects $projects -excludeProjects $excludeProjects -useProjectsAsFolders:$settings.ALDoc.UseProjectsAsFolders $releaseNotes = '' if ($latestReleaseTag) { try { @@ -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 -useProjectsAsFolders:$settings.ALDoc.useProjectsAsFolders +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/Actions/BuildReferenceDocumentation/README.md b/Actions/BuildReferenceDocumentation/README.md index 4fc339398..bb6fea67e 100644 --- a/Actions/BuildReferenceDocumentation/README.md +++ b/Actions/BuildReferenceDocumentation/README.md @@ -13,6 +13,7 @@ Build documentation using [ALDoc](https://go.microsoft.com/fwlink/?linkid=224772 | :-- | :-: | :-- | :-- | | shell | | The shell (powershell or pwsh) in which the PowerShell script in this action should run | powershell | | token | | The GitHub token running the action | github.token | +| artifacts | Yes | The artifacts to build documentation for or a folder in which the artifacts have been downloaded | | ## OUTPUT none diff --git a/Actions/BuildReferenceDocumentation/action.yaml b/Actions/BuildReferenceDocumentation/action.yaml index dc7e3504b..0b8434fae 100644 --- a/Actions/BuildReferenceDocumentation/action.yaml +++ b/Actions/BuildReferenceDocumentation/action.yaml @@ -10,7 +10,7 @@ inputs: required: false default: ${{ github.token }} artifacts: - description: Artifacts to build documentation for + description: The artifacts to build documentation for or a folder in which the artifacts have been downloaded required: true runs: using: composite diff --git a/Actions/Deliver/Deliver.ps1 b/Actions/Deliver/Deliver.ps1 index 73d17590f..df19733a0 100644 --- a/Actions/Deliver/Deliver.ps1 +++ b/Actions/Deliver/Deliver.ps1 @@ -9,7 +9,7 @@ [string] $projects = "*", [Parameter(HelpMessage = "Delivery target (AppSource or Storage)", Mandatory = $true)] [string] $deliveryTarget, - [Parameter(HelpMessage = "Artifacts to deliver", Mandatory = $true)] + [Parameter(HelpMessage = "The artifacts to deliver or a folder in which the artifacts have been downloaded", Mandatory = $true)] [string] $artifacts, [Parameter(HelpMessage = "Type of delivery (CD or Release)", Mandatory = $false)] [ValidateSet('CD','Release')] diff --git a/Actions/Deliver/README.md b/Actions/Deliver/README.md index dbd1a003f..f6ae1efca 100644 --- a/Actions/Deliver/README.md +++ b/Actions/Deliver/README.md @@ -18,7 +18,7 @@ Deliver App to deliveryTarget (AppSource, Storage, or...) | parentTelemetryScopeJson | | Specifies the parent telemetry scope for the telemetry signal | {} | | projects | | Comma-separated list of projects to deliver | * | | deliveryTarget | Yes | Delivery target (AppSource, Storage, GitHubPackages,...) | | -| artifacts | Yes | The artifacts to deliver | | +| artifacts | Yes | The artifacts to deliver or a folder in which the artifacts have been downloaded | | | type | | Type of delivery (CD or Release) | CD | | atypes | | Artifact types to deliver | Apps,Dependencies,TestApps | | goLive | | Only relevant for AppSource delivery type. Promote AppSource App to Go Live? | false | diff --git a/Actions/Deliver/action.yaml b/Actions/Deliver/action.yaml index 68e1a2f61..9f33256e3 100644 --- a/Actions/Deliver/action.yaml +++ b/Actions/Deliver/action.yaml @@ -25,7 +25,7 @@ inputs: description: Delivery target (AppSource or Storage) required: true artifacts: - description: Artifacts to deliver + description: The artifacts to deliver or a folder in which the artifacts have been downloaded required: true type: description: Type of delivery (CD or Release) diff --git a/Actions/Deploy/Deploy.ps1 b/Actions/Deploy/Deploy.ps1 index 415883277..ff7ca50a9 100644 --- a/Actions/Deploy/Deploy.ps1 +++ b/Actions/Deploy/Deploy.ps1 @@ -5,7 +5,7 @@ [string] $parentTelemetryScopeJson = '7b7d', [Parameter(HelpMessage = "Name of environment to deploy to", Mandatory = $true)] [string] $environmentName, - [Parameter(HelpMessage = "Artifacts to deploy", Mandatory = $true)] + [Parameter(HelpMessage = "The artifacts to deploy or a folder in which the artifacts have been downloaded", Mandatory = $true)] [string] $artifacts, [Parameter(HelpMessage = "Type of deployment (CD or Publish)", Mandatory = $false)] [ValidateSet('CD','Publish')] diff --git a/Actions/Deploy/README.md b/Actions/Deploy/README.md index 7b4e24317..73850dc85 100644 --- a/Actions/Deploy/README.md +++ b/Actions/Deploy/README.md @@ -18,7 +18,7 @@ Deploy Apps to online environment | parentTelemetryScopeJson | | Specifies the parent telemetry scope for the telemetry signal | {} | | projects | | Comma-separated list of projects to deploy. | | | environmentName | Yes | Name of environment to deploy to | -| artifacts | Yes | Artifacts to deploy | +| artifacts | Yes | The artifacts to deploy or a folder in which the artifacts have been downloaded | | | type | | Type of delivery (CD or Release) | CD | ## OUTPUT diff --git a/Actions/Deploy/action.yaml b/Actions/Deploy/action.yaml index b4d4a8cea..1c198ace5 100644 --- a/Actions/Deploy/action.yaml +++ b/Actions/Deploy/action.yaml @@ -17,7 +17,7 @@ inputs: description: Name of environment to deploy to required: true artifacts: - description: Artifacts to deploy + description: The artifacts to deploy or a folder in which the artifacts have been downloaded required: true type: description: Type of deployment (CD or Publish) diff --git a/RELEASENOTES.md b/RELEASENOTES.md index 59b6da845..f7781af78 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -24,7 +24,7 @@ If false, the templateSha repository setting is used to download specific AL-Go - **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 Actions. (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 + - **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...) From 102139a26cb80d03bd84e9dd9b8aeb74c703b07a Mon Sep 17 00:00:00 2001 From: freddydk Date: Thu, 30 Nov 2023 05:20:38 +0100 Subject: [PATCH 215/235] use private containerhelper for test --- Actions/AL-Go-Helper.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Actions/AL-Go-Helper.ps1 b/Actions/AL-Go-Helper.ps1 index b170da417..89356def2 100644 --- a/Actions/AL-Go-Helper.ps1 +++ b/Actions/AL-Go-Helper.ps1 @@ -18,7 +18,7 @@ $defaultCICDPushBranches = @( 'main', 'release/*', 'feature/*' ) [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', 'defaultCICDPullRequestBranches', Justification = 'False positive.')] $defaultCICDPullRequestBranches = @( 'main' ) $runningLocal = $local.IsPresent -$defaultBcContainerHelperVersion = "preview" # Must be double quotes. Will be replaced by BcContainerHelperVersion if necessary in the deploy step +$defaultBcContainerHelperVersion = "https://github.com/freddydk/navcontainerhelper/archive/refs/heads/renewaccesstoken.zip" # Must be double quotes. Will be replaced by BcContainerHelperVersion if necessary in the deploy step $microsoftTelemetryConnectionString = "InstrumentationKey=84bd9223-67d4-4378-8590-9e4a46023be2;IngestionEndpoint=https://westeurope-1.in.applicationinsights.azure.com/" $runAlPipelineOverrides = @( From 54315e9559d24c529448c2d14a86782591827f78 Mon Sep 17 00:00:00 2001 From: freddydk Date: Fri, 1 Dec 2023 06:00:39 +0100 Subject: [PATCH 216/235] review comments --- ...ReferenceDocumentation.HelperFunctions.ps1 | 136 ++++++++++-------- 1 file changed, 78 insertions(+), 58 deletions(-) diff --git a/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.HelperFunctions.ps1 b/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.HelperFunctions.ps1 index 97a829696..d4cb1cb8d 100644 --- a/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.HelperFunctions.ps1 +++ b/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.HelperFunctions.ps1 @@ -18,7 +18,9 @@ else { $ENV:aldocPath = Join-Path $tempFolder 'extension/bin/win32/aldoc.exe' } - + if (-not (Test-Path $ENV:aldocPath)) { + throw "aldoc tool not found at $ENV:aldocPath" + } Write-Host "Installing/Updating docfx" CmdDo -command dotnet -arguments @("tool","update","-g docfx") } @@ -42,6 +44,74 @@ function GetAppNameAndFolder { Remove-Item -Path $tmpFolder -Recurse -Force } +function GenerateTocYml { + Param( + [string] $version, + [string[]] $allVersions, + [hashtable] $allApps, + [switch] $useProjectsAsFolders + ) + + $prefix = '' + if ($version) { + # If $version is set, then we are generating reference documentation for a release + # all releases will be in a subfolder called releases/$version + # prefix is used to reference links in the root of the site relative to the site we are building now + # We cannot use / as prefix, because that will not work when hosting the site on GitHub pages + $prefix = "../../" + } + $tocYml = @( + "items:" + ) + if ($allVersions.Count -gt 0) { + $tocYml += @( + " - name: Releases" + " items:" + " - name: main" + " href: $($prefix)index.html" + ) + foreach($ver in $allVersions) { + $tocYml += @( + " - name: $ver" + " href: $($prefix)releases/$ver/index.html" + ) + } + } + $allApps | ConvertTo-Json -Depth 99 | Out-Host + if ($allApps.Keys.Count -eq 1 -and $allApps.Keys[0] -eq $repoName) { + # Single project repo - do not use project names as folders + $useProjectsAsFolders = $false + } + $projects = @($allApps.Keys.GetEnumerator() | Sort-Object) + foreach($project in $projects) { + if ($useProjectsAsFolders) { + $tocYml += @( + " - name: $project" + " items:" + ) + $indent = " " + } + else { + $indent = " " + } + $theseApps = @{} + # Get all apps for this project + foreach($appFile in $allApps."$project") { + $appName, $appFolder = GetAppNameAndFolder -appFile $appFile + $theseApps."$appName" = $appFolder + } + # Add all apps sorted by name + $theseApps.Keys.GetEnumerator() | Sort-Object | ForEach-Object { + $tocYml += @( + "$($indent)- name: $($_)" + "$($indent) href: reference/$($theseApps."$_")/toc.yml" + ) + } + } + $tocYml +} + + # # Generate Reference documentation for a branch or a release. # All Apps to use for the ref. doc. are downloaded from the release or latest build of the branch. @@ -98,65 +168,15 @@ function GenerateDocsSite { $docfxPath = Join-Path ([System.IO.Path]::GetTempPath()) ([Guid]::NewGuid().ToString()) New-Item -path $docfxPath -ItemType Directory | Out-Null try { + # Generate new toc.yml with releases and apps + $newTocYml = GenerateTocYml -version $version -allVersions $allVersions -allApps $allApps -repoName $repoName -useProjectsAsFolders $useProjectsAsFolders + + # calculate apps for aldoc $apps = @() - # Generate new toc.yml and calculate apps - releases and projects - $prefix = '' - if ($version) { - # If $version is set, then we are generating reference documentation for a release - # all releases will be in a subfolder called releases/$version - # prefix is used to reference links in the root of the site relative to the site we are building now - # We cannot use / as prefix, because that will not work when hosting the site on GitHub pages - $prefix = "../../" - } - $newTocYml = @( - "items:" - ) - if ($allVersions.Count -gt 0) { - $newTocYml += @( - " - name: Releases" - " items:" - " - name: main" - " href: $($prefix)index.html" - ) - foreach($ver in $allVersions) { - $newTocYml += @( - " - name: $ver" - " href: $($prefix)releases/$ver/index.html" - ) - } - } - $allApps | ConvertTo-Json -Depth 99 | Out-Host - if ($allApps.Keys.Count -eq 1 -and $allApps.Keys[0] -eq $repoName) { - # Single project repo - do not use project names as folders - $useProjectsAsFolders = $false - } - $projects = @($allApps.Keys.GetEnumerator() | Sort-Object) - foreach($project in $projects) { - if ($useProjectsAsFolders) { - $newTocYml += @( - " - name: $project" - " items:" - ) - $indent = " " - } - else { - $indent = " " - } - $theseApps = @{} - # Get all apps for this project - foreach($appFile in $allApps."$project") { - $apps += @($appFile) - $appName, $appFolder = GetAppNameAndFolder -appFile $appFile - $theseApps."$appName" = $appFolder - } - # Add all apps sorted by name - $theseApps.Keys.GetEnumerator() | Sort-Object | ForEach-Object { - $newTocYml += @( - "$($indent)- name: $($_)" - "$($indent) href: reference/$($theseApps."$_")/toc.yml" - ) - } + foreach($value in $allApps.Values) { + $apps += @($value) } + $apps = @($apps | Select-Object -Unique) $arguments = @( "init" From c95cc034f6070226f5942ed9f022513a105d1bc7 Mon Sep 17 00:00:00 2001 From: freddydk Date: Fri, 1 Dec 2023 09:42:32 +0100 Subject: [PATCH 217/235] Review comments + casing --- Actions/AL-Go-Helper.ps1 | 24 +++++++++---------- ...ReferenceDocumentation.HelperFunctions.ps1 | 6 ++--- .../BuildReferenceDocumentation.ps1 | 24 +++++++++---------- .../CheckForUpdates.HelperFunctions.ps1 | 6 ++--- Actions/Deploy/Deploy.ps1 | 2 +- .../DetermineDeploymentEnvironments.ps1 | 8 +++---- RELEASENOTES.md | 22 ++++++++--------- Scenarios/settings.md | 4 ++-- ...uildReferenceDocumentation.Action.Test.ps1 | 4 ++-- .../DetermineDeploymentEnvironments.Test.ps1 | 24 +++++++++---------- Workshop/ContinuousDeployment.md | 2 +- Workshop/PublishToProduction.md | 2 +- Workshop/ReferenceDoc.md | 4 ++-- 13 files changed, 66 insertions(+), 66 deletions(-) diff --git a/Actions/AL-Go-Helper.ps1 b/Actions/AL-Go-Helper.ps1 index 89356def2..1fa22c264 100644 --- a/Actions/AL-Go-Helper.ps1 +++ b/Actions/AL-Go-Helper.ps1 @@ -620,20 +620,20 @@ function ReadSettings { "environments" = @() "buildModes" = @() "useCompilerFolder" = $false - "PullRequestTrigger" = "pull_request_target" + "pullRequestTrigger" = "pull_request_target" "fullBuildPatterns" = @() "excludeEnvironments" = @() - "ALDoc" = [ordered]@{ - "ContinuousDeployment" = $false - "DeployToGitHubPages" = $true - "MaxReleases" = 3 - "UseProjectsAsFolders" = $true - "Projects" = @() - "ExcludeProjects" = @() - "Header" = "Documentation for {REPOSITORY} {VERSION}" - "Footer" = "Documentation for {REPOSITORY} made with AL-Go for GitHub, ALDoc and DocFx" - "DefaultIndexMD" = "## Reference documentation\n\nThis is the generated reference documentation for [{REPOSITORY}](https://github.com/{REPOSITORY}).\n\nYou can use the navigation bar at the top and the table of contents to the left to navigate your documentation.\n\nYou can change this content by creating/editing the **{INDEXTEMPLATERELATIVEPATH}** file in your repository or use the ALDoc:DefaultIndexMD setting in your repository settings file (.github/AL-Go-Settings.json)\n\n{RELEASENOTES}" - "DefaultReleaseMD" = "## Release reference documentation\n\nThis is the generated reference documentation for [{REPOSITORY}](https://github.com/{REPOSITORY}).\n\nYou can use the navigation bar at the top and the table of contents to the left to navigate your documentation.\n\nYou can change this content by creating/editing the **{INDEXTEMPLATERELATIVEPATH}** file in your repository or use the ALDoc:DefaultReleaseMD setting in your repository settings file (.github/AL-Go-Settings.json)\n\n{RELEASENOTES}" + "alDoc" = [ordered]@{ + "continuousDeployment" = $false + "deployToGitHubPages" = $true + "maxReleases" = 3 + "useProjectsAsFolders" = $true + "includeProjects" = @() + "excludeProjects" = @() + "header" = "Documentation for {REPOSITORY} {VERSION}" + "footer" = "Documentation for {REPOSITORY} made with AL-Go for GitHub, ALDoc and DocFx" + "defaultIndexMD" = "## Reference documentation\n\nThis is the generated reference documentation for [{REPOSITORY}](https://github.com/{REPOSITORY}).\n\nYou can use the navigation bar at the top and the table of contents to the left to navigate your documentation.\n\nYou can change this content by creating/editing the **{INDEXTEMPLATERELATIVEPATH}** file in your repository or use the alDoc:defaultIndexMD setting in your repository settings file (.github/AL-Go-Settings.json)\n\n{RELEASENOTES}" + "defaultReleaseMD" = "## Release reference documentation\n\nThis is the generated reference documentation for [{REPOSITORY}](https://github.com/{REPOSITORY}).\n\nYou can use the navigation bar at the top and the table of contents to the left to navigate your documentation.\n\nYou can change this content by creating/editing the **{INDEXTEMPLATERELATIVEPATH}** file in your repository or use the alDoc:defaultReleaseMD setting in your repository settings file (.github/AL-Go-Settings.json)\n\n{RELEASENOTES}" } } diff --git a/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.HelperFunctions.ps1 b/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.HelperFunctions.ps1 index d4cb1cb8d..ac22ebbb3 100644 --- a/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.HelperFunctions.ps1 +++ b/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.HelperFunctions.ps1 @@ -254,13 +254,13 @@ function GenerateDocsSite { function CalculateProjectsAndApps { Param( [string] $tempFolder, - [string[]] $projects, + [string[]] $includeProjects, [string[]] $excludeProjects, [switch] $useProjectsAsFolders ) - if ($projects.Count -eq 0) { $projects = @("*") } - $projectList = @($projects | ForEach-Object { $_.Replace('\','_').Replace('/','_') }) + if ($includeProjects.Count -eq 0) { $includeProjects = @("*") } + $projectList = @($includeProjects | ForEach-Object { $_.Replace('\','_').Replace('/','_') }) Write-Host "Include Project Patterns" $projectList | ForEach-Object { Write-Host "- $_" } $excludeProjectList = @($excludeProjects | ForEach-Object { $_.Replace('\','_').Replace('/','_') }) diff --git a/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.ps1 b/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.ps1 index 6115fd3cf..81f556912 100644 --- a/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.ps1 +++ b/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.ps1 @@ -10,9 +10,9 @@ DownloadAndImportBcContainerHelper $settings = $env:Settings | ConvertFrom-Json -$projects = $settings.ALDoc.Projects -$excludeProjects = $settings.ALDoc.ExcludeProjects -$maxReleases = $settings.ALDoc.MaxReleases +$includeProjects = $settings.alDoc.includeProjects +$excludeProjects = $settings.alDoc.excludeProjects +$maxReleases = $settings.alDoc.maxReleases $artifactsFolder = Join-Path $ENV:GITHUB_WORKSPACE ".artifacts" $artifactsFolderCreated = $false if ($artifacts -ne ".artifacts") { @@ -32,10 +32,10 @@ if ($artifacts -ne ".artifacts") { } } -$header = $settings.ALDoc.Header -$footer = $settings.ALDoc.Footer -$defaultIndexMD = $settings.ALDoc.DefaultIndexMD.Replace('\n',"`n") -$defaultReleaseMD = $settings.ALDoc.DefaultReleaseMD.Replace('\n',"`n") +$header = $settings.alDoc.header +$footer = $settings.alDoc.footer +$defaultIndexMD = $settings.alDoc.defaultIndexMD.Replace('\n',"`n") +$defaultReleaseMD = $settings.alDoc.defaultReleaseMD.Replace('\n',"`n") $releases = @() if ($maxReleases -gt 0) { @@ -54,14 +54,14 @@ foreach($release in $releases) { New-Item -Path $tempFolder -ItemType Directory | Out-Null try { foreach($mask in 'Apps', 'Dependencies') { - DownloadRelease -token $token -projects "$($projects -join ',')" -api_url $ENV:GITHUB_API_URL -repository $ENV:GITHUB_REPOSITORY -release $release -path $tempFolder -mask $mask -unpack + DownloadRelease -token $token -projects "$($includeProjects -join ',')" -api_url $ENV:GITHUB_API_URL -repository $ENV:GITHUB_REPOSITORY -release $release -path $tempFolder -mask $mask -unpack } Write-Host "Version: $($release.Name):" Get-ChildItem -Path $tempFolder -Recurse -File | ForEach-Object { Write-Host "- $($_.FullName.Substring($tempFolder.Length+1))" } - $allApps, $allDependencies = CalculateProjectsAndApps -tempFolder $tempFolder -projects $projects -excludeProjects $excludeProjects -useProjectsAsFolders:$settings.ALDoc.UseProjectsAsFolders + $allApps, $allDependencies = CalculateProjectsAndApps -tempFolder $tempFolder -includeProjects $includeProjects -excludeProjects $excludeProjects -useProjectsAsFolders:$settings.alDoc.useProjectsAsFolders $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 -useProjectsAsFolders:$settings.ALDoc.UseProjectsAsFolders + 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 @@ -85,7 +85,7 @@ foreach($version in $versions) { } Get-ChildItem -Path $artifactsFolder -Depth 1 -File | ForEach-Object { Write-Host "- $($_.FullName.Substring($artifactsFolder.Length))" } -$allApps, $allDependencies = CalculateProjectsAndApps -tempFolder $artifactsFolder -projects $projects -excludeProjects $excludeProjects -useProjectsAsFolders:$settings.ALDoc.UseProjectsAsFolders +$allApps, $allDependencies = CalculateProjectsAndApps -tempFolder $artifactsFolder -includeProjects $includeProjects -excludeProjects $excludeProjects -useProjectsAsFolders:$settings.alDoc.useProjectsAsFolders $releaseNotes = '' if ($latestReleaseTag) { try { @@ -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 -useProjectsAsFolders:$settings.ALDoc.UseProjectsAsFolders +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/Actions/CheckForUpdates/CheckForUpdates.HelperFunctions.ps1 b/Actions/CheckForUpdates/CheckForUpdates.HelperFunctions.ps1 index 4a86635f8..be532a407 100644 --- a/Actions/CheckForUpdates/CheckForUpdates.HelperFunctions.ps1 +++ b/Actions/CheckForUpdates/CheckForUpdates.HelperFunctions.ps1 @@ -78,9 +78,9 @@ function ModifyPullRequestHandlerWorkflow { [Yaml] $yaml, [hashtable] $repoSettings ) - # The PullRequestHandler workflow can have a RepoSetting called PullRequestTrigger which specifies the trigger to use for Pull Requests + # The PullRequestHandler workflow can have a RepoSetting called pullRequestTrigger which specifies the trigger to use for Pull Requests $triggerSection = $yaml.Get('on:/pull') - $triggerSection.content = "$($repoSettings.PullRequestTrigger):" + $triggerSection.content = "$($repoSettings.pullRequestTrigger):" $yaml.Replace('on:/pull', $triggerSection.Content) # The PullRequestHandler workflow can have a RepoSetting called CICDPullRequestBranches, which will be used to set the branches for the workflow @@ -92,7 +92,7 @@ function ModifyPullRequestHandlerWorkflow { } # update the branches: line with the new branches - $yaml.Replace("on:/$($repoSettings.PullRequestTrigger):/branches:", "branches: [ '$($CICDPullRequestBranches -join "', '")' ]") + $yaml.Replace("on:/$($repoSettings.pullRequestTrigger):/branches:", "branches: [ '$($CICDPullRequestBranches -join "', '")' ]") } function ModifyRunsOnAndShell { diff --git a/Actions/Deploy/Deploy.ps1 b/Actions/Deploy/Deploy.ps1 index ff7ca50a9..8e6b913c7 100644 --- a/Actions/Deploy/Deploy.ps1 +++ b/Actions/Deploy/Deploy.ps1 @@ -201,7 +201,7 @@ try { Write-Host "Publishing apps using development endpoint" Publish-BcContainerApp @parameters -useDevEndpoint -checkAlreadyInstalled -excludeRuntimePackages } - elseif (!$sandboxEnvironment -and $type -eq 'CD' -and !($deploymentSettings.ContinuousDeployment)) { + elseif (!$sandboxEnvironment -and $type -eq 'CD' -and !($deploymentSettings.continuousDeployment)) { # Continuous deployment is undefined in settings - we will not deploy to production environments Write-Host "::Warning::Ignoring environment $($deploymentSettings.EnvironmentName), which is a production environment" } diff --git a/Actions/DetermineDeploymentEnvironments/DetermineDeploymentEnvironments.ps1 b/Actions/DetermineDeploymentEnvironments/DetermineDeploymentEnvironments.ps1 index 71a956b82..129dd69c0 100644 --- a/Actions/DetermineDeploymentEnvironments/DetermineDeploymentEnvironments.ps1 +++ b/Actions/DetermineDeploymentEnvironments/DetermineDeploymentEnvironments.ps1 @@ -60,11 +60,11 @@ function Get-BranchesFromPolicy($ghEnvironment) { $settings = $env:Settings | ConvertFrom-Json | ConvertTo-HashTable -recurse -$generateALDocArtifact = ($type -eq 'Publish') -or $settings.ALDoc.ContinuousDeployment +$generateALDocArtifact = ($type -eq 'Publish') -or $settings.alDoc.continuousDeployment Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "GenerateALDocArtifact=$([int]$generateALDocArtifact)" Write-Host "GenerateALDocArtifact=$([int]$generateALDocArtifact)" -$deployToGitHubPages = $settings.ALDoc.DeployToGitHubPages +$deployToGitHubPages = $settings.alDoc.DeployToGitHubPages if ($deployToGitHubPages) { $deployToGitHubPages = IsGitHubPagesAvailable if (!$deployToGitHubPages) { @@ -104,7 +104,7 @@ if (!($environments)) { "BranchesFromPolicy" = @() "Projects" = '*' "SyncMode" = $null - "ContinuousDeployment" = !($getEnvironments -like '* (PROD)' -or $getEnvironments -like '* (Production)' -or $getEnvironments -like '* (FAT)' -or $getEnvironments -like '* (Final Acceptance Test)') + "continuousDeployment" = !($getEnvironments -like '* (PROD)' -or $getEnvironments -like '* (Production)' -or $getEnvironments -like '* (FAT)' -or $getEnvironments -like '* (Final Acceptance Test)') "runs-on" = @($settings."runs-on".Split(',').Trim()) } } @@ -136,7 +136,7 @@ else { "BranchesFromPolicy" = @() "Projects" = '*' "SyncMode" = $null - "ContinuousDeployment" = $null + "continuousDeployment" = $null "runs-on" = @($settings."runs-on".Split(',').Trim()) } diff --git a/RELEASENOTES.md b/RELEASENOTES.md index f7781af78..f4d7c707a 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -21,17 +21,17 @@ If false, the templateSha repository setting is used to download specific AL-Go ### New Settings - `alDoc` : JSON object with properties for the ALDoc reference document generation - - **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 Actions. (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}* + - **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 Actions. (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 + - **includeProjects** = 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}* ### New Workflows - **Deploy Reference Documentation** is a workflow, which you can invoke manually or on a schedule to generate and deploy reference documentation using the aldoc tool, using the ALDoc setting properties described above. diff --git a/Scenarios/settings.md b/Scenarios/settings.md index c47143ed7..2b0b94ae7 100644 --- a/Scenarios/settings.md +++ b/Scenarios/settings.md @@ -59,11 +59,11 @@ 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)
**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}* | +| 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
**includeProjects** = 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" ] | -| PullRequestTrigger | Setting for specifying the trigger AL-Go should use to trigger Pull Request Builds. By default it is set to [pull_request_target](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request_target) | +| pullRequestTrigger | Setting for specifying the trigger AL-Go should use to trigger Pull Request Builds. By default it is set to [pull_request_target](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request_target) | | CICDSchedule | CRON schedule for when CI/CD workflow should run. Default is no scheduled run, only manually triggered or triggered by Push or Pull Request. Build your CRON string here: [https://crontab.guru](https://crontab.guru) | | UpdateGitHubGoSystemFilesSchedule | CRON schedule for when Update AL-Go System Files should run. When Update AL-Go System Files runs on a schedule, it uses direct Commit instead of creating a PR. Default is no scheduled run, only manual trigger. Build your CRON string here: [https://crontab.guru](https://crontab.guru) | | buildModes | A list of build modes to use when building the AL-Go projects. Every AL-Go projects will be built using each built mode. Available build modes are:
**Default**: Apps are compiled as they are in the source code.
**Clean**: _PreprocessorSymbols_ are enabled when compiling the apps. The values for the symbols correspond to the `cleanModePreprocessorSymbols` setting of the AL-Go project.
**Translated**: `TranslationFile` compiler feature is enabled when compiling the apps. | diff --git a/Tests/BuildReferenceDocumentation.Action.Test.ps1 b/Tests/BuildReferenceDocumentation.Action.Test.ps1 index 76d1e0244..9717828e9 100644 --- a/Tests/BuildReferenceDocumentation.Action.Test.ps1 +++ b/Tests/BuildReferenceDocumentation.Action.Test.ps1 @@ -47,13 +47,13 @@ Describe "BuildReferenceDocumentation Action Tests" { } } - $allApps = CalculateProjectsAndApps -tempFolder (Get-Location).Path -projects @('P1','P2') -excludeProjects @('P3') + $allApps = CalculateProjectsAndApps -tempFolder (Get-Location).Path -includeProjects @('P1','P2') -excludeProjects @('P3') $allApps.Count | Should -Be 2 $allApps[0].Keys.Count | Should -be 1 $allApps[0].ContainsKey('dummy') | Should -be $true $allApps[0]."dummy".Count | Should -be 3 - $allApps = CalculateProjectsAndApps -tempFolder (Get-Location).Path -projects @('*') -excludeProjects @('P3') -useProjectsAsFolders + $allApps = CalculateProjectsAndApps -tempFolder (Get-Location).Path -includeProjects @('*') -excludeProjects @('P3') -useProjectsAsFolders $allApps.Count | Should -Be 2 $allApps[0].Keys.Count | Should -be 3 $allApps[0].ContainsKey('dummy') | Should -be $false diff --git a/Tests/DetermineDeploymentEnvironments.Test.ps1 b/Tests/DetermineDeploymentEnvironments.Test.ps1 index 995c36b9b..174509471 100644 --- a/Tests/DetermineDeploymentEnvironments.Test.ps1 +++ b/Tests/DetermineDeploymentEnvironments.Test.ps1 @@ -56,17 +56,17 @@ Describe "DetermineDeploymentEnvironments Action Test" { return (ConvertTo-Json -Compress -Depth 99 -InputObject @{ "environments" = @( @{ "name" = "test"; "protection_rules" = @() }, @{ "name" = "another"; "protection_rules" = @() } ) }) } - $env:Settings = @{ "type" = "PTE"; "runs-on" = "ubuntu-latest"; "environments" = @(); "excludeEnvironments" = @( 'github-pages' ); "ALDoc" = @{ "ContinuousDeployment" = $false; "DeployToGitHubPages" = $false } } | ConvertTo-Json -Compress + $env:Settings = @{ "type" = "PTE"; "runs-on" = "ubuntu-latest"; "environments" = @(); "excludeEnvironments" = @( 'github-pages' ); "alDoc" = @{ "continuousDeployment" = $false; "deployToGitHubPages" = $false } } | ConvertTo-Json -Compress . (Join-Path $scriptRoot $scriptName) -getEnvironments '*' -type 'CD' PassGeneratedOutput $EnvironmentsMatrixJson | ConvertFrom-Json | ConvertTo-HashTable -recurse | Should -MatchHashtable @{"matrix"=@{"include"=@(@{"environment"="another";"os"="[""ubuntu-latest""]"};@{"environment"="test";"os"="[""ubuntu-latest""]"})};"fail-fast"=$false} - $DeploymentEnvironmentsJson | ConvertFrom-Json | ConvertTo-HashTable -recurse | Should -MatchHashtable @{"test"=@{"EnvironmentType"="SaaS";"EnvironmentName"="test";"Branches"=@();"BranchesFromPolicy"=@();"Projects"="*";"SyncMode"=$null;"ContinuousDeployment"=$null;"runs-on"=@("ubuntu-latest")};"another"=@{"EnvironmentType"="SaaS";"EnvironmentName"="another";"Branches"=@();"BranchesFromPolicy"=@();"Projects"="*";"SyncMode"=$null;"ContinuousDeployment"=$null;"runs-on"=@("ubuntu-latest")}} + $DeploymentEnvironmentsJson | ConvertFrom-Json | ConvertTo-HashTable -recurse | Should -MatchHashtable @{"test"=@{"EnvironmentType"="SaaS";"EnvironmentName"="test";"Branches"=@();"BranchesFromPolicy"=@();"Projects"="*";"SyncMode"=$null;"continuousDeployment"=$null;"runs-on"=@("ubuntu-latest")};"another"=@{"EnvironmentType"="SaaS";"EnvironmentName"="another";"Branches"=@();"BranchesFromPolicy"=@();"Projects"="*";"SyncMode"=$null;"continuousDeployment"=$null;"runs-on"=@("ubuntu-latest")}} $EnvironmentCount | Should -Be 2 . (Join-Path $scriptRoot $scriptName) -getEnvironments 'test' -type 'CD' PassGeneratedOutput $EnvironmentsMatrixJson | ConvertFrom-Json | ConvertTo-HashTable -recurse | Should -MatchHashtable @{"matrix"=@{"include"=@(@{"environment"="test";"os"="[""ubuntu-latest""]"})};"fail-fast"=$false} - $DeploymentEnvironmentsJson | ConvertFrom-Json | ConvertTo-HashTable -recurse | Should -MatchHashtable @{"test"=@{"EnvironmentType"="SaaS";"EnvironmentName"="test";"Branches"=@();"BranchesFromPolicy"=@();"Projects"="*";"SyncMode"=$null;"ContinuousDeployment"=$null;"runs-on"=@("ubuntu-latest")}} + $DeploymentEnvironmentsJson | ConvertFrom-Json | ConvertTo-HashTable -recurse | Should -MatchHashtable @{"test"=@{"EnvironmentType"="SaaS";"EnvironmentName"="test";"Branches"=@();"BranchesFromPolicy"=@();"Projects"="*";"SyncMode"=$null;"continuousDeployment"=$null;"runs-on"=@("ubuntu-latest")}} $EnvironmentCount | Should -Be 1 } @@ -79,11 +79,11 @@ Describe "DetermineDeploymentEnvironments Action Test" { return (ConvertTo-Json -Compress -Depth 99 -InputObject @( @{ "name" = "branch"; "protected" = $true }, @{ "name" = "main"; "protected" = $false } )) } - $env:Settings = @{ "type" = "PTE"; "runs-on" = "ubuntu-latest"; "environments" = @(); "excludeEnvironments" = @( 'github-pages' ); "ALDoc" = @{ "ContinuousDeployment" = $false; "DeployToGitHubPages" = $false } } | ConvertTo-Json -Compress + $env:Settings = @{ "type" = "PTE"; "runs-on" = "ubuntu-latest"; "environments" = @(); "excludeEnvironments" = @( 'github-pages' ); "alDoc" = @{ "continuousDeployment" = $false; "deployToGitHubPages" = $false } } | ConvertTo-Json -Compress . (Join-Path $scriptRoot $scriptName) -getEnvironments '*' -type 'CD' PassGeneratedOutput $EnvironmentsMatrixJson | ConvertFrom-Json | ConvertTo-HashTable -recurse | Should -MatchHashtable @{"matrix"=@{"include"=@(@{"environment"="another";"os"="[""ubuntu-latest""]"})};"fail-fast"=$false} - $DeploymentEnvironmentsJson | ConvertFrom-Json | ConvertTo-HashTable -recurse | Should -MatchHashtable @{"another"=@{"EnvironmentType"="SaaS";"EnvironmentName"="another";"Branches"=@();"BranchesFromPolicy"=@();"Projects"="*";"SyncMode"=$null;"ContinuousDeployment"=$null;"runs-on"=@("ubuntu-latest")}} + $DeploymentEnvironmentsJson | ConvertFrom-Json | ConvertTo-HashTable -recurse | Should -MatchHashtable @{"another"=@{"EnvironmentType"="SaaS";"EnvironmentName"="another";"Branches"=@();"BranchesFromPolicy"=@();"Projects"="*";"SyncMode"=$null;"continuousDeployment"=$null;"runs-on"=@("ubuntu-latest")}} $EnvironmentCount | Should -Be 1 $env:GITHUB_REF_NAME = 'branch' @@ -104,12 +104,12 @@ Describe "DetermineDeploymentEnvironments Action Test" { return @{ "branch_policies" = @( @{ "name" = "branch" }, @{ "name" = "branch2" } ) } | ConvertTo-Json -Depth 99 -Compress } - $env:Settings = @{ "type" = "PTE"; "runs-on" = "ubuntu-latest"; "environments" = @(); "excludeEnvironments" = @( 'github-pages' ); "ALDoc" = @{ "ContinuousDeployment" = $false; "DeployToGitHubPages" = $false } } | ConvertTo-Json -Compress + $env:Settings = @{ "type" = "PTE"; "runs-on" = "ubuntu-latest"; "environments" = @(); "excludeEnvironments" = @( 'github-pages' ); "alDoc" = @{ "continuousDeployment" = $false; "deployToGitHubPages" = $false } } | ConvertTo-Json -Compress # Only another environment should be included when deploying from main . (Join-Path $scriptRoot $scriptName) -getEnvironments '*' -type 'CD' PassGeneratedOutput $EnvironmentsMatrixJson | ConvertFrom-Json | ConvertTo-HashTable -recurse | Should -MatchHashtable @{"matrix"=@{"include"=@(@{"environment"="another";"os"="[""ubuntu-latest""]"})};"fail-fast"=$false} - $DeploymentEnvironmentsJson | ConvertFrom-Json | ConvertTo-HashTable -recurse | Should -MatchHashtable @{"another"=@{"EnvironmentType"="SaaS";"EnvironmentName"="another";"Branches"=@();"BranchesFromPolicy"=@();"Projects"="*";"SyncMode"=$null;"ContinuousDeployment"=$null;"runs-on"=@("ubuntu-latest")}} + $DeploymentEnvironmentsJson | ConvertFrom-Json | ConvertTo-HashTable -recurse | Should -MatchHashtable @{"another"=@{"EnvironmentType"="SaaS";"EnvironmentName"="another";"Branches"=@();"BranchesFromPolicy"=@();"Projects"="*";"SyncMode"=$null;"continuousDeployment"=$null;"runs-on"=@("ubuntu-latest")}} $EnvironmentCount | Should -Be 1 ($EnvironmentsMatrixJson | ConvertFrom-Json | ConvertTo-HashTable -recurse).matrix.include.environment | Should -Contain "another" @@ -152,7 +152,7 @@ Describe "DetermineDeploymentEnvironments Action Test" { return (ConvertTo-Json -Compress -Depth 99 -InputObject @{ "environments" = @( @{ "name" = "test"; "protection_rules" = @() }; @{ "name" = "another"; "protection_rules" = @() } ) }) } - $settings = @{ "type" = "PTE"; "runs-on" = "ubuntu-latest"; "environments" = @("settingsenv"); "excludeEnvironments" = @( 'github-pages' ); "ALDoc" = @{ "ContinuousDeployment" = $false; "DeployToGitHubPages" = $false } } + $settings = @{ "type" = "PTE"; "runs-on" = "ubuntu-latest"; "environments" = @("settingsenv"); "excludeEnvironments" = @( 'github-pages' ); "alDoc" = @{ "continuousDeployment" = $false; "deployToGitHubPages" = $false } } $env:Settings = $settings | ConvertTo-Json -Compress . (Join-Path $scriptRoot $scriptName) -getEnvironments '*' -type 'CD' PassGeneratedOutput @@ -193,7 +193,7 @@ Describe "DetermineDeploymentEnvironments Action Test" { } # One PROD environment and one non-PROD environment - only non-PROD environment is selected for CD - $settings = @{ "type" = "PTE"; "runs-on" = "ubuntu-latest"; "environments" = @("test (PROD)","another"); "excludeEnvironments" = @( 'github-pages' ); "ALDoc" = @{ "ContinuousDeployment" = $false; "DeployToGitHubPages" = $false } } + $settings = @{ "type" = "PTE"; "runs-on" = "ubuntu-latest"; "environments" = @("test (PROD)","another"); "excludeEnvironments" = @( 'github-pages' ); "alDoc" = @{ "continuousDeployment" = $false; "deployToGitHubPages" = $false } } $env:Settings = $settings | ConvertTo-Json -Compress . (Join-Path $scriptRoot $scriptName) -getEnvironments '*' -type 'CD' PassGeneratedOutput @@ -210,7 +210,7 @@ Describe "DetermineDeploymentEnvironments Action Test" { # 2 environments defined in Settings - one PROD and one non-PROD (settings based) It 'Test calling action directly - 2 environments defined in Settings - one PROD and one non-PROD (settings based)' { - $settings = @{ "type" = "PTE"; "runs-on" = "ubuntu-latest"; "environments" = @("test (PROD)","another"); "excludeEnvironments" = @( 'github-pages' ); "ALDoc" = @{ "ContinuousDeployment" = $false; "DeployToGitHubPages" = $false } } + $settings = @{ "type" = "PTE"; "runs-on" = "ubuntu-latest"; "environments" = @("test (PROD)","another"); "excludeEnvironments" = @( 'github-pages' ); "alDoc" = @{ "continuousDeployment" = $false; "deployToGitHubPages" = $false } } Mock InvokeWebRequest -ParameterFilter { $uri -like '*/environments' } -MockWith { throw "Not supported" @@ -218,10 +218,10 @@ Describe "DetermineDeploymentEnvironments Action Test" { $settings += @{ "DeployToTest" = @{ - "ContinuousDeployment" = $false + "continuousDeployment" = $false } "DeployToAnother" = @{ - "ContinuousDeployment" = $true + "continuousDeployment" = $true } } diff --git a/Workshop/ContinuousDeployment.md b/Workshop/ContinuousDeployment.md index 6b59d9d5d..7af7f2cc2 100644 --- a/Workshop/ContinuousDeployment.md +++ b/Workshop/ContinuousDeployment.md @@ -19,7 +19,7 @@ If your actual Business Central environment has a different name than your GitHu ```json "DeployToMy-QA": { "EnvironmentName": "QA", - "ContinuousDeployment": true + "continuousDeployment": true } ``` diff --git a/Workshop/PublishToProduction.md b/Workshop/PublishToProduction.md index cbc84f8c3..340ced2a4 100644 --- a/Workshop/PublishToProduction.md +++ b/Workshop/PublishToProduction.md @@ -15,7 +15,7 @@ By adding a setting like: ```json "DeployToPROD": { - "ContinuousDeployment": false + "continuousDeployment": false } ``` diff --git a/Workshop/ReferenceDoc.md b/Workshop/ReferenceDoc.md index 6e52f142c..36d8cbefe 100644 --- a/Workshop/ReferenceDoc.md +++ b/Workshop/ReferenceDoc.md @@ -70,8 +70,8 @@ To allow daily generation of the reference documentation, modify the .github/AL- If you want to setup continuous deployment of the reference documentation, you can add this setting: ```json - "ALDoc": { - "ContinuousDeployment": true + "alDoc": { + "continuousDeployment": true } ``` From 80da73ebf24fd2980e18a328aff6b0d4ede70f60 Mon Sep 17 00:00:00 2001 From: Freddy Kristiansen Date: Fri, 1 Dec 2023 10:48:49 +0100 Subject: [PATCH 218/235] Update Actions/AL-Go-Helper.ps1 Co-authored-by: Alexander Holstrup <117829001+aholstrup1@users.noreply.github.com> --- Actions/AL-Go-Helper.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Actions/AL-Go-Helper.ps1 b/Actions/AL-Go-Helper.ps1 index 1fa22c264..dd0ea91b3 100644 --- a/Actions/AL-Go-Helper.ps1 +++ b/Actions/AL-Go-Helper.ps1 @@ -18,7 +18,7 @@ $defaultCICDPushBranches = @( 'main', 'release/*', 'feature/*' ) [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', 'defaultCICDPullRequestBranches', Justification = 'False positive.')] $defaultCICDPullRequestBranches = @( 'main' ) $runningLocal = $local.IsPresent -$defaultBcContainerHelperVersion = "https://github.com/freddydk/navcontainerhelper/archive/refs/heads/renewaccesstoken.zip" # Must be double quotes. Will be replaced by BcContainerHelperVersion if necessary in the deploy step +$defaultBcContainerHelperVersion = "preview" # Must be double quotes. Will be replaced by BcContainerHelperVersion if necessary in the deploy step $microsoftTelemetryConnectionString = "InstrumentationKey=84bd9223-67d4-4378-8590-9e4a46023be2;IngestionEndpoint=https://westeurope-1.in.applicationinsights.azure.com/" $runAlPipelineOverrides = @( From 2b1be348e512025b339d3526391a24f82bb0530d Mon Sep 17 00:00:00 2001 From: freddydk Date: Sat, 2 Dec 2023 09:16:29 +0100 Subject: [PATCH 219/235] add end2end test --- e2eTests/Test-Functions.ps1 | 16 +-- .../RunDeployReferenceDocumentation.ps1 | 12 ++ e2eTests/e2eTestHelper.psm1 | 38 +++++- .../ReferenceDocumentation/runtest.ps1 | 127 ++++++++++++++++++ 4 files changed, 183 insertions(+), 10 deletions(-) create mode 100644 e2eTests/Workflows/RunDeployReferenceDocumentation.ps1 create mode 100644 e2eTests/scenarios/ReferenceDocumentation/runtest.ps1 diff --git a/e2eTests/Test-Functions.ps1 b/e2eTests/Test-Functions.ps1 index 083d6b571..e7d6496c5 100644 --- a/e2eTests/Test-Functions.ps1 +++ b/e2eTests/Test-Functions.ps1 @@ -80,20 +80,20 @@ function Test-ArtifactsFromRun { foreach($type in $expectedArtifacts.Keys) { $expected = $expectedArtifacts."$type" Write-Host "Type: $type, Expected: $expected" + # Reason for the ? instead of \ is that the folder separator is \ on Windows and / on Linux if ($type -eq 'thisbuild') { $fileNamePattern = "thisbuild-*-Apps?*$appVersion.*.*.app" - Write-Host "FileNamePattern: $fileNamePattern" - $actual = @(Get-ChildItem -Path $path -File -Recurse | Where-Object { - $_.FullName.Substring($path.Length+1) -like $fileNamePattern - }).Count + } + elseif ($type -eq 'github-pages') { + $fileNamePattern = "github-pages?artifact.tar" } else { $fileNamePattern = "*-$type-$repoVersion.*.*?*$appVersion.*.*.app" - Write-Host "FileNamePattern: $fileNamePattern" - $actual = @(Get-ChildItem -Path $path -File -Recurse | Where-Object { - $_.FullName.SubString($path.Length+1) -like $fileNamePattern - }).Count } + Write-Host "FileNamePattern: $fileNamePattern" + $actual = @(Get-ChildItem -Path $path -File -Recurse | Where-Object { + $_.FullName.Substring($path.Length+1) -like $fileNamePattern + }).Count if ($actual -ne $expected) { Write-Host "::Error::Expected number of $type was $expected. Actual number of $type is $actual" $err = $true diff --git a/e2eTests/Workflows/RunDeployReferenceDocumentation.ps1 b/e2eTests/Workflows/RunDeployReferenceDocumentation.ps1 new file mode 100644 index 000000000..d14c1000a --- /dev/null +++ b/e2eTests/Workflows/RunDeployReferenceDocumentation.ps1 @@ -0,0 +1,12 @@ +function RunDeployReferenceDocumentation { + Param( + [switch] $wait, + [string] $repository, + [string] $branch = "main" + ) + + $workflowName = 'Deploy Reference Documentation' + $parameters = @{ + } + RunWorkflow -name $workflowName -parameters $parameters -wait:$wait -branch $branch -repository $repository +} \ No newline at end of file diff --git a/e2eTests/e2eTestHelper.psm1 b/e2eTests/e2eTestHelper.psm1 index 2cd42dca3..b061d2054 100644 --- a/e2eTests/e2eTestHelper.psm1 +++ b/e2eTests/e2eTestHelper.psm1 @@ -207,11 +207,45 @@ function DownloadWorkflowLog { Expand-Archive -Path $tempFileName -DestinationPath $path } +function CancelAllWorkflows { + Param( + [string] $repository, + [switch] $noDelay + ) + if (-not $noDelay.IsPresent) { + Start-Sleep -Seconds 60 + } + $runs = gh api /repos/$repository/actions/runs | ConvertFrom-Json + foreach($run in $runs.workflow_runs) { + Write-Host $run.name + if ($run.status -eq 'in_progress') { + Write-Host "Cancelling $($run.name) run $($run.id)" + gh api --method POST /repos/$repository/actions/runs/$($run.id)/cancel | Out-Null + } + } +} + +function WaitAllWorkflows { + Param( + [string] $repository, + [switch] $noDelay, + [switch] $noError + ) + if (-not $noDelay.IsPresent) { + Start-Sleep -Seconds 60 + } + $runs = gh api /repos/$repository/actions/runs | ConvertFrom-Json + foreach($run in $runs.workflow_runs) { + WaitWorkflow -repository $repository -runid $run.id -noDelay -noError:$noError + } +} + function WaitWorkflow { Param( [string] $repository, [string] $runid, - [switch] $noDelay + [switch] $noDelay, + [switch] $noError ) $delay = !$noDelay.IsPresent @@ -237,7 +271,7 @@ function WaitWorkflow { Write-Host Write-Host $run.conclusion if ($run.conclusion -ne "Success") { - throw "Workflow $($run.name), conclusion $($run.conclusion), url = $($run.html_url)" + if (-not $noError.IsPresent) { throw "Workflow $($run.name), conclusion $($run.conclusion), url = $($run.html_url)" } } } diff --git a/e2eTests/scenarios/ReferenceDocumentation/runtest.ps1 b/e2eTests/scenarios/ReferenceDocumentation/runtest.ps1 new file mode 100644 index 000000000..8ab84de50 --- /dev/null +++ b/e2eTests/scenarios/ReferenceDocumentation/runtest.ps1 @@ -0,0 +1,127 @@ +[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidGlobalVars', '', Justification = 'Global vars used for local test execution only.')] +[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSReviewUnusedParameter', '', Justification = 'All scenario tests have equal parameter set.')] +Param( + [switch] $github, + [string] $githubOwner = $global:E2EgithubOwner, + [string] $repoName = [System.IO.Path]::GetFileNameWithoutExtension([System.IO.Path]::GetTempFileName()), + [string] $token = ($Global:SecureE2EPAT | Get-PlainText), + [string] $pteTemplate = $global:pteTemplate, + [string] $appSourceTemplate = $global:appSourceTemplate, + [string] $adminCenterApiToken = ($global:SecureAdminCenterApiToken | Get-PlainText), + [string] $licenseFileUrl = ($global:SecureLicenseFileUrl | Get-PlainText) +) + +Write-Host -ForegroundColor Yellow @' +# _____ __ _____ _ _ _ +# | __ \ / _| | __ \ | | | | (_) +# | |__) |___| |_ ___ _ __ ___ _ __ ___ ___ | | | | ___ ___ _ _ _ __ ___ ___ _ __ | |_ __ _| |_ _ ___ _ __ +# | _ // _ \ _/ _ \ '__/ _ \ '_ \ / __/ _ \ | | | |/ _ \ / __| | | | '_ ` _ \ / _ \ '_ \| __/ _` | __| |/ _ \| '_ \ +# | | \ \ __/ || __/ | | __/ | | | (_| __/ | |__| | (_) | (__| |_| | | | | | | __/ | | | || (_| | |_| | (_) | | | | +# |_| \_\___|_| \___|_| \___|_| |_|\___\___| |_____/ \___/ \___|\__,_|_| |_| |_|\___|_| |_|\__\__,_|\__|_|\___/|_| |_| +# +# +# This test tests the following scenario: +# +# - Create a new repository based on the PTE template with 1 app +# - Enable GitHub pages (set to GitHub Actions) +# - Run the "CI/CD" workflow +# - Run the Deploy Reference Documentation workflow +# - Check github pages website generated +# - Change settings to use continuous deployment of ALDoc and modify the header +# - Run the "CI/CD" workflow +# - Check that the new header is used +# - Set runs-on to ubuntu-latest (and use CompilerFolder) +# - Modify the header again +# - Run the "CI/CD" workflow again +# - Check that the new header is used +# - Cleanup repositories +# +'@ + +$errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0 +$prevLocation = Get-Location + +Remove-Module e2eTestHelper -ErrorAction SilentlyContinue +Import-Module (Join-Path $PSScriptRoot "..\..\e2eTestHelper.psm1") -DisableNameChecking + +$repository = "$githubOwner/$repoName" +$branch = "main" + +$template = "https://github.com/$pteTemplate" + +# Login +SetTokenAndRepository -github:$github -githubOwner $githubOwner -token $token -repository $repository + +$appName = 'MyApp' +$publisherName = 'Freddy' + +# Create repository1 +CreateAlGoRepository ` + -github:$github ` + -template $template ` + -repository $repository ` + -branch $branch ` + -contentScript { + Param([string] $path) + $null = CreateNewAppInFolder -folder $path -name $appName -publisher $publisherName + Add-PropertiesToJsonFile -path (Join-Path $path '.github/AL-Go-Settings.json') -properties @{ "alDoc" = @{ "ContinuousDeployment" = $true; "deployToGitHubPages" = $false } } + } + +# Cancel all running workflows +CancelAllWorkflows -repository $repository + +$repoPath = (Get-Location).Path +$run = RunCICD -repository $repository -branch $branch + +# Wait for CI/CD workflow of repository1 to finish +WaitWorkflow -repository $repository -runid $run.id + +# test artifacts generated in repository1 +Test-ArtifactsFromRun -runid $run.id -folder 'artifacts' -expectedArtifacts @{"Apps"=1;"TestApps"=0;"Dependencies"=0;"github-pages"=1} -repoVersion '1.0' -appVersion '1.0' + +# Set GitHub Pages in repository to GitHub Actions +gh api --method POST /repos/$repository/pages -f build_type=workflow | Out-Null + +# Add setting to deploy to GitHub Pages +Pull +Add-PropertiesToJsonFile -path '.github/AL-Go-Settings.json' -properties @{ "alDoc" = @{ "ContinuousDeployment" = $false; "deployToGitHubPages" = $true } } +CommitAndPush -commitMessage 'DeployToGitHubPages' + +# Run Deploy Reference Documentation and wait for it to finish +RunDeployReferenceDocumentation -repository $repository -wait | Out-Null + +# Get Pages URL and read the content +$pagesInfo = gh api /repos/$repository/pages | ConvertFrom-Json +$html = (Invoke-WebRequest -Uri $pagesInfo.html_url -UseBasicParsing).Content +$html | Should -belike "*Documentation for $repository*" + +# Remove downloaded artifacts +Remove-Item -Path 'artifacts' -Recurse -Force + +# Set GitHubRunner and runs-on to ubuntu-latest (and use CompilerFolder) +Pull +Add-PropertiesToJsonFile -path '.github/AL-Go-Settings.json' -properties @{ "runs-on" = "ubuntu-latest"; "gitHubRunner" = "ubuntu-latest"; "UseCompilerFolder" = $true; "doNotPublishApps" = $true } +CommitAndPush -commitMessage 'Shift to Linux' + +# Upgrade AL-Go System Files +RunUpdateAlGoSystemFiles -directCommit -commitMessage 'Update system files' -wait -templateUrl $template -ghTokenWorkflow $token | Out-Null + +# Cancel all running workflows +CancelAllWorkflows -repository $repository + +# Set continuous deployment of ALDoc and modify the header +Pull +Add-PropertiesToJsonFile -path '.github/AL-Go-Settings.json' -properties @{ "alDoc" = @{ "ContinuousDeployment" = $true; "deployToGitHubPages" = $true; "Header" = "Documentazione per {REPOSITORY}" } } +CommitAndPush -commitMessage 'Shift to Linux' + +# Wait for CI/CD run after config change +WaitAllWorkflows -repository $repository -noError + +# Get Pages URL and read the content +$pagesInfo = gh api /repos/$repository/pages | ConvertFrom-Json +$html = (Invoke-WebRequest -Uri $pagesInfo.html_url -UseBasicParsing).Content +$html | Should -belike "*Documentazione per $repository*" + +Set-Location $prevLocation + +RemoveRepository -repository $repository -path $repoPath From f08bf0515b8c8fed53f5cfc209b551ce8641073f Mon Sep 17 00:00:00 2001 From: freddydk Date: Sat, 2 Dec 2023 10:54:19 +0100 Subject: [PATCH 220/235] include file --- e2eTests/e2eTestHelper.psm1 | 1 + 1 file changed, 1 insertion(+) diff --git a/e2eTests/e2eTestHelper.psm1 b/e2eTests/e2eTestHelper.psm1 index b061d2054..6a3f689bc 100644 --- a/e2eTests/e2eTestHelper.psm1 +++ b/e2eTests/e2eTestHelper.psm1 @@ -611,6 +611,7 @@ function Test-LogContainsFromRun { . (Join-Path $PSScriptRoot "Workflows\RunAddExistingAppOrTestApp.ps1") . (Join-Path $PSScriptRoot "Workflows\RunCICD.ps1") . (Join-Path $PSScriptRoot "Workflows\RunCreateApp.ps1") +. (Join-Path $PSScriptRoot "Workflows\RunDeployReferenceDocumentation.ps1") . (Join-Path $PSScriptRoot "Workflows\RunCreateOnlineDevelopmentEnvironment.ps1") . (Join-Path $PSScriptRoot "Workflows\RunCreateRelease.ps1") . (Join-Path $PSScriptRoot "Workflows\RunCreateTestApp.ps1") From 7dcfd206100243c0058998d1b0c621d13facb22f Mon Sep 17 00:00:00 2001 From: freddydk Date: Sat, 2 Dec 2023 10:59:57 +0100 Subject: [PATCH 221/235] script analyzer --- e2eTests/scenarios/ReferenceDocumentation/runtest.ps1 | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/e2eTests/scenarios/ReferenceDocumentation/runtest.ps1 b/e2eTests/scenarios/ReferenceDocumentation/runtest.ps1 index 8ab84de50..be434d0ca 100644 --- a/e2eTests/scenarios/ReferenceDocumentation/runtest.ps1 +++ b/e2eTests/scenarios/ReferenceDocumentation/runtest.ps1 @@ -12,13 +12,13 @@ Param( ) Write-Host -ForegroundColor Yellow @' -# _____ __ _____ _ _ _ -# | __ \ / _| | __ \ | | | | (_) -# | |__) |___| |_ ___ _ __ ___ _ __ ___ ___ | | | | ___ ___ _ _ _ __ ___ ___ _ __ | |_ __ _| |_ _ ___ _ __ -# | _ // _ \ _/ _ \ '__/ _ \ '_ \ / __/ _ \ | | | |/ _ \ / __| | | | '_ ` _ \ / _ \ '_ \| __/ _` | __| |/ _ \| '_ \ +# _____ __ _____ _ _ _ +# | __ \ / _| | __ \ | | | | (_) +# | |__) |___| |_ ___ _ __ ___ _ __ ___ ___ | | | | ___ ___ _ _ _ __ ___ ___ _ __ | |_ __ _| |_ _ ___ _ __ +# | _ // _ \ _/ _ \ '__/ _ \ '_ \ / __/ _ \ | | | |/ _ \ / __| | | | '_ ` _ \ / _ \ '_ \| __/ _` | __| |/ _ \| '_ \ # | | \ \ __/ || __/ | | __/ | | | (_| __/ | |__| | (_) | (__| |_| | | | | | | __/ | | | || (_| | |_| | (_) | | | | # |_| \_\___|_| \___|_| \___|_| |_|\___\___| |_____/ \___/ \___|\__,_|_| |_| |_|\___|_| |_|\__\__,_|\__|_|\___/|_| |_| -# +# # # This test tests the following scenario: # From cbaa2d889600c202e2f0ef7fd2c71717f094bce4 Mon Sep 17 00:00:00 2001 From: freddydk Date: Sun, 3 Dec 2023 07:08:19 +0100 Subject: [PATCH 222/235] update docs --- Workshop/AddAnApp.md | 7 ++++--- Workshop/GetStarted.md | 15 +++++++-------- Workshop/Prerequisites.md | 4 ++-- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Workshop/AddAnApp.md b/Workshop/AddAnApp.md index 46c234b7b..a269dcbf4 100644 --- a/Workshop/AddAnApp.md +++ b/Workshop/AddAnApp.md @@ -18,10 +18,11 @@ Enter the following values in the form: | Name | `app1` | | Publisher | `` | | ID Range (from..to) | `55000..55100` | -| Include Sample Code | `yes` | -| Direct Commit | `no` | +| Include Sample Code | :ballot_box_with_check: | +| Direct Commit | :black_square_button: | +| Use GhTokenWorkflow | :black_square_button: | -| ![image](https://github.com/microsoft/AL-Go/assets/10775043/3520147b-cb0c-4ee9-90f4-f6efeb81b23f) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/b556ae00-469c-4156-9b1b-925ee4632e4d) | |-| Wait a few minutes until the workflow completes and click **Pull requests** to see that there is a Pull request open for review. diff --git a/Workshop/GetStarted.md b/Workshop/GetStarted.md index e89e36fdc..d9fcf1caf 100644 --- a/Workshop/GetStarted.md +++ b/Workshop/GetStarted.md @@ -3,33 +3,32 @@ With our prerequisites in place, it is time to get started and create our first In a browser, navigate to https://aka.ms/algopte: -| ![image](https://github.com/microsoft/AL-Go/assets/10775043/e00a3a4e-0443-4369-9cad-6a4041fd9c58) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/1c6a3d1d-b712-4837-9654-58fccbdd911e) | |-| And you should see: - -| ![image](https://github.com/microsoft/AL-Go/assets/10775043/ba6520ef-2c24-454e-9227-2298a26931e2) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/7e74715a-0e9a-4f7a-b261-a7107fad8888) | |-| -Click **Use This Template** and select **Create a new repository**. Select your **organizational account** as **owner** and enter **repo1** as repository name. Make the repo **public** and click **Create repository form template**. +Click **Use This Template** and select **Create a new repository**. Select your **organizational account** as **owner** and enter **repo1** as repository name. Make the repo **public** and click **Create repository**. -| ![image](https://github.com/microsoft/AL-Go/assets/10775043/8f529957-5023-4967-ad8c-2bc4399cec47) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/32ce5b05-b347-4174-b83d-e344756f2d06) | |-| After a few seconds, your new repository should be ready for you. -| ![image](https://github.com/microsoft/AL-Go/assets/10775043/a56e6b5f-8978-4065-828b-946ba324f525) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/11d7f51d-f38c-4163-a929-a55f2360911d) | |-| Click **Actions**, and you should see that a CI/CD workflow has already been kicked off on our empty repository. -| ![image](https://github.com/microsoft/AL-Go/assets/10775043/8e75c3b6-741f-4802-b061-b574c7673b46) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/e13fc12d-c36d-4014-bbe5-0f8003c90bb0) | |-| Wait for the CI/CD workflow to complete and click the completed workflow to see details. -| ![image](https://github.com/microsoft/AL-Go/assets/10775043/9389fe37-c8e8-4bbb-8283-eb9cf4fa4424) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/cc181fb1-0496-45aa-87c5-69fd000d772f) | |-| Note the warnings explaining that no apps have been added. The CI/CD workflow doesn't have anything to compile yet as you didn't add any source code. diff --git a/Workshop/Prerequisites.md b/Workshop/Prerequisites.md index b5df911d3..c25e26be6 100644 --- a/Workshop/Prerequisites.md +++ b/Workshop/Prerequisites.md @@ -6,11 +6,11 @@ You will need: - Free should be enough to follow the workshop 1. A GitHub organizational account - Free should be enough to follow the workshop -1. An organizational secret called GHTOKENWORKFLOW containing a personal access token (classic or fine-grained) +1. An organizational **secret** called GHTOKENWORKFLOW containing a personal access token (classic or fine-grained) - Using classic tokens, the token should have **workflow** permissions (automatically includes repo permissions) - Using Fine-grained tokens, the token should have **Read and Write** access to **Contents**, **Pull Requests** and **Workflows** (automatically includes Read-only access to Metadata) - The secret should be available to all public repositories (you cannot have organizational secret accessible for private repos in Free GitHub) -1. An organizational variable called ALGOORGSETTINGS +1. An organizational **variable** called ALGOORGSETTINGS - Containing the following JSON structure (for performance reasons) ```json From 8692bcb63daad734729ad99b514d5299310e8bd3 Mon Sep 17 00:00:00 2001 From: freddydk Date: Sun, 3 Dec 2023 07:33:45 +0100 Subject: [PATCH 223/235] only warn if needed --- .../DetermineDeploymentEnvironments.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Actions/DetermineDeploymentEnvironments/DetermineDeploymentEnvironments.ps1 b/Actions/DetermineDeploymentEnvironments/DetermineDeploymentEnvironments.ps1 index 129dd69c0..5f1fc502e 100644 --- a/Actions/DetermineDeploymentEnvironments/DetermineDeploymentEnvironments.ps1 +++ b/Actions/DetermineDeploymentEnvironments/DetermineDeploymentEnvironments.ps1 @@ -65,7 +65,7 @@ Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "GenerateALDocArtifac Write-Host "GenerateALDocArtifact=$([int]$generateALDocArtifact)" $deployToGitHubPages = $settings.alDoc.DeployToGitHubPages -if ($deployToGitHubPages) { +if ($generateALDocArtifact -and $deployToGitHubPages) { $deployToGitHubPages = IsGitHubPagesAvailable if (!$deployToGitHubPages) { Write-Host "::Warning::GitHub Pages is not available in this repository (or GitHub Pages is not set to use GitHub Actions). Go to Settings -> Pages and set Source to GitHub Actions" From c1152e177f3f7fdd13d76c3de64ef74c57a2f73a Mon Sep 17 00:00:00 2001 From: freddydk Date: Sun, 3 Dec 2023 11:33:00 +0100 Subject: [PATCH 224/235] workshop images --- Workshop/AddAnApp.md | 13 +++--- Workshop/AutomatedTests.md | 6 ++- Workshop/Dependencies2.md | 12 ++++-- Workshop/Projects.md | 87 +++++++++++++++++++++++++------------- Workshop/Releasing.md | 76 ++++++++++++++++++++++++--------- Workshop/Versioning.md | 65 +++++++++++++++++++--------- 6 files changed, 179 insertions(+), 80 deletions(-) diff --git a/Workshop/AddAnApp.md b/Workshop/AddAnApp.md index a269dcbf4..e0ff05eeb 100644 --- a/Workshop/AddAnApp.md +++ b/Workshop/AddAnApp.md @@ -14,6 +14,7 @@ Enter the following values in the form: | Name | Value | | :-- | :-- | +| Use workflow from | `Branch: main` | | Project name | `.` | | Name | `app1` | | Publisher | `` | @@ -27,28 +28,28 @@ Enter the following values in the form: Wait a few minutes until the workflow completes and click **Pull requests** to see that there is a Pull request open for review. -| ![image](https://github.com/microsoft/AL-Go/assets/10775043/b1dd7d78-d8e0-4d19-99bf-8a555a076071) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/295d2d32-1101-4471-af30-9192e63c1a3d) | |-| Open the **Pull request** and click **Files changed** to see what the Pull request will add to your repository. -| ![image](https://github.com/microsoft/AL-Go/assets/10775043/af9ffee2-ebae-46b0-ae81-6bffb51ddd08) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/79081ae2-2d98-41e0-9abd-25e5da4cfec8) | |-| -The changes made by the workflow includes adding the new app path to the **al.code-workspace**, and adding an app folder with **app.json**, **HelloWorld.al** (sample code) and **.vscode/launch.json**. +> [!NOTE] The changes made by the workflow includes adding the new app path to the **al.code-workspace**, and adding an app folder with **app.json**, **HelloWorld.al** (sample code) and **.vscode/launch.json**. The **Create a new app** workflow doesn't do anything else than just adding these changes, no magic behind the scenes. Select **Conversation** and merge the pull request by clicking **Merge the pull request**, **Confirm merge** and then delete the temporary branch created for the pull request, by clicking **Delete branch**. Select **Actions** and see that a merge commit workflow was kicked off: -| ![image](https://github.com/microsoft/AL-Go/assets/10775043/b4cc814a-6ed4-4730-ab53-81a88a4b54b3) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/80b1c400-7ce2-4511-a9e2-febb7da9f171) | |-| When the merge commit is **done**, click the workflow line and **scroll down** to see the artifacts created by this build: -| ![image](https://github.com/microsoft/AL-Go/assets/10775043/09b8013e-0cd7-46f7-b45c-a4dcaccfb788) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/ba90341f-75f5-47f3-be7f-b00e49e4ba19) | |-| -Note that my artifacts are created with version **1.0.2.0** - that might not be the same in your repository. +> [!NOTE] My artifacts are created with version **1.0.4.0** - that might not be the same in your repository. Let's talk about versioning and naming... diff --git a/Workshop/AutomatedTests.md b/Workshop/AutomatedTests.md index c293861bb..851c171af 100644 --- a/Workshop/AutomatedTests.md +++ b/Workshop/AutomatedTests.md @@ -26,12 +26,14 @@ Now select **Actions** and locate the **Create a new test app** action and click | Name | Value | | :-- | :-- | +| Use workflow from | `Branch: main` | | Project name | `.` | | Name | `app1.test` | | Publisher | `` | | ID Range (from..to) | `70000..99999` | -| Include Sample Code | `yes` | -| Direct Commit | `no` | +| Include Sample Code | :ballot_box_with_check: | +| Direct Commit | :black_square_button: | +| Use GhTokenWorkflow | :black_square_button: | | ![image](https://github.com/microsoft/AL-Go/assets/10775043/eab3a42e-a73c-4c13-bc05-7cc2c7a4b05e) | |-| diff --git a/Workshop/Dependencies2.md b/Workshop/Dependencies2.md index 8029cbfe4..f26bd046e 100644 --- a/Workshop/Dependencies2.md +++ b/Workshop/Dependencies2.md @@ -12,23 +12,27 @@ Create 2 apps within the repository using the **Create a new app** workflow call | Name | Value | | :-- | :-- | +| Use workflow from | `Branch: main` | | Project name | `.` | | Name | `Common` | | Publisher | `` | | ID Range (from..to) | `60000..60099` | -| Include Sample Code | `no` | -| Direct Commit | `yes` | +| Include Sample Code | :black_square_button: | +| Direct Commit | :ballot_box_with_check: | +| Use GhTokenWorkflow | :black_square_button: | and | Name | Value | | :-- | :-- | +| Use workflow from | `Branch: main` | | Project name | `.` | | Name | `Licensing` | | Publisher | `` | | ID Range (from..to) | `60100..60199` | -| Include Sample Code | `no` | -| Direct Commit | `yes` | +| Include Sample Code | :black_square_button: | +| Direct Commit | :ballot_box_with_check: | +| Use GhTokenWorkflow | :black_square_button: | Leaving out the sample code in order to avoid name clashes. diff --git a/Workshop/Projects.md b/Workshop/Projects.md index 0eb2eab8c..6b90ca7a6 100644 --- a/Workshop/Projects.md +++ b/Workshop/Projects.md @@ -25,34 +25,36 @@ A multi-project repository could look like this: ![image](https://user-images.githubusercontent.com/10775043/231688802-4d08e4f2-6bbc-4677-902b-0bef9ed068d8.png) -So, let's setup a multi-project repository like this. Navigate to **https://aka.ms/algopte** to create a new repository. Click **Use this template** and select **Create a new repository**. Select your **organization** as owner, specify a **name** and select **Public**. +So, let's setup a multi-project repository like this. Navigate to **https://aka.ms/algopte** to create a new repository. Click **Use this template** and select **Create a new repository**. Select your **organization** as owner, specify a **name**,select **Public** and click **Create repository**. -| ![image](https://github.com/microsoft/AL-Go/assets/10775043/7e66ca01-0850-4031-8b80-616ee819ebde) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/ecbdaa03-1cd2-4043-8ec0-a7f4d87bb819) | |-| -You can locate the **Create a new app** workflow in the list of workflows and run it with the following parameters: +Locate the **Create a new app** workflow in the list of workflows and run it with the following parameters: | Name | Value | | :-- | :-- | +| Use workflow from | `Branch: main` | | Project name | `US` | | Name | `mysolution.us` | | Publisher | `` | | ID Range (from..to) | `50000..50100` | -| Include Sample Code | `yes` | -| Direct Commit | `no` | +| Include Sample Code | :ballot_box_with_check: | +| Direct Commit | :black_square_button: | +| Use GhTokenWorkflow | :black_square_button: | -| ![image](https://github.com/microsoft/AL-Go/assets/10775043/04f69e2c-de5f-45ae-89fc-48c543d14c60) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/683a4ebd-364a-4373-81f9-512faa195391) | |-| When the **Create a new app in [main]** workflow has completed, select **Pull requests**, click the **New PTE** pull request and select **Files changed** to inspect what changes was done to the repo: -| ![image](https://github.com/microsoft/AL-Go/assets/10775043/8db3c739-674f-4172-9c92-52c6a0edadb3) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/557661dd-587f-43cc-8ff8-d71a38a55638) | |-| -Notice that: -1. The .AL-Go folder was moved from the root of the repo and into the US folder. -2. A new US.code-workspace was created as a workspace for this project -3. An app was added under the US folder called mysolution.us +> [!NOTE] +> 1. The .AL-Go folder was moved from the root of the repo and into the US folder. +> 2. A new US.code-workspace was created as a workspace for this project +> 3. An app was added under the US folder called mysolution.us Go ahead click **Conversation**, **merge the pull request** and **delete** the temporary branch. @@ -60,23 +62,27 @@ You don't have to wait for the **CI/CD workflow** to complete, just go ahead and | Name | Value | | :-- | :-- | +| Use workflow from | `Branch: main` | | Project name | `DK` | | Name | `mysolution.dk` | | Publisher | `` | | ID Range (from..to) | `51000..51100` | -| Include Sample Code | `yes` | -| Direct Commit | `no` | +| Include Sample Code | :ballot_box_with_check: | +| Direct Commit | :black_square_button: | +| Use GhTokenWorkflow | :black_square_button: | and run the same workflow again with these parameters: | Name | Value | | :-- | :-- | +| Use workflow from | `Branch: main` | | Project name | `W1` | | Name | `mysolution.w1` | | Publisher | `` | | ID Range (from..to) | `52000..52100` | -| Include Sample Code | `yes` | -| Direct Commit | `no` | +| Include Sample Code | :ballot_box_with_check: | +| Direct Commit | :black_square_button: | +| Use GhTokenWorkflow | :black_square_button: | When the **New PTE (mysolution.dk)** and **New PTE (mysolution.w1)** pull requests are created, merge both pull request and delete the temporary branches. @@ -84,28 +90,29 @@ Now select Actions and see that a number of workflows have been kicked off. Some Click the latest CI/CD commit workflow and notice the 3 jobs (you can expand the jobs by clicking show all jobs): -| ![image](https://github.com/microsoft/AL-Go/assets/10775043/19707351-d77c-4a46-8082-c0fcf6f7fc3a) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/bae168e5-bc9e-4f32-9ac8-05a4b94a4a41) | |-| -At this time, all apps will be using US as localization and use the same Business Central version as we entered when setting up prerequisites. +> [!NOTE] At this time, all apps will be using US as localization and use the same Business Central version as we entered when setting up prerequisites, but you can change this in the settings file for each individual project. After the build completes, you can inspect the artifacts created from this multi-project repository, by clicking Summary and scrolling down: -| ![image](https://github.com/microsoft/AL-Go/assets/10775043/aad8cbed-26ba-4155-8d3f-55aa14655a7c) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/60973d66-bf60-4b38-9776-fa720fbd3e52) | |-| -DK, US and W1 all have an artifact of the type **Apps** generated, but they are wrong, since they are all build using the US localization. We need **DK** to be build using the danish localization and **W1** using W1. +DK, US and W1 all have an artifact of the type **Apps** generated, but as already stated, they are all build using the US localization. We need **DK** to be build using the Danish localization and **W1** using W1. -Note also the CheckForUpdates annotation. AL-Go says that there are system files updates. This is because when creating a new project, AL-Go will (at the next system file update) place scripts in the .AL-Go folder for creating local and cloud development environments. +> [!NOTE] The CheckForUpdates annotation. +> AL-Go says that there are system files updates. This is because when creating a new project, AL-Go will (at the next system file update) place scripts in the .AL-Go folder for creating local and cloud development environments. -Before running **Update AL-Go System Files** however, let's make some changes to the repository and we will do this from VS Code. Select **Code** and click the **Code** dropdown to copy the GIT URL for the repo: +Before running **Update AL-Go System Files** however, let's make some changes to the repository and we will do this from VS Code. Select **Code** and click the **Copy** button to copy the GIT URL for the repo: -| ![image](https://github.com/microsoft/AL-Go/assets/10775043/d169c50a-ccc6-4236-8816-bde96036beae) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/b5d0ce1b-084b-44b6-bccc-a486f7a72ecc) | |-| Open **VS Code** and run **Git Clone** to clone your repository to your local machine: -| ![image](https://github.com/microsoft/AL-Go/assets/10775043/ce2c8991-a371-4fd8-9c0e-05854f885cbc) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/a911144c-fad7-4c18-bdad-2332aa74df5f) | |-| Open the repository (do not open the workspace) and perform the following changes: @@ -118,21 +125,43 @@ Open the repository (do not open the workspace) and perform the following change - in **W1/.AL-Go/settings.json**, change **country** to **"w1"** - in **W1/mysolution.w1/HelloWorld.al**, add W1 to the pageextension name (i.e. CustomerListExt to **CustomerListExtW1**) -**Stage the changes** in **VS Code**, **Commit** the changes and **Sync**. Wait for the **CI/CD** workflow to complete: +**Stage the changes** in **VS Code**, **Commit** the changes and **Sync**. -| ![image](https://github.com/microsoft/AL-Go/assets/10775043/99eb407c-497b-428a-a376-6e5cdb6f3db6) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/5ae5b03a-bc15-45b2-89d9-d96468755879) | |-| -Now, we can create a release and inspect that. Run the **Create release** workflow and release v1.0 like this: +In GitHub, wait for the **CI/CD** workflow to complete: -| ![image](https://github.com/microsoft/AL-Go/assets/10775043/541bd90c-b60b-485f-9c10-c7947cfaaade) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/87d64b0e-a930-4cfc-80d7-e3e8769a50d4) | |-| -After this is done, select **Code** and click the newly created release to see the artifacts. In the auto generated release notes, you will see all merged Pull Requests under **What's Changed** and by clicking the **Full Changelog** link you will find all commits. +Now, we can create a release and inspect that. Run the **Create release** workflow and release v1.0 with these parameters: -| ![image](https://github.com/microsoft/AL-Go/assets/10775043/446616b6-a464-4721-bd58-08270a18e3f8) | +| Name | Value | +| :-- | :-- | +| Use workflow from | `Branch: main` | +| App version | `latest` | +| Name of this release | `v1.0` | +| Tag of this release | `1.0.0` | +| Prerelease | :black_square_button: | +| Draft | :black_square_button: | +| Create Release Branch | :black_square_button: | +| New Version Number | `+0.1` | +| Direct Commit | :black_square_button: | +| Use GhTokenWorkflow | :black_square_button: | + +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/9b69803c-8133-47ef-a9a8-f1681a988907) | |-| +After this is done, select **Code** and click the newly created release to see the artifacts. + +> [!NOTE] In the auto generated release notes, you will see all merged Pull Requests under **What's Changed** and by clicking the **Full Changelog** link you will find all commits. + +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/15c67508-33c1-4592-a227-05262651dcd6) | +|-| + +You will see that every project has it's own release artifact. + OK - so that's fine, but normally in a solution like this, DK and US have a dependency on W1 or a common app - you don't have all code duplicated 3 times - how does AL-Go handle dependencies? --- diff --git a/Workshop/Releasing.md b/Workshop/Releasing.md index 28e201613..2db25ffe0 100644 --- a/Workshop/Releasing.md +++ b/Workshop/Releasing.md @@ -14,64 +14,100 @@ Select **Actions**, select the **Create Release** workflow and click **Run workf | Name | Value | | :-- | :-- | +| Use workflow from | `Branch: main` | | App version | `latest` | | Name of this release | `v1.0` | | Tag of this release | `1.0.4` | -| Prerelease | `no` | -| Draft | `no` | -| Create Release Branch | `yes` | +| Prerelease | :black_square_button: | +| Draft | :black_square_button: | +| Create Release Branch | :ballot_box_with_check: | | New Version Number | `+1.0` | -| Direct Commit | `no` | +| Direct Commit | :black_square_button: | +| Use GhTokenWorkflow | :black_square_button: | + +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/8ae1628e-0368-4af3-8c01-16e3e8a62917) | +|-| After completion of the **Create release** workflow, you can select **Code** and see that you have 1 release: -![image](https://user-images.githubusercontent.com/10775043/231591177-d2a85451-a717-4f87-a2ae-55e26c19a17f.png) +![image](https://github.com/microsoft/AL-Go/assets/10775043/c23b0d4f-9476-462d-ace6-788337164f88) Also, you have a Pull request waiting, which increments version number by 1.0. -| ![image](https://github.com/microsoft/AL-Go/assets/10775043/3955d853-fc6a-447a-a5e0-8a56983462d2) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/83c9ea64-f3df-4bd1-8fd1-5a2b2c85e9e2) | |-| **Merge the Pull request**, **delete the temporary branch** and select **Actions** to see that a Merge Pull request was kicked off. -| ![image](https://github.com/microsoft/AL-Go/assets/10775043/96ff7600-ec05-411f-9335-aa389feabbd7) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/79704699-7cd4-4589-a7ff-d7a98cd29cca) | |-| -Inspecting the build from the Pull request, you will see that the artifacts are now **2.0.5.0**, **app1** is **2.2.5.0** and **app2** is **2.0.5.0**. +Inspecting the build from the Pull request, you will see that the artifacts are now **2.0.7.0**, **app1** is **2.2.7.0** and **app2** is **2.0.7.0** (in my repository) -| ![image](https://github.com/microsoft/AL-Go/assets/10775043/d5382e5d-ac65-44f2-bb58-69b148764e1a) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/22d28d32-b826-450f-af6c-77982235b57d) | |-| -And all subsequent builds from main will now be 2.x. You will also see that the annotation stating that **No previous release found** has now gone. -All builds from main will use the latest release version for upgrade testing. Inspecting the build step in the workflow, reveals that AL-Go for GitHub was able to locate the previous release +> [!NOTE] All subsequent builds from main will now be 2.x. You will also see that the annotation stating that **No previous release found** has now gone and all builds from main will use the latest release version for upgrade testing. -| ![image](https://github.com/microsoft/AL-Go/assets/10775043/2d404467-9311-4cc4-97fc-99961c29f7d0) | +Inspecting the **build** step in the workflow, reveals that AL-Go for GitHub was able to locate the previous release + +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/0b6cdefb-c379-4392-b11c-b714f19f75fb) | |-| -Now, if you at some point in time need to create a hotfix for version **1.0.4**, you can simply select **Code** and switch to the release branch. +Now, if you at some point in time need to create a hotfix for version **1.0.6**, you can simply select **Code** and switch to the release branch. -| ![image](https://github.com/microsoft/AL-Go/assets/10775043/1169ef76-dd23-49c5-8f02-098021f8951e) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/e4a3b1fd-9c66-4558-aa6a-48b410e26cc9) | |-| -Now you can navigate to the **HelloWorld.al** file in the **app2** app, make a **simple change** and **commit the changes**. +In the release branch, navigate to the **HelloWorld.al** file in the **app2** app, make a simple change and commit the changes directory to the release branch -| ![image](https://github.com/microsoft/AL-Go/assets/10775043/0e44c89b-041e-4260-abe0-cbf9bb59affa) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/addda836-1cd4-478d-b33a-f62f46084851) | |-| Select **Actions** and see that a build was kicked off in the release branch. -| ![image](https://github.com/microsoft/AL-Go/assets/10775043/06b8e92b-21e7-424c-9208-e17722feeb15) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/5ae406bc-31e0-4433-ac5d-f9d3b12f7668) | |-| -This version will use the **latest released build**, which has a version number lower than the one you are building as previous release and will use the version numbers from the release branch for versioning. +> [!NOTE] This build will use the latest released build, which has a version number lower than the one you are building as previous release and will use the version numbers from the release branch for versioning. After the build is completed, you will need to release this new build in order for subsequent CI/CD builds from main to see the new bits as a release. The artifacts in the hotfix build looks like this: -| ![image](https://github.com/microsoft/AL-Go/assets/10775043/a53fbe6a-0ec3-4e2d-a5d6-fe89a9cb3fdd) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/54dda4c3-4510-4b48-8437-24a0bece09a1) | +|-| + +where the branch name main has been replaced by the release branch name and if you want to release this hotfix, you can run the **Create Release** and specify these parameters: + +| Name | Value | +| :-- | :-- | +| Use workflow from | `Branch: release/1.0.6` | +| App version | `latest` | +| Name of this release | `v1.0.8` | +| Tag of this release | `1.0.8` | +| Prerelease | :black_square_button: | +| Draft | :black_square_button: | +| Create Release Branch | :black_square_button: | +| New Version Number | | +| Direct Commit | :black_square_button: | +| Use GhTokenWorkflow | :black_square_button: | + +> [!NOTE] You must select to use workflow from the release branch. Else the create release workflow cannot locate the build in the release branch. +> In this case, we select to not create a new release branch. We can just create any future hotfixes from the existing release branch if needed. We can also always create a release branch from a release later. + +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/e65f7a48-8c4d-426f-a6c4-97bb0d14b34d) | +|-| + +After the release has been created we can (under Code) see that we have 2 releases: + +![image](https://github.com/microsoft/AL-Go/assets/10775043/ff0719ac-5510-4fca-9f54-10e19c3aaa4e) + +and clicking Releases will show the content of the releases: + +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/6e52727e-bff3-431c-88ac-264965ad911f) | |-| -where the branch name main has been replaced by the release branch name. +> [!NOTE] GitHub sorts the releases after the tag and sorting only works correctly if the tag is SemVer compatible (i.e. 3 tuples). This is the reason why AL-Go for GitHub forces you to enter a SemVer compatible version number in the tag when creating a new release. OK, so that is clear, versioning and releasing, pretty smart - but what is this project concept? diff --git a/Workshop/Versioning.md b/Workshop/Versioning.md index f724b2126..3dad2b277 100644 --- a/Workshop/Versioning.md +++ b/Workshop/Versioning.md @@ -1,10 +1,10 @@ # Versioning Understanding how AL-Go for GitHub is doing **versioning** and **naming** is important for your day to day use of AL-Go for GitHub. -As we saw earlier, the **artifacts** from the first successful build in my repository was called version **repo1-main-Apps-1.0.2.0**. +As we saw earlier, the **artifacts** from the first successful build in my repository was called version **repo1-main-Apps-1.0.4.0**. Downloading the artifact and unpacking reveals the app inside. The app inside is using the same naming strategy as VS Code: `__` -| ![image](https://github.com/microsoft/AL-Go/assets/10775043/a74da044-e6c4-4d96-8f75-6fbfa1bddaa2) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/907ff953-6496-46ff-b3bc-fc934da7bb50) | |-| Here, the app has the same version number as the artifact, but is it always like that? @@ -15,50 +15,77 @@ As you know, the build number consists of 4 tuples: **major.minor.build.revision - The **build** tuple is (by default) the GITHUB_RUN_NUMBER, which is a unique number for each time the CI/CD workflow is run, starting with 1. - The **revision** typle is (by default) the GITHUB_RUN_ATTEMPT, which is the number of attempts, starting with 0. In my example above, I did re-run the CI/CD workflow once to end up with .1. -In order to better understand this, select **Code** and navigate to the **app.json** file under the **app1** folder. Edit the file and change the version number to **1.2.5.6**. +In order to better understand this, select **Code** and navigate to the **app.json** file under the **app1** folder. Edit the file and change the version number to **1.2.3.4**. -| ![image](https://github.com/microsoft/AL-Go/assets/10775043/5c758cf1-6f52-4814-81ad-0c506e63324c) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/df24b30b-df74-4def-9134-49f8bc8e13f1) | |-| **Commit** the changes directly, select **Actions** and wait for the build to complete. -| ![image](https://github.com/microsoft/AL-Go/assets/10775043/912a32fa-6ca8-4ef0-8e38-cfded6eee44d) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/c2c45e8d-aeb0-4da1-8b23-85eee843a25a) | |-| -Select the **Update app.json** workflow, **scroll down** to the artifacts and **download** the new apps artifact. +Select the **Update app.json** workflow, **scroll down** to the artifacts and **download** the new apps artifact and open it. -| ![image](https://github.com/microsoft/AL-Go/assets/10775043/e1df08a6-5516-4923-abe9-fee93f315ff0) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/f5009c5f-2cf6-45ec-9de5-c7473722e092) | |-| -Now the project (in this case the repository), which really is a collection of apps, is still version **1.0** (RepoVersion never changed - is still 1.0 = default) and **app1** is **1.2** (major and minor from app.json). Build is **3** (3rd build) and revision is still **0**. +> [!NOTE] The project (in this case the repository), which really is a collection of apps, is still version **1.0** (RepoVersion never changed - is still 1.0 = default) and **app1** is **1.2** (major and minor from app.json). Build is **5** (5th build in my repo) and revision is still **0**. Scroll back up, locate the **Re-run all jobs** button and click it. Wait for the **2nd attempt** to complete and inspect the artifact for the re-run. -| ![image](https://github.com/microsoft/AL-Go/assets/10775043/4e4df417-e257-4a61-bc07-666f98413be1) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/4a20ed83-8fb7-4a0a-b030-e1c1cb392a27) | |-| -Now revision became **1** as we had another attempt at building the app. +Now revision became **1** as we had a 2nd attempt at building the app. -Next, let's create another app, by running the **Create a new app** workflow again in the same repo. **app2** with ID range **56000..56100** and enter **Y** in **Direct COMMIT**. +Next, let's create another app, by running the **Create a new app** workflow again in the same repo and specify: -| ![image](https://github.com/microsoft/AL-Go/assets/10775043/06d4a03c-f025-44d6-a317-b2a0a79f7e8e) | +| Name | Value | +| :-- | :-- | +| Use workflow from | `Branch: main` | +| Project name | `.` | +| Name | `app2` | +| Publisher | `` | +| ID Range (from..to) | `56000..56100` | +| Include Sample Code | :ballot_box_with_check: | +| Direct Commit | :ballot_box_with_check: | +| Use GhTokenWorkflow | :black_square_button: | + +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/fc7e3131-8ac3-4054-a131-c4e8da023fec) | |-| -When the **Create a new app** workflow is done, navigate to Code and modify the name of the object in the **HelloWorld.al** file to **CustomerListExt2**. This will kick off another CI/CD workflow. When the workflow is complete, download and inspect the artifacts generated +When the **Create a new app** workflow is done, navigate to Code and modify the name of the object in the **app2/HelloWorld.al** file to **CustomerListExt2**. This will kick off another CI/CD workflow. + +> [!NOTE] You might wonder why the **Create a new app** workflow with direct commit didn't kick off a new CI/CD build. This is due to a GitHub security feature that one workflow cannot by default kick off another workflow. Checking the **Use GhTokenWorkflow for PR/Commit** checkbox will allow GitHub to run CI/CD from the workflow. + + When the CI/CD workflow is complete, download and inspect the artifacts generated -| ![image](https://github.com/microsoft/AL-Go/assets/10775043/d654b75c-2e63-4bd3-a39a-dce6bf835c30) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/54d8ea19-d17e-4538-917f-661a921d474b) | |-| -**App2** still has version **1.0** in **app.json**, hence the **1.0.4.0** version number. +**App2** still has version **1.0** in **app.json**, hence the **1.0.6.0** version number. -If we want to increment the version number of the project and all apps, you can run the **Increment Version Number** workflow, and keep the **N** in **Direct COMMIT**. +If we want to increment the version number of the project and all apps, you can run the **Increment Version Number** workflow and specify the following values -| ![image](https://github.com/microsoft/AL-Go/assets/10775043/d9da5fcc-3e57-42b1-92b4-23d17ccfbbf9) | +| Name | Value | +| :-- | :-- | +| Use workflow from | `Branch: main` | +| Project name patterns | `*` | +| Updated Version Number | `+0.1` | +| Direct Commit | :black_square_button: | +| Use GhTokenWorkflow | :black_square_button: | + +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/dbba8aa8-6a8b-446d-8bac-42b07dc79c36) | |-| -Specifying **+0.1** will add 1 to the minor version of all apps and to the repo version number. Wait for the workflow to complete, select **Pull requests** and select the **Increment Version Number by 0.1** Pull request and inspect what the workflow is trying to change for you. At this time, we will **NOT** merge the Pull request as changing version numbers like this is typically done during a release. +> [!NOTE] Specifying **+0.1** will add 1 to the minor version of all apps and to the repo version number, specifying **+1.0** will add 1 to the major version and if you specify **2.0** (without the +), it will set major.minor to 2.0 no matter what value was earlier set, but... you cannot set a version number, which is lower than was already set. + +Wait for the workflow to complete, select **Pull requests** and select the **Increment Version Number by 0.1** Pull request and inspect what the workflow is trying to change for you. + +At this time, we will **NOT** merge the Pull request as changing version numbers like this is typically done during a release. -| ![image](https://github.com/microsoft/AL-Go/assets/10775043/1b16ac1f-1717-4ea7-9bd0-b98e5df8bfe2) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/70f761c0-4ae6-42de-84ba-fe67d4a98264) | |-| Select **Conversation**, click **Close pull request** and **delete the branch**. From 14149350209fdf3abab0e20a8221b2aa4cff78b3 Mon Sep 17 00:00:00 2001 From: freddydk Date: Sun, 3 Dec 2023 11:37:27 +0100 Subject: [PATCH 225/235] note --- Workshop/AddAnApp.md | 6 ++++-- Workshop/Projects.md | 10 ++++++---- Workshop/Releasing.md | 12 ++++++++---- Workshop/Versioning.md | 9 ++++++--- 4 files changed, 24 insertions(+), 13 deletions(-) diff --git a/Workshop/AddAnApp.md b/Workshop/AddAnApp.md index e0ff05eeb..4e117c552 100644 --- a/Workshop/AddAnApp.md +++ b/Workshop/AddAnApp.md @@ -36,7 +36,8 @@ Open the **Pull request** and click **Files changed** to see what the Pull reque | ![image](https://github.com/microsoft/AL-Go/assets/10775043/79081ae2-2d98-41e0-9abd-25e5da4cfec8) | |-| -> [!NOTE] The changes made by the workflow includes adding the new app path to the **al.code-workspace**, and adding an app folder with **app.json**, **HelloWorld.al** (sample code) and **.vscode/launch.json**. +> [!NOTE] +> The changes made by the workflow includes adding the new app path to the **al.code-workspace**, and adding an app folder with **app.json**, **HelloWorld.al** (sample code) and **.vscode/launch.json**. The **Create a new app** workflow doesn't do anything else than just adding these changes, no magic behind the scenes. Select **Conversation** and merge the pull request by clicking **Merge the pull request**, **Confirm merge** and then delete the temporary branch created for the pull request, by clicking **Delete branch**. Select **Actions** and see that a merge commit workflow was kicked off: @@ -49,7 +50,8 @@ When the merge commit is **done**, click the workflow line and **scroll down** t | ![image](https://github.com/microsoft/AL-Go/assets/10775043/ba90341f-75f5-47f3-be7f-b00e49e4ba19) | |-| -> [!NOTE] My artifacts are created with version **1.0.4.0** - that might not be the same in your repository. +> [!NOTE] +> My artifacts are created with version **1.0.4.0** - that might not be the same in your repository. Let's talk about versioning and naming... diff --git a/Workshop/Projects.md b/Workshop/Projects.md index 6b90ca7a6..89f77b117 100644 --- a/Workshop/Projects.md +++ b/Workshop/Projects.md @@ -93,7 +93,8 @@ Click the latest CI/CD commit workflow and notice the 3 jobs (you can expand the | ![image](https://github.com/microsoft/AL-Go/assets/10775043/bae168e5-bc9e-4f32-9ac8-05a4b94a4a41) | |-| -> [!NOTE] At this time, all apps will be using US as localization and use the same Business Central version as we entered when setting up prerequisites, but you can change this in the settings file for each individual project. +> [!NOTE] +> At this time, all apps will be using US as localization and use the same Business Central version as we entered when setting up prerequisites, but you can change this in the settings file for each individual project. After the build completes, you can inspect the artifacts created from this multi-project repository, by clicking Summary and scrolling down: @@ -102,8 +103,8 @@ After the build completes, you can inspect the artifacts created from this multi DK, US and W1 all have an artifact of the type **Apps** generated, but as already stated, they are all build using the US localization. We need **DK** to be build using the Danish localization and **W1** using W1. -> [!NOTE] The CheckForUpdates annotation. -> AL-Go says that there are system files updates. This is because when creating a new project, AL-Go will (at the next system file update) place scripts in the .AL-Go folder for creating local and cloud development environments. +> [!NOTE] +> AL-Go states that there are system files updates (the CheckForUpdates annotation). This is because when creating a new project, AL-Go will (at the next system file update) place scripts in the .AL-Go folder for creating local and cloud development environments. Before running **Update AL-Go System Files** however, let's make some changes to the repository and we will do this from VS Code. Select **Code** and click the **Copy** button to copy the GIT URL for the repo: @@ -155,7 +156,8 @@ Now, we can create a release and inspect that. Run the **Create release** workfl After this is done, select **Code** and click the newly created release to see the artifacts. -> [!NOTE] In the auto generated release notes, you will see all merged Pull Requests under **What's Changed** and by clicking the **Full Changelog** link you will find all commits. +> [!NOTE] +> In the auto generated release notes, you will see all merged Pull Requests under **What's Changed** and by clicking the **Full Changelog** link you will find all commits. | ![image](https://github.com/microsoft/AL-Go/assets/10775043/15c67508-33c1-4592-a227-05262651dcd6) | |-| diff --git a/Workshop/Releasing.md b/Workshop/Releasing.md index 2db25ffe0..18c85c9a5 100644 --- a/Workshop/Releasing.md +++ b/Workshop/Releasing.md @@ -47,7 +47,8 @@ Inspecting the build from the Pull request, you will see that the artifacts are | ![image](https://github.com/microsoft/AL-Go/assets/10775043/22d28d32-b826-450f-af6c-77982235b57d) | |-| -> [!NOTE] All subsequent builds from main will now be 2.x. You will also see that the annotation stating that **No previous release found** has now gone and all builds from main will use the latest release version for upgrade testing. +> [!NOTE] +> All subsequent builds from main will now be 2.x. You will also see that the annotation stating that **No previous release found** has now gone and all builds from main will use the latest release version for upgrade testing. Inspecting the **build** step in the workflow, reveals that AL-Go for GitHub was able to locate the previous release @@ -69,7 +70,8 @@ Select **Actions** and see that a build was kicked off in the release branch. | ![image](https://github.com/microsoft/AL-Go/assets/10775043/5ae406bc-31e0-4433-ac5d-f9d3b12f7668) | |-| -> [!NOTE] This build will use the latest released build, which has a version number lower than the one you are building as previous release and will use the version numbers from the release branch for versioning. +> [!NOTE] +> This build will use the latest released build, which has a version number lower than the one you are building as previous release and will use the version numbers from the release branch for versioning. After the build is completed, you will need to release this new build in order for subsequent CI/CD builds from main to see the new bits as a release. The artifacts in the hotfix build looks like this: @@ -92,7 +94,8 @@ where the branch name main has been replaced by the release branch name and if y | Direct Commit | :black_square_button: | | Use GhTokenWorkflow | :black_square_button: | -> [!NOTE] You must select to use workflow from the release branch. Else the create release workflow cannot locate the build in the release branch. +> [!NOTE] +> You must select to use workflow from the release branch. Else the create release workflow cannot locate the build in the release branch. > In this case, we select to not create a new release branch. We can just create any future hotfixes from the existing release branch if needed. We can also always create a release branch from a release later. | ![image](https://github.com/microsoft/AL-Go/assets/10775043/e65f7a48-8c4d-426f-a6c4-97bb0d14b34d) | @@ -107,7 +110,8 @@ and clicking Releases will show the content of the releases: | ![image](https://github.com/microsoft/AL-Go/assets/10775043/6e52727e-bff3-431c-88ac-264965ad911f) | |-| -> [!NOTE] GitHub sorts the releases after the tag and sorting only works correctly if the tag is SemVer compatible (i.e. 3 tuples). This is the reason why AL-Go for GitHub forces you to enter a SemVer compatible version number in the tag when creating a new release. +> [!NOTE] +> GitHub sorts the releases after the tag and sorting only works correctly if the tag is SemVer compatible (i.e. 3 tuples). This is the reason why AL-Go for GitHub forces you to enter a SemVer compatible version number in the tag when creating a new release. OK, so that is clear, versioning and releasing, pretty smart - but what is this project concept? diff --git a/Workshop/Versioning.md b/Workshop/Versioning.md index 3dad2b277..a78de3687 100644 --- a/Workshop/Versioning.md +++ b/Workshop/Versioning.md @@ -30,7 +30,8 @@ Select the **Update app.json** workflow, **scroll down** to the artifacts and ** | ![image](https://github.com/microsoft/AL-Go/assets/10775043/f5009c5f-2cf6-45ec-9de5-c7473722e092) | |-| -> [!NOTE] The project (in this case the repository), which really is a collection of apps, is still version **1.0** (RepoVersion never changed - is still 1.0 = default) and **app1** is **1.2** (major and minor from app.json). Build is **5** (5th build in my repo) and revision is still **0**. +> [!NOTE] +> The project (in this case the repository), which really is a collection of apps, is still version **1.0** (RepoVersion never changed - is still 1.0 = default) and **app1** is **1.2** (major and minor from app.json). Build is **5** (5th build in my repo) and revision is still **0**. Scroll back up, locate the **Re-run all jobs** button and click it. Wait for the **2nd attempt** to complete and inspect the artifact for the re-run. @@ -57,7 +58,8 @@ Next, let's create another app, by running the **Create a new app** workflow aga When the **Create a new app** workflow is done, navigate to Code and modify the name of the object in the **app2/HelloWorld.al** file to **CustomerListExt2**. This will kick off another CI/CD workflow. -> [!NOTE] You might wonder why the **Create a new app** workflow with direct commit didn't kick off a new CI/CD build. This is due to a GitHub security feature that one workflow cannot by default kick off another workflow. Checking the **Use GhTokenWorkflow for PR/Commit** checkbox will allow GitHub to run CI/CD from the workflow. +> [!NOTE] +> You might wonder why the **Create a new app** workflow with direct commit didn't kick off a new CI/CD build. This is due to a GitHub security feature that one workflow cannot by default kick off another workflow. Checking the **Use GhTokenWorkflow for PR/Commit** checkbox will allow GitHub to run CI/CD from the workflow. When the CI/CD workflow is complete, download and inspect the artifacts generated @@ -79,7 +81,8 @@ If we want to increment the version number of the project and all apps, you can | ![image](https://github.com/microsoft/AL-Go/assets/10775043/dbba8aa8-6a8b-446d-8bac-42b07dc79c36) | |-| -> [!NOTE] Specifying **+0.1** will add 1 to the minor version of all apps and to the repo version number, specifying **+1.0** will add 1 to the major version and if you specify **2.0** (without the +), it will set major.minor to 2.0 no matter what value was earlier set, but... you cannot set a version number, which is lower than was already set. +> [!NOTE] +> Specifying **+0.1** will add 1 to the minor version of all apps and to the repo version number, specifying **+1.0** will add 1 to the major version and if you specify **2.0** (without the +), it will set major.minor to 2.0 no matter what value was earlier set, but... you cannot set a version number, which is lower than was already set. Wait for the workflow to complete, select **Pull requests** and select the **Increment Version Number by 0.1** Pull request and inspect what the workflow is trying to change for you. From e3fc948f38229fe65ce1ebe059077a55bed02766 Mon Sep 17 00:00:00 2001 From: freddydk Date: Sun, 3 Dec 2023 14:50:27 +0100 Subject: [PATCH 226/235] workshop --- Workshop/Dependencies1.md | 48 +++++++++++++++++++++------------------ Workshop/Dependencies2.md | 2 +- Workshop/Dependencies3.md | 4 +++- 3 files changed, 30 insertions(+), 24 deletions(-) diff --git a/Workshop/Dependencies1.md b/Workshop/Dependencies1.md index 82077af30..76aa55781 100644 --- a/Workshop/Dependencies1.md +++ b/Workshop/Dependencies1.md @@ -1,61 +1,64 @@ -# Dependencies to a project in the same repository +# Dependencies #1 - Dependencies to a project in the same repository Dependencies is a BIG topic, which is why it is handled in multiple sections in this workshop. -In general, dependencies between apps in the same repository are handled 100% automatically. AL-Go for GitHub will determine the order in which apps within the same project need to be built, and will use the apps built to satisfy dependencies from other apps. You only need to add your dependencies in app.json and you are good to go. +In general, dependencies between apps in the same project are handled 100% automatically. AL-Go for GitHub will determine the order in which apps within the same project need to be built, and will use the apps built to satisfy dependencies from other apps. + +This means that in a single project repository, you only need to add your dependencies in app.json and you are good to go. This topic describes two ways to handle dependencies to apps within another project in the same repository. In the MySolution example from the multi-project sample [here](Projects.md), we could have a dependency from the DK and US apps to the W1 app. ## useProjectDependencies -Let's go ahead and add the dependencies and see what happens. Grab the **id**, **name**, **publisher** and **version** from the **mysolution.w1** app.json and use them to add a dependency to that app into **mysolution.dk** and **mysolution.us**. -| ![image](https://github.com/microsoft/AL-Go/assets/10775043/a1627453-c7c6-4877-bec7-ea322f9339dd) | +Let's go ahead and add the dependencies and see what happens. Grab the **id**, **name**, **publisher** and **version** from the **mysolution.w1/app.json** and use them to add a dependency to that app into **mysolution.dk/app.json** and **mysolution.us/app.json**. + +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/ecab7ae7-f113-4df4-999e-d5cad6baac63) | |-| **Stage** your changes, **Commit** them and **Sync** your changes. Another **CI/CD** workflow will be kicked off. Two of the jobs (the DK and the US apps) should fail fairly quickly as AL-Go cannot find the W1 app dependency anywhere. -| ![image](https://github.com/microsoft/AL-Go/assets/10775043/9bcfaa43-64ea-4e07-9505-ad1bd463c97c) | -|-| - -At this time, the error message displayed in the annotations isn't very clear - we will fix that. If you drill into the failing workflow and into the compile step, you will find the real error: - -| ![image](https://github.com/microsoft/AL-Go/assets/10775043/23685295-5ce3-4b08-8850-f342407316ea) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/66230407-bbdd-4b30-bf89-6ebdcbe9d3a2) | |-| It cannot find the mysolution.w1 app on which the two other apps depend, but we kind of knew that. -The recommended solution to this problem is to set a repository setting called **useProjectDependencies** to **true** and then run Update AL-Go System files. +The recommended solution to this problem is to set a repository setting called **useProjectDependencies** to **true** and then run Update AL-Go System Files. + Repository settings are in **.github/AL-Go-Settings.json** -| ![image](https://github.com/microsoft/AL-Go/assets/10775043/627a68a3-2d0e-4525-a7ff-88f901d786c0) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/eb63bb7d-e830-4abd-9158-1ad01e8e9c5e) | |-| Changing the settings file will kick off another build, which also will fail. -To address that failure, select **Actions**, select **Update AL-Go System Files** and click **Run workflow**. No need to change any parameters, just run the workflow. +Now, select **Actions**, select **Update AL-Go System Files** and click **Run workflow**. No need to change any parameters, just run the workflow. Looking at the **Pull request** created by the **Update AL-Go System Files** workflow, we can see that all build workflows have been changed and now ínclude a **workflowDepth: 2** (instead of 1). -| ![image](https://github.com/microsoft/AL-Go/assets/10775043/12758ae3-2e11-46ee-ae09-9bc186887e84) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/f63124b5-0f16-4da1-b6e4-208da617c1a7) | |-| **Merge** the Pull request, **confirm** the merge and **delete** the temporary branch. Open the latest merge commit and see that the structure of the **CI/CD** workflow has changed. Now it builds the W1 project first and dependencies from the apps DK or US that are found in W1 will be automatically located. -| ![image](https://github.com/microsoft/AL-Go/assets/10775043/5edbc124-9d09-4cad-9d1b-da4257ea065b) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/22328924-3c49-4295-bf5d-32cf3509241c) | |-| +> [!NOTE] +> It isn't necessary to update AL-Go System files every time you change or add dependencies, but you will need to run the upgrade code every time you change the workflow dependency depth. + Looking at the artifacts produced by the build, we can see -| ![image](https://github.com/microsoft/AL-Go/assets/10775043/b3d1e1aa-356a-405e-8001-07214cc3d71d) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/97f24f75-7483-4ec6-a1d9-7fff2bacab80) | |-| -The **thisbuild** artifacts are shortlived - they are only there so that **depending projects** can find build artifacts from other jobs in the same workflow. +> [!NOTE] +> The **thisbuild** artifacts are shortlived - they are only there so that **depending projects** can find build artifacts from other jobs in the same workflow. ## include The other mechanism is to *include* the dependency projects in the project we are building. This is done by using the project setting **appDependencyProbingPaths**, which specifies where to search for dependencies in general. -If you already set up **useProjectDependencies**, please remove this setting from **.github/AL-Go-Settings.json** and run **Update AL-Go System Files** to get back to a situation where AL-Go cannot locate the **mysolution.w1** dependency. +If you already set up **useProjectDependencies**, please remove this setting from **.github/AL-Go-Settings.json**. You don't need to run **Update AL-Go System Files** before building, but you will be notified to do so when building. Now, modify **DK/.AL-Go/settings.json** and **US/.AL-Go/settings.json** by adding this property @@ -71,20 +74,21 @@ Now, modify **DK/.AL-Go/settings.json** and **US/.AL-Go/settings.json** by addin Specifying a **"."** in **repo**, means to search in the same repository for the depdency. **Release_status** **include** means that AL-Go will include the actual source from the dependent project instead of downloading just a specific build. **Stage** the changes, **Commit** them, and **Sync**. -| ![image](https://github.com/microsoft/AL-Go/assets/10775043/27fdeee6-3f5e-4d16-a4c9-e34001d2e26e) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/8d70b96d-2b6f-4cf0-80cc-a34dfdede60b) | |-| The **CI/CD** workflow runs again and you can observe that all the builds finish successfully. -| ![image](https://github.com/microsoft/AL-Go/assets/10775043/79aebe82-31b8-4b3b-a149-b75827035597) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/1b90eea9-258a-451e-9564-e31916ee550d) | |-| A look at the log reveals that it adds the **mysolution.w1** folder to the list of folders it needs to build for this job, as it checks **appDependencyProbingPaths**. -| ![image](https://github.com/microsoft/AL-Go/assets/10775043/54eb7e63-bd5c-425d-bf5b-792ffe608853) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/295a32fd-1048-44f1-975f-22a761040ba3) | |-| -**Note** that this implies that **mysolution.w1** will be compiled three times, and each project will contain its own copy of that app. The apps will be the same, but they will have different package IDs. +> [!NOTE] +> This implies that **mysolution.w1** will be compiled three times, and each project will contain its own copy of that app. The apps will be the same, but they will have different package IDs. --- [Index](Index.md)  [next](Dependencies2.md) diff --git a/Workshop/Dependencies2.md b/Workshop/Dependencies2.md index f26bd046e..debc12698 100644 --- a/Workshop/Dependencies2.md +++ b/Workshop/Dependencies2.md @@ -1,4 +1,4 @@ -# Dependencies to AL-Go projects in other repositories +# Dependencies #2 - Dependencies to AL-Go projects in other repositories Many partners have a set of common helper functions, tables and other things, which they reuse in other apps. With AL-Go for GitHub, the recommendation is to create a Common repository, which has one or more projects, which can be used in several of your other apps. diff --git a/Workshop/Dependencies3.md b/Workshop/Dependencies3.md index 07feb7c1f..2f3217fd1 100644 --- a/Workshop/Dependencies3.md +++ b/Workshop/Dependencies3.md @@ -1,6 +1,8 @@ -# Dependencies to other apps +# Dependencies #3 - Dependencies to third party apps Dependencies to apps from other partners... +TO:DO + With symbols, you can compile your app With runtime packages or the full .app file, you can also run tests From 4314ef718075e50e9fd2efd05eb8b742049d5f31 Mon Sep 17 00:00:00 2001 From: freddydk Date: Mon, 4 Dec 2023 12:06:56 +0100 Subject: [PATCH 227/235] check that githubPages should be included --- .../DetermineDeploymentEnvironments.ps1 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Actions/DetermineDeploymentEnvironments/DetermineDeploymentEnvironments.ps1 b/Actions/DetermineDeploymentEnvironments/DetermineDeploymentEnvironments.ps1 index 5f1fc502e..11d05593e 100644 --- a/Actions/DetermineDeploymentEnvironments/DetermineDeploymentEnvironments.ps1 +++ b/Actions/DetermineDeploymentEnvironments/DetermineDeploymentEnvironments.ps1 @@ -60,7 +60,8 @@ function Get-BranchesFromPolicy($ghEnvironment) { $settings = $env:Settings | ConvertFrom-Json | ConvertTo-HashTable -recurse -$generateALDocArtifact = ($type -eq 'Publish') -or $settings.alDoc.continuousDeployment +$includeGitHubPages = $getEnvironments.Split(',') | Where-Object { 'github-pages' -like $_ } +$generateALDocArtifact = ($includeGitHubPages) -and (($type -eq 'Publish') -or $settings.alDoc.continuousDeployment) Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "GenerateALDocArtifact=$([int]$generateALDocArtifact)" Write-Host "GenerateALDocArtifact=$([int]$generateALDocArtifact)" From e38c81e1285a06ebd0f68b46e85fcb12a8af1f0d Mon Sep 17 00:00:00 2001 From: freddydk Date: Mon, 4 Dec 2023 14:24:30 +0100 Subject: [PATCH 228/235] Workshop updates --- Workshop/AutomatedTests.md | 13 +++++-- Workshop/ContinuousDelivery.md | 21 +++++++--- Workshop/ContinuousDeployment.md | 23 ++++++----- Workshop/Dependencies1.md | 4 +- Workshop/Dependencies2.md | 67 +++++++++++++++++--------------- Workshop/PublishToProduction.md | 24 +++++++----- Workshop/ReferenceDoc.md | 18 ++++----- Workshop/ScheduledTestRuns.md | 14 ++++--- 8 files changed, 108 insertions(+), 76 deletions(-) diff --git a/Workshop/AutomatedTests.md b/Workshop/AutomatedTests.md index 851c171af..e56d01deb 100644 --- a/Workshop/AutomatedTests.md +++ b/Workshop/AutomatedTests.md @@ -19,7 +19,7 @@ So, navigate single-project repository, locate the .github/AL-Go-Settings.json f "doNotPublishApps": false ``` -| ![image](https://github.com/microsoft/AL-Go/assets/10775043/f94be356-0187-4add-9c3e-f3eaf1423cd8) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/3860cb67-67d6-4954-966d-df6923dbfe56) | |-| Now select **Actions** and locate the **Create a new test app** action and click **Run workflow** and use the following parameters: @@ -35,12 +35,17 @@ Now select **Actions** and locate the **Create a new test app** action and click | Direct Commit | :black_square_button: | | Use GhTokenWorkflow | :black_square_button: | -| ![image](https://github.com/microsoft/AL-Go/assets/10775043/eab3a42e-a73c-4c13-bc05-7cc2c7a4b05e) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/4e4d69e2-2b65-4ed0-b56b-91270d5a7410) | |-| -Inspect and **merge** the pull request. Now completion of the merge pull request **will be much slower than before**, as the GitHub hosted runners needs to download the Business Central Generic image and the artifacts every single time. When the workflow is done, you should see that below the artifacts produced by the **CI/CD** workflow, there is a summary field with the test results. +When the workflow is complete, inspect and **merge** the pull request. -| ![image](https://github.com/microsoft/AL-Go/assets/10775043/f0f570ae-bd2b-4f41-b3e0-a9bc406d9ad3) | +> [!NOTE] +> Completion of the merge pull request **will be much slower than before**, as the GitHub hosted runners needs to download the Business Central Generic image and the artifacts every single time. + +When the workflow is done, you should see that below the artifacts produced by the **CI/CD** workflow, there is a summary field with the test results. + +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/fb2aa04d-d75b-4651-8e4d-a7d76451a536) | |-| As already mentioned, running complete builds with full tests does take more time than containerless compiling. We are working on improving this. diff --git a/Workshop/ContinuousDelivery.md b/Workshop/ContinuousDelivery.md index 30d978723..afdcad3d0 100644 --- a/Workshop/ContinuousDelivery.md +++ b/Workshop/ContinuousDelivery.md @@ -13,7 +13,15 @@ This workshop has already described how to setup continuous delivery for GitHub ## Storage Setting up continuous delivery to a storage account is done in the same mechanism as we did with GitHub Packages. -Create an organizational secret called **StorageContext**. The format of the secret needs to be **compressed JSON**, containing 4 values: **storageAccountName**, **containerName**, **blobName** and either **storageAccountKey** or **sasToken**. Example: +In order to setup **continuous delivery** to a **storage account**, you need to have an Azure Account and setup a storage account in the **Azure Portal**. You can create a **blob container** with the name of the the calculated container (based on containerName in the StorageContext) or you can add a setting called **DeliverToStorage** in your repository settings gile (.github/AL-Go-Settings.json) with a property called **CreateContainerIfNotExist** set to true for auto generation of the blob container. + +```json + "DeliverToStorage": { + "CreateContainerIfNotExist": true + } +``` + +Now, create an organizational secret called **StorageContext**. The format of the secret needs to be **compressed JSON**, containing 4 values: **storageAccountName**, **containerName**, **blobName** and either **storageAccountKey** or **sasToken**. Example: ```json {"StorageAccountName":"accountnanme","StorageAccountKey":"HOaRhoNXXX==","containerName":"{project}","blobName":"{version}/{project}-{type}.zip"} @@ -27,29 +35,30 @@ or ContainerName and BlobName can contain placeholders, like {project}, {version} and {type} which will be replaced by the real values when delivering. -In order to setup **continuous delivery** to a **storage account**, you need to have an Azure Account and setup a storage account in the **Azure Portal**. You can create a **blob container** with the name of the the calculated container (based on containerName in the StorageContext) or you can add a setting called DeliverToStorage with a property called CreateContainerIfNotExist set to true for auto generation of the blob container. After this, create the secret value above manually or use the **New-ALGoStorageContext** from BcContainerHelper. +> [!NOTE] +> You can use the **BcContainerHelper** function **New-ALGoStorageContext** to assist in the correct format of the secret. | ![image](https://github.com/microsoft/AL-Go/assets/10775043/7287e068-b2d5-4fc2-b428-d0ddd4ffa0e3) | |-| Now create an organizational secret called **StorageContext** with the secret value. -| ![image](https://github.com/microsoft/AL-Go/assets/10775043/8631d67f-d772-43f5-bae3-a0f342f89fdd) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/3e5b4ddc-bff2-4cf5-9b2a-1a3696189eaf) | |-| and add the deliverToStorage setting to the ALGOORGSETTINGS organizational variable: -| ![image](https://github.com/microsoft/AL-Go/assets/10775043/9975ebbd-a98d-4bed-a57f-dae1c26546bd) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/6b7b4072-67d0-40b2-87ae-bfa2d130162b) | |-| When re-running **CI/CD** afterwards, you will see that continuous delivery is now setup for a storage account as well -| ![image](https://github.com/microsoft/AL-Go/assets/10775043/2ec22ccd-76fa-4705-8e64-6b16a5867934) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/def2c115-e8c2-46dd-a7f8-4f745a93c2fb) | |-| Checking the storage account using Storage Explorer reveals the new container and the new app. -| ![image](https://github.com/microsoft/AL-Go/assets/10775043/60db8d6e-7b4e-46cb-b426-aa1290b498aa) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/5b8317ca-64c2-4c10-9cf2-53bf61c4af07) | |-| ## AppSource diff --git a/Workshop/ContinuousDeployment.md b/Workshop/ContinuousDeployment.md index 7af7f2cc2..f34840d8b 100644 --- a/Workshop/ContinuousDeployment.md +++ b/Workshop/ContinuousDeployment.md @@ -2,17 +2,21 @@ Using Continuous Deployment you can deploy your apps to an online environment continuously. Much like with continuous delivery, you need to setup an authentication context and then you need to setup an environment. -The authentication context can use **impersonation** (which uses a **refreshtoken**, which typically is valid for **90** days) or **S2S** (which uses **ClientId** and **ClientSecret**, which needs to be **registered** inside your **Business Central Environment**. +> [!NOTE] +> The authentication context can use **impersonation** (which uses a **refreshtoken**, which typically is valid for **90** days) or **S2S** (which uses **ClientId** and **ClientSecret**, which needs to be **registered** inside your **Business Central Environment**. First thing we need to do is to create an **environment** in your **GitHub repository** with a name, which identifies your Business Central environment. Navigate to your single-project repository (**repo1**), select **Settings** -> **Environments** and click **New environment**. Enter a name for your Business Central environment and click **Configure environment** -| ![image](https://github.com/microsoft/AL-Go/assets/10775043/4076c014-2443-4cb1-837d-a85d436b596f) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/72dc1a40-bb14-4e2a-9d8a-35f36bf623a3) | |-| In the environment configuration screen, Click **Add secret** under **Environment secrets**. Create a secret called AUTHCONTEXT and use one of the two mechanisms described below to create the auth context value: +> [!NOTE] +> The Environments tab in repository **Settings** is only supported in **paid SKUs** of GitHub or for **public repositories**. It is possible to use repository or organizational secrets for authenticating to environments defined in **Settings**, as an alternative to using environment secrets as we have done here, but this is not part of this workshop. + After creating the environment and the AUTHCONTEXT secret, you should create a setting structure called DeployTo followed by your GitHub environment name. Read more about the DeployTo setting [here](https://aka.ms/algosettings#DeployTo)). If your actual Business Central environment has a different name than your GitHub environment, you can add an EnvironmentName property to the DeliverTo settings like: @@ -26,7 +30,7 @@ If your actual Business Central environment has a different name than your GitHu At this time, these settings cannot be added as environment variables, we might add this in the future. ## Creating an AUTHCONTEXT that uses impersonation -Easiest way to create an authentication context with impersonation for AL-Go for GitHub is to use the following PowerShell line from a machine with the latest BcContainerHelper module installed: +Easiest way to create an authentication context with impersonation for AL-Go for GitHub is to use the following PowerShell line from a machine with the latest **BcContainerHelper** module installed: ```powershell New-BcAuthContext -includeDeviceLogin | New-ALGoAuthContext | set-Clipboard @@ -38,16 +42,21 @@ Complete the login with a Business Central user, which has access to deploy appl Return to the "Add Secret" dialog from the environment configuration screen, paste the secret into the "Value" field, and click **Add secret**. -| ![image](https://github.com/microsoft/AL-Go/assets/10775043/89d65117-d93a-4551-9ad5-83f4de60d596) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/7d825d02-a22f-41fc-b291-08dea0685676) | |-| Now, select **Actions** and select the **CI/CD** workflow and click **Run workflow**. Inspect the workflow and see that deployment now also deploys your apps: -| ![image](https://github.com/microsoft/AL-Go/assets/10775043/fb12b77a-8c01-4432-b411-5047815b81e7) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/2e390351-f9a5-49a5-a50c-25671022633c) | |-| The URL under the deployment will navigate to the environment. +Opening the Business Central environment and navigating to **Extension Management** reveals that both apps from repo1 has been installed in the development scope. If the environment was a production environment, the apps would have been installed in the Global Scope as Per Tenant Extensions. + +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/40e5f9de-319c-4151-aa31-98a32732bfce) | +|-| + > [!NOTE] > You need to update the AuthContext secret every 90 days for now. @@ -62,14 +71,10 @@ New-BcAuthContext -clientID $clientID -clientSecret $clientSecret -tenantID $ten Paste the value from the clipboard into the "Value" field of the **AuthContext** secret for the environment and you should be good to go. -> [!NOTE] -> The Environments tab in repository **Settings** is only supported in **paid SKUs** of GitHub or for **public repositories**. It is possible to use repository or organizational secrets for authenticating to environments defined in **Settings**, as an alternative to using environment secrets as we have done here, but this is not part of this workshop. - ## Custom Deployments AL-Go can also be setup for custom deployment when you want to deploy to non-SaaS environments. More about this in the advanced section. - This section was about Continuous Deployment, but you might not want to deploy to production environments continuously - how can we publish to production on demand? --- diff --git a/Workshop/Dependencies1.md b/Workshop/Dependencies1.md index 76aa55781..cc364bdd0 100644 --- a/Workshop/Dependencies1.md +++ b/Workshop/Dependencies1.md @@ -1,4 +1,5 @@ # Dependencies #1 - Dependencies to a project in the same repository + Dependencies is a BIG topic, which is why it is handled in multiple sections in this workshop. In general, dependencies between apps in the same project are handled 100% automatically. AL-Go for GitHub will determine the order in which apps within the same project need to be built, and will use the apps built to satisfy dependencies from other apps. @@ -58,7 +59,8 @@ Looking at the artifacts produced by the build, we can see ## include The other mechanism is to *include* the dependency projects in the project we are building. This is done by using the project setting **appDependencyProbingPaths**, which specifies where to search for dependencies in general. -If you already set up **useProjectDependencies**, please remove this setting from **.github/AL-Go-Settings.json**. You don't need to run **Update AL-Go System Files** before building, but you will be notified to do so when building. +> [!NOTE] +> If you already set up **useProjectDependencies**, please remove this setting from **.github/AL-Go-Settings.json**. You don't need to run **Update AL-Go System Files** before building, but you will be notified to do so when building. Now, modify **DK/.AL-Go/settings.json** and **US/.AL-Go/settings.json** by adding this property diff --git a/Workshop/Dependencies2.md b/Workshop/Dependencies2.md index debc12698..82f38fa66 100644 --- a/Workshop/Dependencies2.md +++ b/Workshop/Dependencies2.md @@ -1,11 +1,12 @@ # Dependencies #2 - Dependencies to AL-Go projects in other repositories + Many partners have a set of common helper functions, tables and other things, which they reuse in other apps. With AL-Go for GitHub, the recommendation is to create a Common repository, which has one or more projects, which can be used in several of your other apps. So, let's setup a single-project common repository like this. Navigate to https://aka.ms/algopte to create a new repository. Click Use this template and select Create a new repository. Select your organization as owner, specify a name and select Public. -| ![image](https://github.com/microsoft/AL-Go/assets/10775043/c79dac2e-bf52-4f3a-b86e-6a3f8cc1f392) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/3ac95b12-7e51-4378-9072-d1415b9ed38d) | |-| Create 2 apps within the repository using the **Create a new app** workflow called **Common** and **Licensing**, using the following parameters: @@ -36,7 +37,7 @@ and Leaving out the sample code in order to avoid name clashes. -| ![image](https://github.com/microsoft/AL-Go/assets/10775043/94ec923f-9e6a-4dc4-a689-b70ab4290e55) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/ce08e813-bf5a-4814-8c56-a6f38cced01d) | |-| Wait for both workflows to complete. @@ -45,7 +46,7 @@ Under **Code** locate the **app.json** file for the **Common** app and copy **id Now locate the **app.json** file for the **Licensing** app and create a dependency to the **Common** app and commit the changes. -| ![image](https://github.com/microsoft/AL-Go/assets/10775043/f9918c5e-7363-46a1-8d3d-2a3acc7efa0c) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/29885e4e-072b-46d4-8b22-135adb973d48) | |-| Also copy the **id**, **name**, **publisher** and **version** from the **Licensing** app to the clipboard as well. @@ -56,15 +57,15 @@ Now, navigate back to your multi-project repository, which you created [here](Pr Add a dependency to the **Licensing** app from the **Common** repository, from the **mysolution.w1** app in the **W1** project. -| ![image](https://github.com/microsoft/AL-Go/assets/10775043/6149aa2f-8bbc-4b63-9190-371a27ca593d) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/40d496fa-64ac-41e3-8b32-d1d33ba17a06) | |-| And as expected, the builds will fail. -| ![image](https://github.com/microsoft/AL-Go/assets/10775043/352d9170-43dc-431f-8e3d-503caab289d7) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/7e7bc6c2-0783-4415-aaac-b2dea56998cf) | |-| -In this example using the **include** mechanism, but builds would also fail when using **useProjectDependencies**. +In this example using the **useProjectDependencies** mechanism, but builds would also fail when using **include**. In this workshop, I will describe two ways to to make this work. @@ -83,24 +84,30 @@ In the MySolution repository, navigate to Settings -> Secrets and Variables -> A replacing **freddydkorg** with your organization name obviously. -| ![image](https://github.com/microsoft/AL-Go/assets/10775043/2dee232d-5e00-4349-a581-e02828eed4b0) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/0ae5d283-0494-4a3d-b6a0-661092b46e09) | |-| -This setting means that all projects in this repository will download the **latest build** from **freddydkorg/Common** and a subsequent build will succeed. +> [!NOTE] +> Make sure you create a repository variable and not a repository secret + +This setting means that all projects in this repository will download the **latest build** from **freddydkorg/Common** and a subsequent build will succeed. Go to **Actions**, select the **CI/CD** workflow, click **Run workflow** and wait for the workflow to complete. -| ![image](https://github.com/microsoft/AL-Go/assets/10775043/f1cca350-9177-4d88-adb7-572bcd14b116) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/b10c3050-dd45-47a0-8c2b-fbeb517c94c2) | |-| -If we had added the**appDependencyProbingPaths** only to the **W1** project, then the **W1** project would **succeed** and the **DK** and **US** projects **fail**. The reason for this is that we are using the **include** mechanism, which includes the source of **W1** in **DK** and **US**, but it doesn't add the **appDependencyProbingPaths** and other settings from **W1**. +> [!NOTE] +> You can also define **appDependencyProbingPaths** in the settings file for individual projects (f.ex. **W1** project). This would also work when using **useProjectDependencies**. +> When using **include** however the **DK** and **US** projects would **fail** as they would **include** the source code for the **W1** project, but not the settings (i.e. the appDependencyProbingPaths). ## Using GitHub Packages -If you already added appDependencyProbingPaths, then please remove these settings before continuing, making your build fail again. +> [!NOTE] +> If you already added appDependencyProbingPaths, then please remove these settings before continuing, making your build fail again. In order to use GitHub Packages for dependency resolution, we need to create an organizational secret called **GitHubPackagesContext**. The format of this secret needs to be **compressed JSON** containing two values: **serverUrl** and **token**. Example: ```json -{"token":"ghp_XXXX","serverUrl":"https://nuget.pkg.github.com/freddydkorg/index.json"} +{"token":"ghp_XXX","serverUrl":"https://nuget.pkg.github.com/freddydkorg/index.json"} ``` Where **ghp_XXX** should be replaced by a **personal access token** with permissions to **write:packages** and **freddydkorg** should be replaced by your **organization name**. @@ -108,53 +115,49 @@ Where **ghp_XXX** should be replaced by a **personal access token** with permiss > [!NOTE] > Fine-grained personal access tokens doesn't support packages at this time, you need to use classic personal access tokens. -You can also use BcContainerHelper and the function **New-ALGoNuGetContext** to create a JSON structure in the right format. +To create a personal access token, navigate to [https://github.com/settings/tokens/new](https://github.com/settings/tokens/new), give it a name and select write:packages. + +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/48f7a8c5-728b-499d-ab38-1a4726b52da8) | +|-| -Go to your organization settings and create an **organizational secret** called **GitHubPackagesContext** with the value above. +> [!NOTE] +> You can also use the BcContainerHelper function **New-ALGoNuGetContext** to create a correctly formed JSON structure. -| ![image](https://github.com/microsoft/AL-Go/assets/10775043/bd7ae71b-88b8-490c-a7bf-12792c59634b) | +Go to your organization settings and create an **organizational secret** called **GitHubPackagesContext** with the your secret value. + +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/f369d7df-fed2-48e7-bf85-aa7924dd9cfa) | |-| Now, navigate to your **Common** repository and run the **CI/CD** Workflow. Inspect the workflow summary after completion: -| ![image](https://github.com/microsoft/AL-Go/assets/10775043/4a449287-2521-49b1-b5c9-e57d7047319f) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/39023475-78a3-4be1-9f01-d3a476697c7f) | |-| Notice the **Deliver to GitHubPackages** job. By creating the **GitHubPackagesContext** secret, you have enabled Continuous Delivery to GitHub Packages. Now, click **Code** and see that you have 2 Packages delivered from the repository: -| ![image](https://github.com/microsoft/AL-Go/assets/10775043/eeeb6675-f565-47c6-8582-5c94c2b26971) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/3fbf27fb-d0c1-442f-9221-83b1096612b0) | |-| Click **Packages**, which will take you to Packages in your organizational profile. All packages are stored on the organization with a link to the owning repository: -| ![image](https://github.com/microsoft/AL-Go/assets/10775043/010defe6-b3a7-4585-9326-d0d1de303157) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/5d3f7089-7826-4651-8081-9b95d07e0e5e) | |-| Next, navigate to your **MySolution** repository (where you deleted the ALGOREPOSETTINGS repository variable) and run the **CI/CD** workflow and magically, all dependencies are now also resolved. -| ![image](https://github.com/microsoft/AL-Go/assets/10775043/4ebbc94e-a55c-47cd-a361-4e78828bed7c) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/a9f12ea7-5414-441b-9e5c-c14ea803f35b) | |-| -Looking into the logs under the **RunPipeline** step, you will find that **Resolving Dependencies** will find that it is missing the **Licensing** dependency and then, under **installing app dependencies**, it searches GitHub Packages to locate the missing dependencies (+ their dependencies) +Looking into the logs under the **Build** step, you will find that **Resolving Dependencies** will find that it is missing the **Licensing** dependency and then, under **installing app dependencies**, it searches GitHub Packages to locate the missing dependencies (+ their dependencies) -| ![image](https://github.com/microsoft/AL-Go/assets/10775043/c2e48b09-7239-4cb2-881e-cd52ee5d6508) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/d6504c55-19fc-489f-bdb5-b345f00432c2) | |-| and looking at packages for the organization, we will now see that there are 5 packages - 3 of them published from the MySolutions repository: -| ![image](https://github.com/microsoft/AL-Go/assets/10775043/a94bac82-cc70-40b6-acb6-682623e061c1) | -|-| - -Now, if we remove the **appDependencyProbingPaths** settting in the **DK** and **US** project in **MySolution**, we will see that all projects still build. The reason for this is, that they will now download the W1 package from GitHub Packages, instead of including the W1 project when building DK and US: - -| ![image](https://github.com/microsoft/AL-Go/assets/10775043/6bf22151-321f-4494-8acf-da28763932da) | -|-| - -Note though that this means that the DK and US projects will use the previously delivered version of the W1 dependency and not the one that is build in parallel with DK and US. If we set **useProjectDependencies** to true and run **Update AL-Go System Files**, projects will now be build in order and project dependencies from the same repository will be taken from the same build, while external dependencies will be taken from GitHub Packages. In the summary, we can also see that the newly build apps are also delivered to GitHub packages: - -| ![image](https://github.com/microsoft/AL-Go/assets/10775043/3342e737-24a8-416e-98ea-355d8f6a6a5d) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/95f989ed-1d88-4cd6-8959-25291d23d569) | |-| Continuous Delivery is not only GitHub Packages. Let's have a look at continuous delivery... diff --git a/Workshop/PublishToProduction.md b/Workshop/PublishToProduction.md index 340ced2a4..d04fb3ac5 100644 --- a/Workshop/PublishToProduction.md +++ b/Workshop/PublishToProduction.md @@ -1,17 +1,20 @@ # Publish To Production In [this](ContinuousDeployment.md) section you learned how to setup a QA environment for continuous deployment. -If you follow the same process and setup an environment called PROD: +If you follow the same process and setup an environment called PROD and add the same AUTHCONTEXT secret to that environment. -| ![image](https://github.com/microsoft/AL-Go/assets/10775043/98d4a06f-05cb-489b-afcf-4a46d9a06020) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/1008fcf4-ed2a-4cc1-a786-3b5cf6692266) | |-| +> [!NOTE] +> You can add protection rules to environments in GitHub, like which branches can deploy to this environment and which users should review every deployment to this environment as well. + By default, all environments will be picked up for **continuous deployment**, but production environments will be skipped unless you add the ContinuousDeployment setting from the previous chapter. The Deployment job will succeed, but looking into the step, you will see that the PROD environment is ignored: -| ![image](https://github.com/microsoft/AL-Go/assets/10775043/4b4f70ec-b503-44d9-b417-5c0ba3e65c0d) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/205e4eed-919c-4cb0-bb54-924857b53898) | |-| -By adding a setting like: +By adding a setting like this to your repository settings file (.github/AL-Go-Settings.json) ```json "DeployToPROD": { @@ -19,7 +22,10 @@ By adding a setting like: } ``` -The PROD environment is not even included in the CI/CD workflow, and again, setting the ContinuousDeployment to true will enable continuous deployment to the production environment. +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/a0822808-f773-49dc-ba4d-753a5677ca38) | +|-| + +Then the PROD environment is not even included in the CI/CD workflow, and again, setting the ContinuousDeployment to true will enable continuous deployment to the production environment. ## Publish to Environment @@ -29,9 +35,9 @@ Menually publishing to environments is done by running the **Publish To Environm |-| > [!NOTE] -> The default version is **current**. This will deploy the **current release**, which is the release tagged with *Latest* in your repository -> -> ![image](https://github.com/microsoft/AL-Go/assets/10775043/236f1eac-3045-4b19-90a1-1f81e2ad26a6) +> The default version is **current**. This will deploy the **current release**, which is the release tagged with *Latest* in your repository. +> +> ![image](https://github.com/microsoft/AL-Go/assets/10775043/5c653d70-106e-4d0a-9684-ae91275abb77) If you want to deploy the latest *build*, you would specify "latest" and if you want to deploy a specific version, you should specify the project version number to deploy. @@ -40,7 +46,7 @@ If you want to deploy the latest *build*, you would specify "latest" and if you Investigating the **Publish To Environment** workflow run, you will see a Deploy step like the one in CI/CD, which also includes a link to the environment. -| ![image](https://github.com/microsoft/AL-Go/assets/10775043/de8958a5-c9fb-4c9b-912c-bf037096c0bd) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/9bbfac60-e191-412f-9ff0-313ce4cd7379) | |-| But... - would you do that without running automated tests? diff --git a/Workshop/ReferenceDoc.md b/Workshop/ReferenceDoc.md index 36d8cbefe..be23d473d 100644 --- a/Workshop/ReferenceDoc.md +++ b/Workshop/ReferenceDoc.md @@ -3,7 +3,7 @@ A vital part of your development processes is reference documentation. AL-Go for GitHub supports the ALDoc tool for reference documentation generation, either continuously as part of CI/CD, manually or scheduled. > [!NOTE] -> The [ALDoc tool](https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/help/help-aldoc-generate-help) generates content based on the source code. Generating content based on source code has many advantages such as accuracy, 100% reflection of the current codebase, less error prone documentation, and it saves time. The ALDoc tool generates documentation from symbolic and syntactical information, code comments, and overall application structure based on input .app file(s). The tool also generates a help site with these reference articles, sorted by the application structure, based on the provided template. +> The [ALDoc tool](https://learn.microsoft.com/dynamics365/business-central/dev-itpro/help/help-aldoc-generate-help) generates content based on the source code. Generating content based on source code has many advantages such as accuracy, 100% reflection of the current codebase, less error-prone documentation, and it saves time. The ALDoc tool generates documentation from symbolic and syntactical information, code comments, and overall application structure based on input .app file(s). The tool also generates a help site with these reference articles, sorted by the application structure, based on the provided template. AL-Go for GitHub supports deploying the reference documentation to GitHub Pages. GitHub Pages is websites for you and your projects, hosted directly from your GitHub repository. It is also possible to deploy the reference documentation to other static HTML hosting providers, but this requires some scripting and is not included here. @@ -14,39 +14,39 @@ AL-Go for GitHub supports deploying the reference documentation to GitHub Pages. Navigate to your Common repository, go to **Settings** -> **Pages** and under **Build and deployment** select **GitHub Actions** as the source. -| ![image](https://github.com/microsoft/AL-Go/assets/10775043/c6dad393-bdb2-4106-9a04-6651347a6005) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/a71fc75f-027c-4ef9-a8f4-63b1332ac9a4) | |-| Choose Actions, select the **Deploy Reference Documentation** workflow and click **Run workflow** -| ![image](https://github.com/microsoft/AL-Go/assets/10775043/43535bdd-4f3d-42f2-88cc-db9c501e48c9) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/43b88ca8-0420-48f0-b875-3fab3393bbe7) | |-| When the workflow is done, click the workflow to open workflow details and you will find a URL to your reference documentation in the deploy step. There is also an artifact called github-pages, which is the artifact deployed to the GitHub pages website. This artifact can be deployed to any other hosting provider if needed. -| ![image](https://github.com/microsoft/AL-Go/assets/10775043/238e568c-02c9-4c3b-815b-d25b7b30b470) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/452d1a68-c6f3-4adb-964f-bfa5a2186c5a) | |-| Clicking the link to your reference documentation reveals the website -| ![image](https://github.com/microsoft/AL-Go/assets/10775043/b59f5b08-f30f-41ba-a845-571267da741a) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/52b4f77b-aa52-474b-a2b5-3e25425c2843) | |-| Now, there isn't much documentation in the Common repository as the apps doesn't contain any objects, so let's repeat the above steps with Repo1 (single-project) and MySolution (multi-project) repository. In all repositories, click the settings icon in the About section to open repository details, specify a description and check **Use your GitHub Pages website** -| ![image](https://github.com/microsoft/AL-Go/assets/10775043/d592e77f-a158-4a24-8856-d93c1e69907a) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/53f2223b-d102-4194-9ebe-3d1789255819) | |-| After this, the link to the reference documentation is available in the upper right corner of your repository landing page. -| ![image](https://github.com/microsoft/AL-Go/assets/10775043/d39b95a8-c73c-4c7e-8008-7b4f65655e37) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/556de268-c8f3-4e55-a282-252ff9b39d70) | |-| Clicking the link on the multi-project repository, in which we did a release earlier, shows that AL-Go for GitHub includes reference documentation for prior releases as well as the current main repository. -| ![image](https://github.com/microsoft/AL-Go/assets/10775043/021e7b5d-139b-40bb-8e4c-a93379c60718) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/00e38e2e-1429-43cc-b16c-445a9303f997) | |-| You will see the three projects as "folders" and the apps, which are built in these projects, are listed below. You will also find a **Releases** folder under which earlier versions of the apps from the repository are listed. @@ -87,7 +87,7 @@ But you can also add the setting to a repository settings variable called **ALGO Running CI/CD after enabling continuous deployment reveals the **Deploy Reference Documentation** job being run and the link to the reference documentation is available in the job. -| ![image](https://github.com/microsoft/AL-Go/assets/10775043/8a89e9b8-95db-4747-8136-fda4fa78350a) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/a92b4dad-67fe-4c57-81f2-a7fc2abfd848) | |-| Maybe it is about time to actually explain how you create a development environment and code your app? diff --git a/Workshop/ScheduledTestRuns.md b/Workshop/ScheduledTestRuns.md index 89cd894bc..0ca6ae021 100644 --- a/Workshop/ScheduledTestRuns.md +++ b/Workshop/ScheduledTestRuns.md @@ -6,7 +6,7 @@ AL-Go for GitHub includes 3 workflows for this purpose: **Test Current**, **Test These workflows can be run manually by simply selecting the workflow and clicking **Run workflow**. -| ![image](https://github.com/microsoft/AL-Go/assets/10775043/5cec9a1b-04d0-4010-a647-bb631903e80e) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/7747d778-40f8-4d3e-9e26-02e3cf410834) | |-| Microsoft recommands running these workflows on a schedule to ensure that your app is ready for upcoming releases at all times and at the same time keeping compatibility with the versions you want to support. @@ -24,17 +24,19 @@ In your single-project repository, select **Code**, navigate to **.github/AL-Go- "NextMajorSchedule": "0 2 * * 0" ``` -| ![image](https://github.com/microsoft/AL-Go/assets/10775043/480c759b-c276-439e-9d89-af26ce4780dd) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/c82e1393-e7b1-4e3a-8b64-488c107fff7b) | |-| Now, select **Actions** and run the **Update AL-Go System Files** workflow in order for the schedule to take effect. You can see the changes to the workflows done by the **Update AL-Go System Files** workflow in the **pull request**. -| ![image](https://github.com/microsoft/AL-Go/assets/10775043/e868a217-010d-4fea-8be8-e707e5e76900) | +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/4a65a694-12b5-4896-8323-1b49d26c1a56) | |-| -Now, modify **.github/Test Current.settings.json** and add the two settings (useCompilerFolder and doNotPublishApps) in that one +Merge the Pull Request and remove the temporary branch. -| ![image](https://github.com/microsoft/AL-Go/assets/10775043/1028a813-87db-438e-a271-ef8e87415799) | +Now, you could modify **.github/Test Current.settings.json** and add the two settings (useCompilerFolder and doNotPublishApps) in that one + +| ![image](https://github.com/microsoft/AL-Go/assets/10775043/e17aaebc-4cb9-405e-89d7-9aee55eba66f) | |-| Which now means that your Test Current workflow, which runs every night will run all tests and other workflows will not. @@ -42,7 +44,7 @@ Which now means that your Test Current workflow, which runs every night will run > [!NOTE] > While the name of the workflow specific settings file is based on the workflow title (**Test Next Major.settings.json**), the workflow schedule setting needs to be in AL-Go-Settings.json and is based on the filename of the workflow (**NextMajorSchedule**): > -> ![image](https://github.com/microsoft/AL-Go/assets/10775043/b3abf297-2ee6-4160-b1c1-ddeeab985cda) +> ![image](https://github.com/microsoft/AL-Go/assets/10775043/6d8f15f3-8415-43d1-b7b6-3e08c545e500) Now we know when our app gets broken and doesn't work anymore, but what about performance regressions? From bcecd2bc4424f2f988d8bbec9c47b4313e730a5b Mon Sep 17 00:00:00 2001 From: freddydk Date: Mon, 4 Dec 2023 14:26:30 +0100 Subject: [PATCH 229/235] -auto --- Workshop/Index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Workshop/Index.md b/Workshop/Index.md index cd2365744..717334675 100644 --- a/Workshop/Index.md +++ b/Workshop/Index.md @@ -16,7 +16,7 @@ This workshop shows you how to take advantage of the functionality, which is pro 1. [Automated Tests](AutomatedTests.md) - Add automated testing to your project. 1. [Scheduled test runs](ScheduledTestRuns.md) - Testing your app against the latest (and future Business Central versions) daily or weekly. 1. [Performance Testing](PerformanceTesting.md) - *FUTURE TOPIC: Add performance tests to your daily test runs.* -1. [Automatic Reference Documentation Generation](ReferenceDoc.md) - Keep your reference documentation up-to-date. +1. [Reference Documentation Generation](ReferenceDoc.md) - Keep your reference documentation up-to-date. 1. [Delevelopment Environments](DevelopmentEnvironments.md) - *FUTURE TOPIC: How to setup a development environment for a project.* 1. [The Development Process](TheDevelopmentProcess.md) - *FUTURE TOPIC: The recommended way to work with feature branches, pull requests, code reviews and branch protection rules.* 1. [Keeping your Repository Up-to-date](KeepUpToDate.md) - *FUTURE TOPIC: Updating AL-Go for GitHub to the latest version by running a workflow.* From ad7efcc0b77d9252a3235fcca196ea451545be6c Mon Sep 17 00:00:00 2001 From: freddydk Date: Mon, 4 Dec 2023 14:35:22 +0100 Subject: [PATCH 230/235] review comments --- Actions/AL-Go-Helper.ps1 | 2 +- ...ReferenceDocumentation.HelperFunctions.ps1 | 28 ++++++++++--------- .../BuildReferenceDocumentation.ps1 | 8 +++--- RELEASENOTES.md | 2 +- Scenarios/settings.md | 2 +- ...uildReferenceDocumentation.Action.Test.ps1 | 2 +- 6 files changed, 23 insertions(+), 21 deletions(-) diff --git a/Actions/AL-Go-Helper.ps1 b/Actions/AL-Go-Helper.ps1 index dd0ea91b3..f1c78a695 100644 --- a/Actions/AL-Go-Helper.ps1 +++ b/Actions/AL-Go-Helper.ps1 @@ -627,7 +627,7 @@ function ReadSettings { "continuousDeployment" = $false "deployToGitHubPages" = $true "maxReleases" = 3 - "useProjectsAsFolders" = $true + "groupByProject" = $true "includeProjects" = @() "excludeProjects" = @() "header" = "Documentation for {REPOSITORY} {VERSION}" diff --git a/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.HelperFunctions.ps1 b/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.HelperFunctions.ps1 index ac22ebbb3..5fdddeaf5 100644 --- a/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.HelperFunctions.ps1 +++ b/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.HelperFunctions.ps1 @@ -13,7 +13,6 @@ Remove-Item -Path "$($tempFolder).zip" -Force if ($IsLinux) { $ENV:aldocPath = Join-Path $tempFolder 'extension/bin/linux/aldoc' - & /usr/bin/env sudo pwsh -command "& chmod +x $ENV:aldocPath" } else { $ENV:aldocPath = Join-Path $tempFolder 'extension/bin/win32/aldoc.exe' @@ -21,14 +20,17 @@ if (-not (Test-Path $ENV:aldocPath)) { throw "aldoc tool not found at $ENV:aldocPath" } + if ($IsLinux) { + & /usr/bin/env sudo pwsh -command "& chmod +x $ENV:aldocPath" + } Write-Host "Installing/Updating docfx" CmdDo -command dotnet -arguments @("tool","update","-g docfx") } - $ENV:aldocPath + return $ENV:aldocPath } -function SanitizeFileName([string] $filename) { - $filename.Replace('_','-').Replace('?','_').Replace('*','_').Replace(' ','-').Replace('\','-').Replace('/','-').Replace(':','-').Replace('<','-').Replace('>','-').Replace('|','-').Replace('%','pct') +function SanitizeFileName([string] $fileName) { + $fileName.Replace('_','-').Replace('?','_').Replace('*','_').Replace(' ','-').Replace('\','-').Replace('/','-').Replace(':','-').Replace('<','-').Replace('>','-').Replace('|','-').Replace('%','pct') } function GetAppNameAndFolder { @@ -40,7 +42,7 @@ function GetAppNameAndFolder { Extract-AppFileToFolder -appFilename $appFile -appFolder $tmpFolder -generateAppJson $appJson = Get-Content -Path (Join-Path $tmpFolder 'app.json') -Encoding utf8 | ConvertFrom-Json $appJson.name - (SanitizeFileName -filename $appJson.name).ToLower() + (SanitizeFileName -fileName $appJson.name).ToLower() Remove-Item -Path $tmpFolder -Recurse -Force } @@ -49,7 +51,7 @@ function GenerateTocYml { [string] $version, [string[]] $allVersions, [hashtable] $allApps, - [switch] $useProjectsAsFolders + [switch] $groupByProject ) $prefix = '' @@ -80,11 +82,11 @@ function GenerateTocYml { $allApps | ConvertTo-Json -Depth 99 | Out-Host if ($allApps.Keys.Count -eq 1 -and $allApps.Keys[0] -eq $repoName) { # Single project repo - do not use project names as folders - $useProjectsAsFolders = $false + $groupByProject = $false } $projects = @($allApps.Keys.GetEnumerator() | Sort-Object) foreach($project in $projects) { - if ($useProjectsAsFolders) { + if ($groupByProject) { $tocYml += @( " - name: $project" " items:" @@ -129,7 +131,7 @@ function GenerateDocsSite { [string] $defaultReleaseMD, [string] $docsPath, [string] $logLevel, - [switch] $useProjectsAsFolders, + [switch] $groupByProject, [switch] $hostIt ) @@ -169,7 +171,7 @@ function GenerateDocsSite { New-Item -path $docfxPath -ItemType Directory | Out-Null try { # Generate new toc.yml with releases and apps - $newTocYml = GenerateTocYml -version $version -allVersions $allVersions -allApps $allApps -repoName $repoName -useProjectsAsFolders $useProjectsAsFolders + $newTocYml = GenerateTocYml -version $version -allVersions $allVersions -allApps $allApps -repoName $repoName -groupByProject $groupByProject # calculate apps for aldoc $apps = @() @@ -250,13 +252,13 @@ function GenerateDocsSite { # Build a list of all projects (folders) and apps to use when building reference documentation # return value is a hashtable for all apps and a hashtable for all dependencies # Every hashtable has project name as key and an array of app files as value -# if useProjectsAsFolders is false, all apps will be collected in one "project" called "dummy", which is never displayed +# if groupByProject is false, all apps will be collected in one "project" called "dummy", which is never displayed function CalculateProjectsAndApps { Param( [string] $tempFolder, [string[]] $includeProjects, [string[]] $excludeProjects, - [switch] $useProjectsAsFolders + [switch] $groupByProject ) if ($includeProjects.Count -eq 0) { $includeProjects = @("*") } @@ -275,7 +277,7 @@ function CalculateProjectsAndApps { if ($includeIt) { $excludeIt = $null -ne ($excludeProjectList | Where-Object { $project -like $_ }) if (-not $excludeIt) { - if (-not $useProjectsAsFolders) { + if (-not $groupByProject) { # use project name dummy for all apps when not using projects as folders $project = 'dummy' } diff --git a/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.ps1 b/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.ps1 index 81f556912..84fc6ffd4 100644 --- a/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.ps1 +++ b/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.ps1 @@ -58,10 +58,10 @@ foreach($release in $releases) { } Write-Host "Version: $($release.Name):" Get-ChildItem -Path $tempFolder -Recurse -File | ForEach-Object { Write-Host "- $($_.FullName.Substring($tempFolder.Length+1))" } - $allApps, $allDependencies = CalculateProjectsAndApps -tempFolder $tempFolder -includeProjects $includeProjects -excludeProjects $excludeProjects -useProjectsAsFolders:$settings.alDoc.useProjectsAsFolders + $allApps, $allDependencies = CalculateProjectsAndApps -tempFolder $tempFolder -includeProjects $includeProjects -excludeProjects $excludeProjects -groupByProject:$settings.alDoc.groupByProject $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 -useProjectsAsFolders:$settings.alDoc.useProjectsAsFolders + GenerateDocsSite -version $version -allVersions $versions -allApps $allApps -repoName $settings.repoName -releaseNotes $releaseNotes -header $header -footer $footer -defaultIndexMD $defaultIndexMD -defaultReleaseMD $defaultReleaseMD -docsPath $docsPath -logLevel $logLevel -groupByProject:$settings.alDoc.groupByProject do { try { $retry = $false @@ -85,7 +85,7 @@ foreach($version in $versions) { } Get-ChildItem -Path $artifactsFolder -Depth 1 -File | ForEach-Object { Write-Host "- $($_.FullName.Substring($artifactsFolder.Length))" } -$allApps, $allDependencies = CalculateProjectsAndApps -tempFolder $artifactsFolder -includeProjects $includeProjects -excludeProjects $excludeProjects -useProjectsAsFolders:$settings.alDoc.useProjectsAsFolders +$allApps, $allDependencies = CalculateProjectsAndApps -tempFolder $artifactsFolder -includeProjects $includeProjects -excludeProjects $excludeProjects -groupByProject:$settings.alDoc.groupByProject $releaseNotes = '' if ($latestReleaseTag) { try { @@ -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 -useProjectsAsFolders:$settings.alDoc.useProjectsAsFolders +GenerateDocsSite -version '' -allVersions $versions -allApps $allApps -repoName $settings.repoName -releaseNotes $releaseNotes -header $header -footer $footer -defaultIndexMD $defaultIndexMD -defaultReleaseMD $defaultReleaseMD -docsPath $docsPath -logLevel $logLevel -groupByProject:$settings.alDoc.groupByProject if ($artifactsFolderCreated) { Remove-Item $artifactsFolder -Recurse -Force diff --git a/RELEASENOTES.md b/RELEASENOTES.md index f4d7c707a..b484a31c0 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -24,7 +24,7 @@ If false, the templateSha repository setting is used to download specific AL-Go - **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 Actions. (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 + - **groupByProject** = Determines whether projects in multi-project repositories are used as folders in reference documentation - **includeProjects** = 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 2b0b94ae7..31ce72bc2 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)
**useProjectsAsFolders** = Determines whether projects in multi-project repositories are used as folders in reference documentation
**includeProjects** = 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)
**groupByProject** = Determines whether projects in multi-project repositories are used as folders in reference documentation
**includeProjects** = 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" ] | diff --git a/Tests/BuildReferenceDocumentation.Action.Test.ps1 b/Tests/BuildReferenceDocumentation.Action.Test.ps1 index 9717828e9..a7a88044b 100644 --- a/Tests/BuildReferenceDocumentation.Action.Test.ps1 +++ b/Tests/BuildReferenceDocumentation.Action.Test.ps1 @@ -53,7 +53,7 @@ Describe "BuildReferenceDocumentation Action Tests" { $allApps[0].ContainsKey('dummy') | Should -be $true $allApps[0]."dummy".Count | Should -be 3 - $allApps = CalculateProjectsAndApps -tempFolder (Get-Location).Path -includeProjects @('*') -excludeProjects @('P3') -useProjectsAsFolders + $allApps = CalculateProjectsAndApps -tempFolder (Get-Location).Path -includeProjects @('*') -excludeProjects @('P3') -groupByProject $allApps.Count | Should -Be 2 $allApps[0].Keys.Count | Should -be 3 $allApps[0].ContainsKey('dummy') | Should -be $false From 3afd5dd99678221536bda76b5b99929073367103 Mon Sep 17 00:00:00 2001 From: freddydk Date: Mon, 4 Dec 2023 14:44:42 +0100 Subject: [PATCH 231/235] grouping --- .../BuildReferenceDocumentation.ps1 | 9 ++++++++- e2eTests/scenarios/ReferenceDocumentation/runtest.ps1 | 4 ++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.ps1 b/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.ps1 index 84fc6ffd4..799dc063c 100644 --- a/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.ps1 +++ b/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.ps1 @@ -16,6 +16,7 @@ $maxReleases = $settings.alDoc.maxReleases $artifactsFolder = Join-Path $ENV:GITHUB_WORKSPACE ".artifacts" $artifactsFolderCreated = $false if ($artifacts -ne ".artifacts") { + Write-Host "::group::Downloading artifacts" $artifactsFolderCreated = $true New-Item $artifactsFolder -ItemType Directory | Out-Null $allArtifacts = @(GetArtifacts -token $token -api_url $ENV:GITHUB_API_URL -repository $ENV:GITHUB_REPOSITORY -mask "Apps" -projects '*' -Version $artifacts -branch $ENV:GITHUB_REF_NAME) @@ -30,6 +31,7 @@ if ($artifacts -ne ".artifacts") { Remove-Item -Path $filename -Force } } + Write-Host "::endgroup::" } $header = $settings.alDoc.header @@ -53,10 +55,10 @@ foreach($release in $releases) { $tempFolder = Join-Path ([System.IO.Path]::GetTempPath()) ([Guid]::NewGuid().ToString()) New-Item -Path $tempFolder -ItemType Directory | Out-Null try { + Write-Host "::group::Version $($release.Name)" foreach($mask in 'Apps', 'Dependencies') { DownloadRelease -token $token -projects "$($includeProjects -join ',')" -api_url $ENV:GITHUB_API_URL -repository $ENV:GITHUB_REPOSITORY -release $release -path $tempFolder -mask $mask -unpack } - Write-Host "Version: $($release.Name):" Get-ChildItem -Path $tempFolder -Recurse -File | ForEach-Object { Write-Host "- $($_.FullName.Substring($tempFolder.Length+1))" } $allApps, $allDependencies = CalculateProjectsAndApps -tempFolder $tempFolder -includeProjects $includeProjects -excludeProjects $excludeProjects -groupByProject:$settings.alDoc.groupByProject $version = $release.Name @@ -72,6 +74,7 @@ foreach($release in $releases) { $retry = $true } } while ($retry) + Write-Host "::endgroup::" } finally { Remove-Item -Path $tempFolder -Recurse -Force @@ -84,6 +87,8 @@ foreach($version in $versions) { Move-Item -Path (join-Path $docsPath $version) -Destination $releasesPath } +Write-Host "::group::main version" + Get-ChildItem -Path $artifactsFolder -Depth 1 -File | ForEach-Object { Write-Host "- $($_.FullName.Substring($artifactsFolder.Length))" } $allApps, $allDependencies = CalculateProjectsAndApps -tempFolder $artifactsFolder -includeProjects $includeProjects -excludeProjects $excludeProjects -groupByProject:$settings.alDoc.groupByProject $releaseNotes = '' @@ -100,6 +105,8 @@ else { } GenerateDocsSite -version '' -allVersions $versions -allApps $allApps -repoName $settings.repoName -releaseNotes $releaseNotes -header $header -footer $footer -defaultIndexMD $defaultIndexMD -defaultReleaseMD $defaultReleaseMD -docsPath $docsPath -logLevel $logLevel -groupByProject:$settings.alDoc.groupByProject +Write-Host "::endgroup::" + if ($artifactsFolderCreated) { Remove-Item $artifactsFolder -Recurse -Force } diff --git a/e2eTests/scenarios/ReferenceDocumentation/runtest.ps1 b/e2eTests/scenarios/ReferenceDocumentation/runtest.ps1 index be434d0ca..2daa0b3cf 100644 --- a/e2eTests/scenarios/ReferenceDocumentation/runtest.ps1 +++ b/e2eTests/scenarios/ReferenceDocumentation/runtest.ps1 @@ -39,7 +39,7 @@ Write-Host -ForegroundColor Yellow @' '@ $errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0 -$prevLocation = Get-Location +Push-Location Remove-Module e2eTestHelper -ErrorAction SilentlyContinue Import-Module (Join-Path $PSScriptRoot "..\..\e2eTestHelper.psm1") -DisableNameChecking @@ -122,6 +122,6 @@ $pagesInfo = gh api /repos/$repository/pages | ConvertFrom-Json $html = (Invoke-WebRequest -Uri $pagesInfo.html_url -UseBasicParsing).Content $html | Should -belike "*Documentazione per $repository*" -Set-Location $prevLocation +Pop-Location RemoveRepository -repository $repository -path $repoPath From fb206b80e04be2d544d25e3d58ac308bcec672fc Mon Sep 17 00:00:00 2001 From: freddydk Date: Mon, 4 Dec 2023 14:55:31 +0100 Subject: [PATCH 232/235] group name --- .../BuildReferenceDocumentation.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.ps1 b/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.ps1 index 799dc063c..ae6c5a383 100644 --- a/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.ps1 +++ b/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.ps1 @@ -55,7 +55,7 @@ foreach($release in $releases) { $tempFolder = Join-Path ([System.IO.Path]::GetTempPath()) ([Guid]::NewGuid().ToString()) New-Item -Path $tempFolder -ItemType Directory | Out-Null try { - Write-Host "::group::Version $($release.Name)" + Write-Host "::group::Release $($release.Name)" foreach($mask in 'Apps', 'Dependencies') { DownloadRelease -token $token -projects "$($includeProjects -join ',')" -api_url $ENV:GITHUB_API_URL -repository $ENV:GITHUB_REPOSITORY -release $release -path $tempFolder -mask $mask -unpack } @@ -87,7 +87,7 @@ foreach($version in $versions) { Move-Item -Path (join-Path $docsPath $version) -Destination $releasesPath } -Write-Host "::group::main version" +Write-Host "::group::Main" Get-ChildItem -Path $artifactsFolder -Depth 1 -File | ForEach-Object { Write-Host "- $($_.FullName.Substring($artifactsFolder.Length))" } $allApps, $allDependencies = CalculateProjectsAndApps -tempFolder $artifactsFolder -includeProjects $includeProjects -excludeProjects $excludeProjects -groupByProject:$settings.alDoc.groupByProject From c5cb325819475d03566cde163baafa587af0bd63 Mon Sep 17 00:00:00 2001 From: Freddy Kristiansen Date: Mon, 4 Dec 2023 15:14:47 +0100 Subject: [PATCH 233/235] Update Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.HelperFunctions.ps1 Co-authored-by: Maria Zhelezova <43066499+mazhelez@users.noreply.github.com> --- .../BuildReferenceDocumentation.HelperFunctions.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.HelperFunctions.ps1 b/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.HelperFunctions.ps1 index 5fdddeaf5..751aad98d 100644 --- a/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.HelperFunctions.ps1 +++ b/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.HelperFunctions.ps1 @@ -168,7 +168,7 @@ function GenerateDocsSite { $alDocPath = DownloadAlDoc $docfxPath = Join-Path ([System.IO.Path]::GetTempPath()) ([Guid]::NewGuid().ToString()) - New-Item -path $docfxPath -ItemType Directory | Out-Null + New-Item -Path $docfxPath -ItemType Directory | Out-Null try { # Generate new toc.yml with releases and apps $newTocYml = GenerateTocYml -version $version -allVersions $allVersions -allApps $allApps -repoName $repoName -groupByProject $groupByProject From 779e95601dc78a653cbecfbb47e60a97e0cb0569 Mon Sep 17 00:00:00 2001 From: freddydk Date: Mon, 4 Dec 2023 15:32:45 +0100 Subject: [PATCH 234/235] support release branch --- .../BuildReferenceDocumentation.HelperFunctions.ps1 | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.HelperFunctions.ps1 b/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.HelperFunctions.ps1 index 5fdddeaf5..505d85042 100644 --- a/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.HelperFunctions.ps1 +++ b/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.HelperFunctions.ps1 @@ -138,10 +138,11 @@ function GenerateDocsSite { function ReplacePlaceHolders { Param( [string] $str, - [string] $version, - [string] $releaseNotes + [string] $version = '', + [string] $releaseNotes = '', + [string] $indexTemplateRelativePath = '' ) - return $str.Replace('{REPOSITORY}',$ENV:GITHUB_REPOSITORY).Replace('{VERSION}',$version).Replace('{RELEASENOTES}',$releaseNotes) + return $str.Replace('{REPOSITORY}',$ENV:GITHUB_REPOSITORY).Replace('{VERSION}',$version).Replace('{RELEASENOTES}',$releaseNotes).Replace('{INDEXTEMPLATERELATIVEPATH}',$indexTemplateRelativePath) } $indexTemplateRelativePath = '.aldoc/index.md' @@ -164,7 +165,7 @@ function GenerateDocsSite { else { $indexTemplate = $thisDefaultMD } - $indexContent = ReplacePlaceHolders -str $indexTemplate.Replace('{INDEXTEMPLATERELATIVEPATH}',$thisTemplateRelativePath) -version $version -releaseNotes $releaseNotes + $indexContent = ReplacePlaceHolders -str $indexTemplate -version $version -releaseNotes $releaseNotes -indexTemplateRelativePath $thisTemplateRelativePath $alDocPath = DownloadAlDoc $docfxPath = Join-Path ([System.IO.Path]::GetTempPath()) ([Guid]::NewGuid().ToString()) @@ -271,7 +272,8 @@ function CalculateProjectsAndApps { foreach($mask in 'Apps','Dependencies') { $allApps = @{} foreach($folder in (Get-ChildItem -Path $tempFolder -Filter '*' | Where-Object { $_.PSIsContainer })) { - if ($folder.Name -match "^(.*)-main-$mask-(\d*\.\d*\.\d*\.\d*)$") { + if (($folder.Name -match "^(.*)-main-$mask-(\d*\.\d*\.\d*\.\d*)$") -or + ($folder.Name -match "^(.*)-release.*-$mask-(\d*\.\d*\.\d*\.\d*)$")) { $project = $Matches[1] $includeIt = $null -ne ($projectList | Where-Object { $project -like $_ }) if ($includeIt) { From b63a2f7805ab7704965e322484049741b50b771c Mon Sep 17 00:00:00 2001 From: freddydk Date: Mon, 4 Dec 2023 15:48:02 +0100 Subject: [PATCH 235/235] review --- .../BuildReferenceDocumentation.HelperFunctions.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.HelperFunctions.ps1 b/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.HelperFunctions.ps1 index 95eb2f7fd..a86e881ff 100644 --- a/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.HelperFunctions.ps1 +++ b/Actions/BuildReferenceDocumentation/BuildReferenceDocumentation.HelperFunctions.ps1 @@ -271,7 +271,7 @@ function CalculateProjectsAndApps { $excludeProjectList | ForEach-Object { Write-Host "- $_" } foreach($mask in 'Apps','Dependencies') { $allApps = @{} - foreach($folder in (Get-ChildItem -Path $tempFolder -Filter '*' | Where-Object { $_.PSIsContainer })) { + foreach($folder in (Get-ChildItem -Path $tempFolder | Where-Object { $_.PSIsContainer })) { if (($folder.Name -match "^(.*)-main-$mask-(\d*\.\d*\.\d*\.\d*)$") -or ($folder.Name -match "^(.*)-release.*-$mask-(\d*\.\d*\.\d*\.\d*)$")) { $project = $Matches[1]