diff --git a/RELEASENOTES.md b/RELEASENOTES.md index 8b69114709..bf66b6aa4c 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -10,6 +10,7 @@ The `DownloadProjectDependencies` action now downloads app files from URLs speci - Attempt to start docker service in case it is not running - NextMajor (v28) fails when downloading dependencies from NuGet-feed +- Issue 2126 Deliver and Deploy actions now skip execution when no app artifacts are found, preventing errors on initial commits ## v8.3 diff --git a/Scenarios/DeliveryTargets.md b/Scenarios/DeliveryTargets.md index 87fe57bbf0..0270f541ba 100644 --- a/Scenarios/DeliveryTargets.md +++ b/Scenarios/DeliveryTargets.md @@ -294,6 +294,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 ca95fbd3e1..a18d87a163 100644 --- a/Templates/AppSource App/.github/workflows/CICD.yaml +++ b/Templates/AppSource App/.github/workflows/CICD.yaml @@ -338,6 +338,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 }}' @@ -348,6 +349,11 @@ jobs: type: 'CD' deploymentEnvironmentsJson: ${{ needs.Initialization.outputs.deploymentEnvironmentsJson }} + - name: Deployment skipped + if: hashFiles('.artifacts/**/*.app') == '' + run: | + Write-Host "::Notice::Deployment to environment ${{ matrix.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 @@ -391,6 +397,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 }}' @@ -401,6 +408,11 @@ jobs: deliveryTarget: ${{ matrix.deliveryTarget }} artifacts: '.artifacts' + - name: Delivery skipped + if: hashFiles('.artifacts/**/*.app') == '' + run: | + Write-Host "::Notice::Delivery to ${{ matrix.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 c26c9d9b85..aeee307245 100644 --- a/Templates/Per Tenant Extension/.github/workflows/CICD.yaml +++ b/Templates/Per Tenant Extension/.github/workflows/CICD.yaml @@ -352,6 +352,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 }}' @@ -362,6 +363,11 @@ jobs: type: 'CD' deploymentEnvironmentsJson: ${{ needs.Initialization.outputs.deploymentEnvironmentsJson }} + - name: Deployment skipped + if: hashFiles('.artifacts/**/*.app') == '' + run: | + Write-Host "::Notice::Deployment to environment ${{ matrix.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 @@ -405,6 +411,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 }}' @@ -415,6 +422,11 @@ jobs: deliveryTarget: ${{ matrix.deliveryTarget }} artifacts: '.artifacts' + - name: Delivery skipped + if: hashFiles('.artifacts/**/*.app') == '' + run: | + Write-Host "::Notice::Delivery to ${{ matrix.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..8a337cbacd 100644 --- a/Workshop/ContinuousDelivery.md +++ b/Workshop/ContinuousDelivery.md @@ -98,6 +98,12 @@ 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/action is skipped when no app artifacts are available. + +This skip behavior prevents delivery errors and ensures that delivery targets are only invoked when there are actual artifacts to deliver. You'll see the Deliver step/action appear as skipped in the workflow summary when this occurs. + 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 5c4e60d256..3fd4475577 100644 --- a/Workshop/ContinuousDeployment.md +++ b/Workshop/ContinuousDeployment.md @@ -86,6 +86,12 @@ 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 + +Deployment jobs automatically skip execution when no app artifacts are available. + +This skip behavior prevents deployment errors and ensures that environments are only targeted when there are actual artifacts to deploy. You'll see the deployment step appear as skipped in the workflow summary when this occurs. + 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? ______________________________________________________________________