diff --git a/RELEASENOTES.md b/RELEASENOTES.md index 1aa6e3bdfa..1c6a9dd135 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -4,6 +4,7 @@ Workspace compilation now finds altool both in the platform-specific subfolder ( ### Issues +- Issue 2126 Deliver and Deploy actions now skip execution when no app artifacts are found, preventing errors on initial commits - Issue 2285 - CheckForUpdates now handles settings file `$schema` reordering in a PowerShell 5-safe way to avoid writing invalid entries like `"*": null` to settings JSON files. - Fix "filename or extension is too long" error when validating settings on PS5.1 with large settings JSON - Fix dependency apps not being resolved when the branch name contains a `]` character (the dependency folder was matched as a wildcard pattern instead of enumerated literally, resulting in 0 apps being published) diff --git a/Scenarios/DeliveryTargets.md b/Scenarios/DeliveryTargets.md index 87f562a033..ea4c3511b7 100644 --- a/Scenarios/DeliveryTargets.md +++ b/Scenarios/DeliveryTargets.md @@ -300,6 +300,8 @@ Your custom delivery script receives a hash table with the following parameters: > **Note:** The folder parameters (`*Folder`) may be `$null` if no artifacts of that type were found. The plural versions (`*Folders`) contain arrays of all matching folders across different build modes. +> **Important:** The delivery step is automatically skipped at the workflow level when no app artifacts are available. This means your custom delivery script will not be executed if no app artifacts were built. This behavior prevents errors on initial commits when no apps have been built yet. + ### Branch-Specific Delivery Configure different delivery targets for different branches: diff --git a/Templates/AppSource App/.github/workflows/CICD.yaml b/Templates/AppSource App/.github/workflows/CICD.yaml index 7d2657b37b..fb7d66e509 100644 --- a/Templates/AppSource App/.github/workflows/CICD.yaml +++ b/Templates/AppSource App/.github/workflows/CICD.yaml @@ -344,6 +344,7 @@ jobs: - name: Deploy to Business Central id: Deploy + if: hashFiles('.artifacts/**/*.app') != '' uses: microsoft/AL-Go-Actions/Deploy@main env: Secrets: '${{ steps.ReadSecrets.outputs.Secrets }}' @@ -354,6 +355,13 @@ jobs: type: 'CD' deploymentEnvironmentsJson: ${{ needs.Initialization.outputs.deploymentEnvironmentsJson }} + - name: Deployment skipped + if: hashFiles('.artifacts/**/*.app') == '' + env: + _environment: ${{ matrix.environment }} + run: | + Write-Host "::Notice::Deployment to environment $($env:_environment) was skipped because no app artifacts were found" + - name: Deploy to Power Platform if: env.type == 'PTE' && env.powerPlatformSolutionFolder != '' uses: microsoft/AL-Go-Actions/DeployPowerPlatform@main @@ -399,6 +407,7 @@ jobs: getSecrets: '${{ matrix.deliveryTarget }}Context' - name: Deliver + if: hashFiles('.artifacts/**/*.app') != '' uses: microsoft/AL-Go-Actions/Deliver@main env: Secrets: '${{ steps.ReadSecrets.outputs.Secrets }}' @@ -409,6 +418,13 @@ jobs: deliveryTarget: ${{ matrix.deliveryTarget }} artifacts: '.artifacts' + - name: Delivery skipped + if: hashFiles('.artifacts/**/*.app') == '' + env: + _deliveryTarget: ${{ matrix.deliveryTarget }} + run: | + Write-Host "::Notice::Delivery to $($env:_deliveryTarget) was skipped because no app artifacts were found" + PostProcess: needs: [ Initialization, Build, Deploy, Deliver, DeployALDoc, CodeAnalysisUpload ] if: (!cancelled()) diff --git a/Templates/Per Tenant Extension/.github/workflows/CICD.yaml b/Templates/Per Tenant Extension/.github/workflows/CICD.yaml index a05237f56e..1464c51e8a 100644 --- a/Templates/Per Tenant Extension/.github/workflows/CICD.yaml +++ b/Templates/Per Tenant Extension/.github/workflows/CICD.yaml @@ -358,6 +358,7 @@ jobs: - name: Deploy to Business Central id: Deploy + if: hashFiles('.artifacts/**/*.app') != '' uses: microsoft/AL-Go-Actions/Deploy@main env: Secrets: '${{ steps.ReadSecrets.outputs.Secrets }}' @@ -368,6 +369,13 @@ jobs: type: 'CD' deploymentEnvironmentsJson: ${{ needs.Initialization.outputs.deploymentEnvironmentsJson }} + - name: Deployment skipped + if: hashFiles('.artifacts/**/*.app') == '' + env: + _environment: ${{ matrix.environment }} + run: | + Write-Host "::Notice::Deployment to environment $($env:_environment) was skipped because no app artifacts were found" + - name: Deploy to Power Platform if: env.type == 'PTE' && env.powerPlatformSolutionFolder != '' uses: microsoft/AL-Go-Actions/DeployPowerPlatform@main @@ -413,6 +421,7 @@ jobs: getSecrets: '${{ matrix.deliveryTarget }}Context' - name: Deliver + if: hashFiles('.artifacts/**/*.app') != '' uses: microsoft/AL-Go-Actions/Deliver@main env: Secrets: '${{ steps.ReadSecrets.outputs.Secrets }}' @@ -423,6 +432,13 @@ jobs: deliveryTarget: ${{ matrix.deliveryTarget }} artifacts: '.artifacts' + - name: Delivery skipped + if: hashFiles('.artifacts/**/*.app') == '' + env: + _deliveryTarget: ${{ matrix.deliveryTarget }} + run: | + Write-Host "::Notice::Delivery to $($env:_deliveryTarget) was skipped because no app artifacts were found" + PostProcess: needs: [ Initialization, Build, BuildPP, Deploy, Deliver, DeployALDoc, CodeAnalysisUpload ] if: (!cancelled()) diff --git a/Workshop/ContinuousDelivery.md b/Workshop/ContinuousDelivery.md index d322be911f..203d35f0ec 100644 --- a/Workshop/ContinuousDelivery.md +++ b/Workshop/ContinuousDelivery.md @@ -98,6 +98,10 @@ For detailed step-by-step instructions, configuration examples, and troubleshoot Custom delivery will be handled in an advanced part of this workshop later. +## Important Note: Automatic Skip Behavior + +The Deliver step is automatically skipped when no app artifacts are available, so delivery targets are only invoked when there is something to deliver. + 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**... ______________________________________________________________________ diff --git a/Workshop/ContinuousDeployment.md b/Workshop/ContinuousDeployment.md index 5591a5d49f..3778a02f7b 100644 --- a/Workshop/ContinuousDeployment.md +++ b/Workshop/ContinuousDeployment.md @@ -92,6 +92,10 @@ 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. +## Important Note: Automatic Skip Behavior + +The Deploy step is automatically skipped when no app artifacts are available, so environments are only targeted when there is something to deploy. + 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? ______________________________________________________________________