From 588f9c6131e9bfb8c29432ee55e7fdc1a542431c Mon Sep 17 00:00:00 2001 From: bcbuild-github-agent <137281497+bcbuild-github-agent@users.noreply.github.com> Date: Thu, 5 Sep 2024 03:59:53 -0700 Subject: [PATCH] Update AL-Go System Files (#27225) Fixes [AB#420000](https://dynamicssmb2.visualstudio.com/1fcb79e7-ab07-432a-a3c6-6cf5a88ba4a5/_workitems/edit/420000) Co-authored-by: aholstrup1 --- .github/AL-Go-Settings.json | 2 +- .github/workflows/CICD.yaml | 139 +++++++++++------- .../DeployReferenceDocumentation.yaml | 41 ++++-- .../workflows/PullPowerPlatformChanges.yaml | 111 ++++++++++++++ .github/workflows/PullRequestHandler.yaml | 41 ++++-- .../workflows/PushPowerPlatformChanges.yaml | 100 +++++++++++++ .github/workflows/Troubleshooting.yaml | 6 +- .../workflows/UpdateGitHubGoSystemFiles.yaml | 24 +-- .github/workflows/_BuildALGoProject.yaml | 68 ++++----- .../_BuildPowerPlatformSolution.yaml | 96 ++++++++++++ .../.AL-Go/cloudDevEnv.ps1 | 37 +++-- .../.AL-Go/localDevEnv.ps1 | 38 +++-- .../.AL-Go/cloudDevEnv.ps1 | 37 +++-- .../.AL-Go/localDevEnv.ps1 | 38 +++-- 14 files changed, 593 insertions(+), 185 deletions(-) create mode 100644 .github/workflows/PullPowerPlatformChanges.yaml create mode 100644 .github/workflows/PushPowerPlatformChanges.yaml create mode 100644 .github/workflows/_BuildPowerPlatformSolution.yaml diff --git a/.github/AL-Go-Settings.json b/.github/AL-Go-Settings.json index 5fd91a46bf..853cc4ea04 100644 --- a/.github/AL-Go-Settings.json +++ b/.github/AL-Go-Settings.json @@ -58,5 +58,5 @@ ], "UpdateALGoSystemFilesEnvironment": "Official-Build", "PullRequestTrigger": "pull_request", - "templateSha": "0476547896ebcd3ba5455b3e0e59b48c0d4a26ca" + "templateSha": "9308ffb724a39179ea32dd55c838f176903a2a5c" } diff --git a/.github/workflows/CICD.yaml b/.github/workflows/CICD.yaml index bfa1b2868c..2ff586e083 100644 --- a/.github/workflows/CICD.yaml +++ b/.github/workflows/CICD.yaml @@ -14,8 +14,10 @@ defaults: shell: powershell permissions: - contents: read actions: read + contents: read + id-token: write + pages: read env: workflowDepth: 2 @@ -39,31 +41,31 @@ jobs: projects: ${{ steps.determineProjectsToBuild.outputs.ProjectsJson }} projectDependenciesJson: ${{ steps.determineProjectsToBuild.outputs.ProjectDependenciesJson }} buildOrderJson: ${{ steps.determineProjectsToBuild.outputs.BuildOrderJson }} + powerPlatformSolutionFolder: ${{ steps.DeterminePowerPlatformSolutionFolder.outputs.powerPlatformSolutionFolder }} workflowDepth: ${{ steps.DetermineWorkflowDepth.outputs.WorkflowDepth }} steps: - name: Dump Workflow Information - uses: microsoft/AL-Go/Actions/DumpWorkflowInfo@4c5bfbca1adebbf997f63882df4b9074a19aac1d + uses: microsoft/AL-Go/Actions/DumpWorkflowInfo@564c339085ae0ffa74c5bde71c15fea7fe54bbf1 with: shell: powershell - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 with: lfs: true - name: Initialize the workflow id: init - uses: microsoft/AL-Go/Actions/WorkflowInitialize@4c5bfbca1adebbf997f63882df4b9074a19aac1d + uses: microsoft/AL-Go/Actions/WorkflowInitialize@564c339085ae0ffa74c5bde71c15fea7fe54bbf1 with: shell: powershell - eventId: "DO0091" - name: Read settings id: ReadSettings - uses: microsoft/AL-Go/Actions/ReadSettings@4c5bfbca1adebbf997f63882df4b9074a19aac1d + uses: microsoft/AL-Go/Actions/ReadSettings@564c339085ae0ffa74c5bde71c15fea7fe54bbf1 with: shell: powershell - get: type + get: type, powerPlatformSolutionFolder - name: Determine Workflow Depth id: DetermineWorkflowDepth @@ -72,14 +74,20 @@ jobs: - name: Determine Projects To Build id: determineProjectsToBuild - uses: microsoft/AL-Go/Actions/DetermineProjectsToBuild@4c5bfbca1adebbf997f63882df4b9074a19aac1d + uses: microsoft/AL-Go/Actions/DetermineProjectsToBuild@564c339085ae0ffa74c5bde71c15fea7fe54bbf1 with: shell: powershell maxBuildDepth: ${{ env.workflowDepth }} + - name: Determine PowerPlatform Solution Folder + id: DeterminePowerPlatformSolutionFolder + if: env.type == 'PTE' + run: | + Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "powerPlatformSolutionFolder=$($env:powerPlatformSolutionFolder)" + - name: Determine Delivery Target Secrets id: DetermineDeliveryTargetSecrets - uses: microsoft/AL-Go/Actions/DetermineDeliveryTargets@4c5bfbca1adebbf997f63882df4b9074a19aac1d + uses: microsoft/AL-Go/Actions/DetermineDeliveryTargets@564c339085ae0ffa74c5bde71c15fea7fe54bbf1 with: shell: powershell projectsJson: '${{ steps.determineProjectsToBuild.outputs.ProjectsJson }}' @@ -87,7 +95,7 @@ jobs: - name: Read secrets id: ReadSecrets - uses: microsoft/AL-Go/Actions/ReadSecrets@4c5bfbca1adebbf997f63882df4b9074a19aac1d + uses: microsoft/AL-Go/Actions/ReadSecrets@564c339085ae0ffa74c5bde71c15fea7fe54bbf1 with: shell: powershell gitHubSecrets: ${{ toJson(secrets) }} @@ -95,7 +103,7 @@ jobs: - name: Determine Delivery Targets id: DetermineDeliveryTargets - uses: microsoft/AL-Go/Actions/DetermineDeliveryTargets@4c5bfbca1adebbf997f63882df4b9074a19aac1d + uses: microsoft/AL-Go/Actions/DetermineDeliveryTargets@564c339085ae0ffa74c5bde71c15fea7fe54bbf1 env: Secrets: '${{ steps.ReadSecrets.outputs.Secrets }}' with: @@ -105,7 +113,7 @@ jobs: - name: Determine Deployment Environments id: DetermineDeploymentEnvironments - uses: microsoft/AL-Go/Actions/DetermineDeploymentEnvironments@4c5bfbca1adebbf997f63882df4b9074a19aac1d + uses: microsoft/AL-Go/Actions/DetermineDeploymentEnvironments@564c339085ae0ffa74c5bde71c15fea7fe54bbf1 env: GITHUB_TOKEN: ${{ github.token }} with: @@ -118,16 +126,16 @@ jobs: runs-on: [ windows-latest ] steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - name: Read settings - uses: microsoft/AL-Go/Actions/ReadSettings@4c5bfbca1adebbf997f63882df4b9074a19aac1d + uses: microsoft/AL-Go/Actions/ReadSettings@564c339085ae0ffa74c5bde71c15fea7fe54bbf1 with: shell: powershell get: templateUrl - name: Check for updates to AL-Go system files - uses: microsoft/AL-Go/Actions/CheckForUpdates@4c5bfbca1adebbf997f63882df4b9074a19aac1d + uses: microsoft/AL-Go/Actions/CheckForUpdates@564c339085ae0ffa74c5bde71c15fea7fe54bbf1 with: shell: powershell templateUrl: ${{ env.templateUrl }} @@ -146,7 +154,6 @@ jobs: with: shell: ${{ needs.Initialization.outputs.githubRunnerShell }} runsOn: ${{ needs.Initialization.outputs.githubRunner }} - parentTelemetryScopeJson: ${{ needs.Initialization.outputs.telemetryScopeJson }} project: ${{ matrix.project }} projectName: ${{ matrix.projectName }} buildMode: ${{ matrix.buildMode }} @@ -170,7 +177,6 @@ jobs: with: shell: ${{ needs.Initialization.outputs.githubRunnerShell }} runsOn: ${{ needs.Initialization.outputs.githubRunner }} - parentTelemetryScopeJson: ${{ needs.Initialization.outputs.telemetryScopeJson }} project: ${{ matrix.project }} projectName: ${{ matrix.projectName }} buildMode: ${{ matrix.buildMode }} @@ -181,13 +187,27 @@ jobs: signArtifacts: true useArtifactCache: true + BuildPP: + needs: [ Initialization ] + if: (!failure()) && (!cancelled()) && needs.Initialization.outputs.powerPlatformSolutionFolder != '' + name: Build PowerPlatform Solution + uses: ./.github/workflows/_BuildPowerPlatformSolution.yaml + secrets: inherit + with: + shell: ${{ needs.Initialization.outputs.githubRunnerShell }} + runsOn: ${{ needs.Initialization.outputs.githubRunner }} + parentTelemetryScopeJson: ${{ needs.Initialization.outputs.telemetryScopeJson }} + project: ${{ needs.Initialization.outputs.powerPlatformSolutionFolder }} + projectName: ${{ needs.Initialization.outputs.powerPlatformSolutionFolder }} + publishArtifacts: ${{ github.ref_name == 'main' || startswith(github.ref_name, 'release/') || startswith(github.ref_name, 'releases/') || needs.Initialization.outputs.deliveryTargetsJson != '[]' || needs.Initialization.outputs.environmentCount > 0 }} + DeployALDoc: needs: [ Initialization, Build ] - if: always() && needs.Build.result == 'Success' && needs.Initialization.outputs.generateALDocArtifact == 1 && github.ref_name == 'main' - runs-on: windows-latest + if: (!cancelled()) && needs.Build.result == 'Success' && needs.Initialization.outputs.generateALDocArtifact == 1 && github.ref_name == 'main' + runs-on: [ windows-latest ] name: Deploy Reference Documentation permissions: - contents: write + contents: read actions: read pages: write id-token: write @@ -196,60 +216,64 @@ jobs: url: ${{ steps.deployment.outputs.page_url }} steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - name: Download artifacts - uses: actions/download-artifact@v4 + uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 with: path: '.artifacts' - name: Read settings - uses: microsoft/AL-Go/Actions/ReadSettings@4c5bfbca1adebbf997f63882df4b9074a19aac1d + uses: microsoft/AL-Go/Actions/ReadSettings@564c339085ae0ffa74c5bde71c15fea7fe54bbf1 with: shell: powershell - name: Setup Pages if: needs.Initialization.outputs.deployALDocArtifact == 1 - uses: actions/configure-pages@v4 + uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b # v5.0.0 - name: Build Reference Documentation - uses: microsoft/AL-Go/Actions/BuildReferenceDocumentation@4c5bfbca1adebbf997f63882df4b9074a19aac1d + uses: microsoft/AL-Go/Actions/BuildReferenceDocumentation@564c339085ae0ffa74c5bde71c15fea7fe54bbf1 with: shell: powershell artifacts: '.artifacts' - name: Upload pages artifact - uses: actions/upload-pages-artifact@v3 + uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3.0.1 with: path: ".aldoc/_site/" - name: Deploy to GitHub Pages if: needs.Initialization.outputs.deployALDocArtifact == 1 id: deployment - uses: actions/deploy-pages@v4 + uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4.0.5 Deploy: - needs: [ Initialization, Build ] - if: always() && needs.Build.result == 'Success' && needs.Initialization.outputs.environmentCount > 0 + needs: [ Initialization, Build, BuildPP ] + if: (!cancelled()) && (needs.Build.result == 'success' || needs.Build.result == 'skipped') && (needs.BuildPP.result == 'success' || needs.BuildPP.result == 'skipped') && needs.Initialization.outputs.environmentCount > 0 strategy: ${{ fromJson(needs.Initialization.outputs.environmentsMatrixJson) }} runs-on: ${{ fromJson(matrix.os) }} name: Deploy to ${{ matrix.environment }} + defaults: + run: + shell: ${{ matrix.shell }} environment: name: ${{ matrix.environment }} url: ${{ steps.Deploy.outputs.environmentUrl }} steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - name: Download artifacts - uses: actions/download-artifact@v4 + uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 with: path: '.artifacts' - name: Read settings - uses: microsoft/AL-Go/Actions/ReadSettings@4c5bfbca1adebbf997f63882df4b9074a19aac1d + uses: microsoft/AL-Go/Actions/ReadSettings@564c339085ae0ffa74c5bde71c15fea7fe54bbf1 with: - shell: powershell + shell: ${{ matrix.shell }} + get: type,powerPlatformSolutionFolder - name: EnvName id: envName @@ -260,27 +284,38 @@ jobs: - name: Read secrets id: ReadSecrets - uses: microsoft/AL-Go/Actions/ReadSecrets@4c5bfbca1adebbf997f63882df4b9074a19aac1d + uses: microsoft/AL-Go/Actions/ReadSecrets@564c339085ae0ffa74c5bde71c15fea7fe54bbf1 with: - shell: powershell + shell: ${{ matrix.shell }} 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' + getSecrets: '${{ steps.envName.outputs.envName }}-AuthContext,${{ steps.envName.outputs.envName }}_AuthContext,AuthContext' - - name: Deploy + - name: Deploy to Business Central id: Deploy - uses: microsoft/AL-Go/Actions/Deploy@4c5bfbca1adebbf997f63882df4b9074a19aac1d + uses: microsoft/AL-Go/Actions/Deploy@564c339085ae0ffa74c5bde71c15fea7fe54bbf1 env: Secrets: '${{ steps.ReadSecrets.outputs.Secrets }}' with: - shell: powershell + shell: ${{ matrix.shell }} environmentName: ${{ matrix.environment }} - artifacts: '.artifacts' + artifactsFolder: '.artifacts' type: 'CD' deploymentEnvironmentsJson: ${{ needs.Initialization.outputs.deploymentEnvironmentsJson }} + - name: Deploy to Power Platform + if: env.type == 'PTE' && env.powerPlatformSolutionFolder != '' + uses: microsoft/AL-Go/Actions/DeployPowerPlatform@564c339085ae0ffa74c5bde71c15fea7fe54bbf1 + env: + Secrets: '${{ steps.ReadSecrets.outputs.Secrets }}' + with: + shell: powershell + environmentName: ${{ matrix.environment }} + artifactsFolder: '.artifacts' + deploymentEnvironmentsJson: ${{ needs.Initialization.outputs.deploymentEnvironmentsJson }} + Deliver: - needs: [ Initialization, Build ] - if: always() && needs.Build.result == 'Success' && needs.Initialization.outputs.deliveryTargetsJson != '[]' + needs: [ Initialization, Build, BuildPP ] + if: (!cancelled()) && (needs.Build.result == 'success' || needs.Build.result == 'skipped') && (needs.BuildPP.result == 'success' || needs.BuildPP.result == 'skipped') && needs.Initialization.outputs.deliveryTargetsJson != '[]' strategy: matrix: deliveryTarget: ${{ fromJson(needs.Initialization.outputs.deliveryTargetsJson) }} @@ -289,28 +324,28 @@ jobs: name: Deliver to ${{ matrix.deliveryTarget }} steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - name: Download artifacts - uses: actions/download-artifact@v4 + uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 with: path: '.artifacts' - name: Read settings - uses: microsoft/AL-Go/Actions/ReadSettings@4c5bfbca1adebbf997f63882df4b9074a19aac1d + uses: microsoft/AL-Go/Actions/ReadSettings@564c339085ae0ffa74c5bde71c15fea7fe54bbf1 with: shell: powershell - name: Read secrets id: ReadSecrets - uses: microsoft/AL-Go/Actions/ReadSecrets@4c5bfbca1adebbf997f63882df4b9074a19aac1d + uses: microsoft/AL-Go/Actions/ReadSecrets@564c339085ae0ffa74c5bde71c15fea7fe54bbf1 with: shell: powershell gitHubSecrets: ${{ toJson(secrets) }} getSecrets: '${{ matrix.deliveryTarget }}Context' - name: Deliver - uses: microsoft/AL-Go/Actions/Deliver@4c5bfbca1adebbf997f63882df4b9074a19aac1d + uses: microsoft/AL-Go/Actions/Deliver@564c339085ae0ffa74c5bde71c15fea7fe54bbf1 env: Secrets: '${{ steps.ReadSecrets.outputs.Secrets }}' with: @@ -321,17 +356,19 @@ jobs: artifacts: '.artifacts' PostProcess: - needs: [ Initialization, Build, Deploy, Deliver, DeployALDoc ] + needs: [ Initialization, Build, BuildPP, Deploy, Deliver, DeployALDoc ] if: (!cancelled()) runs-on: [ windows-latest ] steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - name: Finalize the workflow id: PostProcess - uses: microsoft/AL-Go/Actions/WorkflowPostProcess@4c5bfbca1adebbf997f63882df4b9074a19aac1d + uses: microsoft/AL-Go/Actions/WorkflowPostProcess@564c339085ae0ffa74c5bde71c15fea7fe54bbf1 + env: + GITHUB_TOKEN: ${{ github.token }} with: shell: powershell - eventId: "DO0091" telemetryScopeJson: ${{ needs.Initialization.outputs.telemetryScopeJson }} + currentJobContext: ${{ toJson(job) }} diff --git a/.github/workflows/DeployReferenceDocumentation.yaml b/.github/workflows/DeployReferenceDocumentation.yaml index 90e471b173..d848967b4f 100644 --- a/.github/workflows/DeployReferenceDocumentation.yaml +++ b/.github/workflows/DeployReferenceDocumentation.yaml @@ -4,10 +4,10 @@ on: workflow_dispatch: permissions: - contents: write actions: read - pages: write + contents: read id-token: write + pages: write defaults: run: @@ -26,46 +26,55 @@ jobs: url: ${{ steps.deployment.outputs.page_url }} steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - name: Initialize the workflow id: init - uses: microsoft/AL-Go/Actions/WorkflowInitialize@4c5bfbca1adebbf997f63882df4b9074a19aac1d + uses: microsoft/AL-Go/Actions/WorkflowInitialize@564c339085ae0ffa74c5bde71c15fea7fe54bbf1 with: shell: powershell - eventId: "DO0097" - + - name: Read settings - uses: microsoft/AL-Go/Actions/ReadSettings@4c5bfbca1adebbf997f63882df4b9074a19aac1d + uses: microsoft/AL-Go/Actions/ReadSettings@564c339085ae0ffa74c5bde71c15fea7fe54bbf1 with: shell: powershell - name: Determine Deployment Environments id: DetermineDeploymentEnvironments - uses: microsoft/AL-Go/Actions/DetermineDeploymentEnvironments@4c5bfbca1adebbf997f63882df4b9074a19aac1d + uses: microsoft/AL-Go/Actions/DetermineDeploymentEnvironments@564c339085ae0ffa74c5bde71c15fea7fe54bbf1 env: GITHUB_TOKEN: ${{ github.token }} with: shell: powershell getEnvironments: 'github-pages' type: 'Publish' - + - name: Setup Pages if: steps.DetermineDeploymentEnvironments.outputs.deployALDocArtifact == 1 - uses: actions/configure-pages@v4 - + uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b # v5.0.0 + - name: Build Reference Documentation - uses: microsoft/AL-Go/Actions/BuildReferenceDocumentation@4c5bfbca1adebbf997f63882df4b9074a19aac1d + uses: microsoft/AL-Go/Actions/BuildReferenceDocumentation@564c339085ae0ffa74c5bde71c15fea7fe54bbf1 with: shell: powershell artifacts: 'latest' - + - name: Upload pages artifact - uses: actions/upload-pages-artifact@v3 + uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3.0.1 with: path: ".aldoc/_site/" - + - name: Deploy to GitHub Pages if: steps.DetermineDeploymentEnvironments.outputs.deployALDocArtifact == 1 id: deployment - uses: actions/deploy-pages@v4 + uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4.0.5 + + - name: Finalize the workflow + if: always() + uses: microsoft/AL-Go/Actions/WorkflowPostProcess@564c339085ae0ffa74c5bde71c15fea7fe54bbf1 + env: + GITHUB_TOKEN: ${{ github.token }} + with: + shell: powershell + telemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }} + currentJobContext: ${{ toJson(job) }} diff --git a/.github/workflows/PullPowerPlatformChanges.yaml b/.github/workflows/PullPowerPlatformChanges.yaml new file mode 100644 index 0000000000..5781dc153b --- /dev/null +++ b/.github/workflows/PullPowerPlatformChanges.yaml @@ -0,0 +1,111 @@ +name: ' Pull Power Platform changes' + +on: + workflow_dispatch: + inputs: + environment: + description: Environment to pull changes from + required: true + solutionFolder: + description: Folder name of the Power Platform solution (leave empty to use AL-Go setting) + required: false + directCommit: + description: Direct Commit? + type: boolean + default: false + useGhTokenWorkflow: + description: Use GhTokenWorkflow for PR/Commit? + type: boolean + default: false + +permissions: + actions: read + contents: write + id-token: write + pull-requests: write + +defaults: + run: + shell: powershell + +jobs: + PullChanges: + runs-on: [windows-latest] + name: Pull changes from ${{ inputs.environment }} + steps: + - name: Checkout + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + + - name: Initialize the workflow + id: init + uses: microsoft/AL-Go/Actions/WorkflowInitialize@564c339085ae0ffa74c5bde71c15fea7fe54bbf1 + with: + shell: powershell + + - name: EnvName + env: + _environment: ${{ inputs.environment }} + run: | + $errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0 + $envName = "$env:_environment".Split(' ')[0] + Add-Content -encoding utf8 -Path $env:GITHUB_ENV -Value "envName=$envName" + + - name: Read settings + uses: microsoft/AL-Go/Actions/ReadSettings@564c339085ae0ffa74c5bde71c15fea7fe54bbf1 + with: + shell: powershell + get: powerPlatformSolutionFolder + + - name: Read secrets + id: ReadSecrets + uses: microsoft/AL-Go/Actions/ReadSecrets@564c339085ae0ffa74c5bde71c15fea7fe54bbf1 + with: + shell: powershell + gitHubSecrets: ${{ toJson(secrets) }} + getSecrets: '${{ env.envName }}-AuthContext,${{ env.envName }}_AuthContext,AuthContext,TokenForPush' + useGhTokenWorkflowForPush: '${{ github.event.inputs.useGhTokenWorkflow }}' + + - name: Determine Deployment Environments + id: DetermineDeploymentEnvironments + uses: microsoft/AL-Go/Actions/DetermineDeploymentEnvironments@564c339085ae0ffa74c5bde71c15fea7fe54bbf1 + env: + GITHUB_TOKEN: ${{ github.token }} + with: + shell: powershell + getEnvironments: ${{ inputs.environment }} + type: 'All' + + - name: Set Power Platform solution folder + env: + _solutionFolder: ${{ inputs.solutionFolder }} + run: | + $errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0 + $solutionFolder = $env:_solutionFolder + if ($solutionFolder -eq '') { + Write-Host "Solution folder is not provided. Taking the folder from AL-Go settings" + $solutionFolder = $env:powerPlatformSolutionFolder + } + Write-Host "Solution folder: $solutionFolder" + Add-Content -encoding utf8 -Path $env:GITHUB_ENV -Value "solutionFolder=$solutionFolder" + + - name: Pull changes from Power Platform environment + uses: microsoft/AL-Go/Actions/PullPowerPlatformChanges@564c339085ae0ffa74c5bde71c15fea7fe54bbf1 + env: + Secrets: '${{ steps.ReadSecrets.outputs.Secrets }}' + with: + shell: powershell + token: ${{ steps.ReadSecrets.outputs.TokenForPush }} + directCommit: ${{ inputs.directCommit }} + environmentName: ${{ inputs.environment }} + solutionFolder: ${{ env.solutionFolder }} + deploymentEnvironmentsJson: ${{ steps.DetermineDeploymentEnvironments.outputs.deploymentEnvironmentsJson }} + + - name: Finalize the workflow + if: always() + uses: microsoft/AL-Go/Actions/WorkflowPostProcess@564c339085ae0ffa74c5bde71c15fea7fe54bbf1 + env: + GITHUB_TOKEN: ${{ github.token }} + with: + shell: powershell + telemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }} + currentJobContext: ${{ toJson(job) }} diff --git a/.github/workflows/PullRequestHandler.yaml b/.github/workflows/PullRequestHandler.yaml index 0b377c6d2f..f8cb7637dd 100644 --- a/.github/workflows/PullRequestHandler.yaml +++ b/.github/workflows/PullRequestHandler.yaml @@ -13,8 +13,9 @@ defaults: shell: powershell permissions: - contents: read actions: read + contents: read + id-token: write pull-requests: read env: @@ -25,16 +26,15 @@ env: jobs: PregateCheck: if: (github.event.pull_request.base.repo.full_name != github.event.pull_request.head.repo.full_name) && (github.event_name != 'pull_request') - runs-on: [ windows-latest ] + runs-on: windows-latest steps: - - uses: microsoft/AL-Go/Actions/VerifyPRChanges@4c5bfbca1adebbf997f63882df4b9074a19aac1d + - uses: microsoft/AL-Go/Actions/VerifyPRChanges@564c339085ae0ffa74c5bde71c15fea7fe54bbf1 Initialization: needs: [ PregateCheck ] if: (!failure() && !cancelled()) runs-on: [ windows-latest ] outputs: - telemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }} githubRunner: ${{ steps.ReadSettings.outputs.GitHubRunnerJson }} githubRunnerShell: ${{ steps.ReadSettings.outputs.GitHubRunnerShell }} projects: ${{ steps.determineProjectsToBuild.outputs.ProjectsJson }} @@ -42,28 +42,28 @@ jobs: buildOrderJson: ${{ steps.determineProjectsToBuild.outputs.BuildOrderJson }} baselineWorkflowRunId: ${{ steps.determineProjectsToBuild.outputs.BaselineWorkflowRunId }} workflowDepth: ${{ steps.DetermineWorkflowDepth.outputs.WorkflowDepth }} + telemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }} steps: - name: Dump Workflow Information - uses: microsoft/AL-Go/Actions/DumpWorkflowInfo@4c5bfbca1adebbf997f63882df4b9074a19aac1d + uses: microsoft/AL-Go/Actions/DumpWorkflowInfo@564c339085ae0ffa74c5bde71c15fea7fe54bbf1 with: shell: powershell - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 with: lfs: true - ref: refs/pull/${{ github.event.number }}/merge + ref: ${{ github.event_name == 'pull_request' && github.sha || format('refs/pull/{0}/merge', github.event.pull_request.number) }} - name: Initialize the workflow id: init - uses: microsoft/AL-Go/Actions/WorkflowInitialize@4c5bfbca1adebbf997f63882df4b9074a19aac1d + uses: microsoft/AL-Go/Actions/WorkflowInitialize@564c339085ae0ffa74c5bde71c15fea7fe54bbf1 with: shell: powershell - eventId: "DO0104" - name: Read settings id: ReadSettings - uses: microsoft/AL-Go/Actions/ReadSettings@4c5bfbca1adebbf997f63882df4b9074a19aac1d + uses: microsoft/AL-Go/Actions/ReadSettings@564c339085ae0ffa74c5bde71c15fea7fe54bbf1 with: shell: powershell @@ -74,7 +74,7 @@ jobs: - name: Determine Projects To Build id: determineProjectsToBuild - uses: microsoft/AL-Go/Actions/DetermineProjectsToBuild@4c5bfbca1adebbf997f63882df4b9074a19aac1d + uses: microsoft/AL-Go/Actions/DetermineProjectsToBuild@564c339085ae0ffa74c5bde71c15fea7fe54bbf1 with: shell: powershell maxBuildDepth: ${{ env.workflowDepth }} @@ -92,8 +92,7 @@ jobs: with: shell: ${{ needs.Initialization.outputs.githubRunnerShell }} runsOn: ${{ needs.Initialization.outputs.githubRunner }} - checkoutRef: refs/pull/${{ github.event.number }}/merge - parentTelemetryScopeJson: ${{ needs.Initialization.outputs.telemetryScopeJson }} + checkoutRef: ${{ github.event_name == 'pull_request' && github.sha || format('refs/pull/{0}/merge', github.event.pull_request.number) }} project: ${{ matrix.project }} projectName: ${{ matrix.projectName }} buildMode: ${{ matrix.buildMode }} @@ -116,8 +115,7 @@ jobs: with: shell: ${{ needs.Initialization.outputs.githubRunnerShell }} runsOn: ${{ needs.Initialization.outputs.githubRunner }} - checkoutRef: refs/pull/${{ github.event.number }}/merge - parentTelemetryScopeJson: ${{ needs.Initialization.outputs.telemetryScopeJson }} + checkoutRef: ${{ github.event_name == 'pull_request' && github.sha || format('refs/pull/{0}/merge', github.event.pull_request.number) }} project: ${{ matrix.project }} projectName: ${{ matrix.projectName }} buildMode: ${{ matrix.buildMode }} @@ -135,8 +133,19 @@ jobs: steps: - name: Pull Request Status Check id: PullRequestStatusCheck - uses: microsoft/AL-Go/Actions/PullRequestStatusCheck@4c5bfbca1adebbf997f63882df4b9074a19aac1d + uses: microsoft/AL-Go/Actions/PullRequestStatusCheck@564c339085ae0ffa74c5bde71c15fea7fe54bbf1 + env: + GITHUB_TOKEN: ${{ github.token }} + with: + shell: powershell + + - name: Finalize the workflow + id: PostProcess + uses: microsoft/AL-Go/Actions/WorkflowPostProcess@564c339085ae0ffa74c5bde71c15fea7fe54bbf1 + if: success() || failure() env: GITHUB_TOKEN: ${{ github.token }} with: shell: powershell + telemetryScopeJson: ${{ needs.Initialization.outputs.telemetryScopeJson }} + currentJobContext: ${{ toJson(job) }} diff --git a/.github/workflows/PushPowerPlatformChanges.yaml b/.github/workflows/PushPowerPlatformChanges.yaml new file mode 100644 index 0000000000..6c037390eb --- /dev/null +++ b/.github/workflows/PushPowerPlatformChanges.yaml @@ -0,0 +1,100 @@ +name: " Push Power Platform changes" + +on: + workflow_dispatch: + inputs: + environment: + description: Environment to push changes to + required: true + solutionFolder: + description: Folder name of the Power Platform solution (leave empty to use AL-Go setting) + required: false + +permissions: + actions: read + contents: read + id-token: write + +defaults: + run: + shell: powershell + +jobs: + PushChanges: + runs-on: [windows-latest] + name: Push changes to ${{ inputs.environment }} + steps: + - name: Checkout + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + + - name: Initialize the workflow + id: init + uses: microsoft/AL-Go/Actions/WorkflowInitialize@564c339085ae0ffa74c5bde71c15fea7fe54bbf1 + with: + shell: powershell + + - name: EnvName + env: + _environment: ${{ inputs.environment }} + run: | + $errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0 + # Environment names can contains spaces and tags (like (PROD) etc. We need to remove them to get the correct environment name) + $envName = "$env:_environment".Split(' ')[0] + Add-Content -encoding utf8 -Path $env:GITHUB_ENV -Value "envName=$envName" + + - name: Read settings + uses: microsoft/AL-Go/Actions/ReadSettings@564c339085ae0ffa74c5bde71c15fea7fe54bbf1 + with: + shell: powershell + get: powerPlatformSolutionFolder + + - name: Read secrets + id: ReadSecrets + uses: microsoft/AL-Go/Actions/ReadSecrets@564c339085ae0ffa74c5bde71c15fea7fe54bbf1 + with: + shell: powershell + gitHubSecrets: ${{ toJson(secrets) }} + getSecrets: '${{ env.envName }}-AuthContext,${{ env.envName }}_AuthContext,AuthContext' + + - name: Determine Deployment Environments + id: DetermineDeploymentEnvironments + uses: microsoft/AL-Go/Actions/DetermineDeploymentEnvironments@564c339085ae0ffa74c5bde71c15fea7fe54bbf1 + env: + GITHUB_TOKEN: ${{ github.token }} + with: + shell: powershell + getEnvironments: ${{ inputs.environment }} + type: 'All' + + - name: Set Power Platform solution folder + env: + _solutionFolder: ${{ inputs.solutionFolder }} + run: | + $errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0 + $solutionFolder = $env:_solutionFolder + if ($solutionFolder -eq '') { + Write-Host "Solution folder is not provided. Taking the folder from AL-Go settings" + $solutionFolder = $env:powerPlatformSolutionFolder + } + Write-Host "Solution folder: $solutionFolder" + Add-Content -encoding utf8 -Path $env:GITHUB_ENV -Value "solutionFolder=$solutionFolder" + + - name: Export and push changes to Power Platform + uses: microsoft/AL-Go/Actions/DeployPowerPlatform@564c339085ae0ffa74c5bde71c15fea7fe54bbf1 + env: + Secrets: '${{ steps.ReadSecrets.outputs.Secrets }}' + with: + shell: powershell + environmentName: ${{ inputs.environment }} + solutionFolder: ${{ env.solutionFolder }} + deploymentEnvironmentsJson: ${{ steps.DetermineDeploymentEnvironments.outputs.deploymentEnvironmentsJson }} + + - name: Finalize the workflow + if: always() + uses: microsoft/AL-Go/Actions/WorkflowPostProcess@564c339085ae0ffa74c5bde71c15fea7fe54bbf1 + env: + GITHUB_TOKEN: ${{ github.token }} + with: + shell: powershell + telemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }} + currentJobContext: ${{ toJson(job) }} diff --git a/.github/workflows/Troubleshooting.yaml b/.github/workflows/Troubleshooting.yaml index ca8f8f5f20..d9f33a6f7a 100644 --- a/.github/workflows/Troubleshooting.yaml +++ b/.github/workflows/Troubleshooting.yaml @@ -9,8 +9,8 @@ on: default: false permissions: - contents: read actions: read + contents: read defaults: run: @@ -25,12 +25,12 @@ jobs: runs-on: [ windows-latest ] steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 with: lfs: true - name: Troubleshooting - uses: microsoft/AL-Go/Actions/Troubleshooting@4c5bfbca1adebbf997f63882df4b9074a19aac1d + uses: microsoft/AL-Go/Actions/Troubleshooting@564c339085ae0ffa74c5bde71c15fea7fe54bbf1 with: shell: powershell gitHubSecrets: ${{ toJson(secrets) }} diff --git a/.github/workflows/UpdateGitHubGoSystemFiles.yaml b/.github/workflows/UpdateGitHubGoSystemFiles.yaml index aad5acc4c4..42642df61b 100644 --- a/.github/workflows/UpdateGitHubGoSystemFiles.yaml +++ b/.github/workflows/UpdateGitHubGoSystemFiles.yaml @@ -17,7 +17,9 @@ on: default: false permissions: + actions: read contents: read + id-token: write defaults: run: @@ -29,34 +31,34 @@ env: jobs: UpdateALGoSystemFiles: - needs: [ ] + name: 'Update AL-Go System Files' environment: Official-Build + needs: [ ] runs-on: [ windows-latest ] steps: - name: Dump Workflow Information - uses: microsoft/AL-Go/Actions/DumpWorkflowInfo@4c5bfbca1adebbf997f63882df4b9074a19aac1d + uses: microsoft/AL-Go/Actions/DumpWorkflowInfo@564c339085ae0ffa74c5bde71c15fea7fe54bbf1 with: shell: powershell - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - name: Initialize the workflow id: init - uses: microsoft/AL-Go/Actions/WorkflowInitialize@4c5bfbca1adebbf997f63882df4b9074a19aac1d + uses: microsoft/AL-Go/Actions/WorkflowInitialize@564c339085ae0ffa74c5bde71c15fea7fe54bbf1 with: shell: powershell - eventId: "DO0098" - name: Read settings - uses: microsoft/AL-Go/Actions/ReadSettings@4c5bfbca1adebbf997f63882df4b9074a19aac1d + uses: microsoft/AL-Go/Actions/ReadSettings@564c339085ae0ffa74c5bde71c15fea7fe54bbf1 with: shell: powershell get: templateUrl - name: Read secrets id: ReadSecrets - uses: microsoft/AL-Go/Actions/ReadSecrets@4c5bfbca1adebbf997f63882df4b9074a19aac1d + uses: microsoft/AL-Go/Actions/ReadSecrets@564c339085ae0ffa74c5bde71c15fea7fe54bbf1 with: shell: powershell gitHubSecrets: ${{ toJson(secrets) }} @@ -92,7 +94,7 @@ jobs: Add-Content -Encoding UTF8 -Path $env:GITHUB_ENV -Value "downloadLatest=$downloadLatest" - name: Update AL-Go system files - uses: microsoft/AL-Go/Actions/CheckForUpdates@4c5bfbca1adebbf997f63882df4b9074a19aac1d + uses: microsoft/AL-Go/Actions/CheckForUpdates@564c339085ae0ffa74c5bde71c15fea7fe54bbf1 with: shell: powershell token: ${{ fromJson(steps.ReadSecrets.outputs.Secrets).ghTokenWorkflow }} @@ -103,8 +105,10 @@ jobs: - name: Finalize the workflow if: always() - uses: microsoft/AL-Go/Actions/WorkflowPostProcess@4c5bfbca1adebbf997f63882df4b9074a19aac1d + uses: microsoft/AL-Go/Actions/WorkflowPostProcess@564c339085ae0ffa74c5bde71c15fea7fe54bbf1 + env: + GITHUB_TOKEN: ${{ github.token }} with: shell: powershell - eventId: "DO0098" telemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }} + currentJobContext: ${{ toJson(job) }} diff --git a/.github/workflows/_BuildALGoProject.yaml b/.github/workflows/_BuildALGoProject.yaml index ebb7055193..4cdec74dc0 100644 --- a/.github/workflows/_BuildALGoProject.yaml +++ b/.github/workflows/_BuildALGoProject.yaml @@ -1,6 +1,6 @@ -name: '_Build AL-GO project' +name: '_Build AL-Go project' -run-name: 'Build project ${{ inputs.project }}' +run-name: 'Build ${{ inputs.project }}' on: workflow_call: @@ -11,13 +11,13 @@ on: default: powershell type: string runsOn: - description: JSON-formatted string og the types of machine to run the build job on + description: JSON-formatted string of the types of machine to run the build job on required: true type: string checkoutRef: description: Ref to checkout required: false - default: ${{ github.ref }} + default: ${{ github.sha }} type: string project: description: Name of the built project @@ -67,10 +67,11 @@ on: description: Flag determining whether to use the Artifacts Cache type: boolean default: false - parentTelemetryScopeJson: - description: Specifies the telemetry scope for the telemetry signal - required: false - type: string + +permissions: + actions: read + contents: read + id-token: write env: ALGoOrgSettings: ${{ vars.ALGoOrgSettings }} @@ -86,13 +87,13 @@ jobs: name: ${{ inputs.projectName }} (${{ inputs.buildMode }}) steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 with: ref: ${{ inputs.checkoutRef }} lfs: true - name: Read settings - uses: microsoft/AL-Go/Actions/ReadSettings@4c5bfbca1adebbf997f63882df4b9074a19aac1d + uses: microsoft/AL-Go/Actions/ReadSettings@564c339085ae0ffa74c5bde71c15fea7fe54bbf1 with: shell: ${{ inputs.shell }} project: ${{ inputs.project }} @@ -101,30 +102,29 @@ jobs: - name: Read secrets id: ReadSecrets if: github.event_name != 'pull_request' - uses: microsoft/AL-Go/Actions/ReadSecrets@4c5bfbca1adebbf997f63882df4b9074a19aac1d + uses: microsoft/AL-Go/Actions/ReadSecrets@564c339085ae0ffa74c5bde71c15fea7fe54bbf1 with: shell: ${{ inputs.shell }} gitHubSecrets: ${{ toJson(secrets) }} - getSecrets: '${{ inputs.secrets }},appDependencyProbingPathsSecrets' + getSecrets: '${{ inputs.secrets }},appDependencyProbingPathsSecrets,AZURE_CREDENTIALS' - name: Determine ArtifactUrl - uses: microsoft/AL-Go/Actions/DetermineArtifactUrl@4c5bfbca1adebbf997f63882df4b9074a19aac1d + uses: microsoft/AL-Go/Actions/DetermineArtifactUrl@564c339085ae0ffa74c5bde71c15fea7fe54bbf1 id: determineArtifactUrl with: shell: ${{ inputs.shell }} - parentTelemetryScopeJson: ${{ inputs.parentTelemetryScopeJson }} project: ${{ inputs.project }} - name: Cache Business Central Artifacts if: env.useCompilerFolder == 'True' && inputs.useArtifactCache && env.artifactCacheKey - uses: actions/cache@v4 + uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 with: path: .artifactcache key: ${{ env.artifactCacheKey }} - name: Download Project Dependencies id: DownloadProjectDependencies - uses: microsoft/AL-Go/Actions/DownloadProjectDependencies@4c5bfbca1adebbf997f63882df4b9074a19aac1d + uses: microsoft/AL-Go/Actions/DownloadProjectDependencies@564c339085ae0ffa74c5bde71c15fea7fe54bbf1 env: Secrets: '${{ steps.ReadSecrets.outputs.Secrets }}' with: @@ -135,13 +135,12 @@ jobs: baselineWorkflowRunId: ${{ inputs.baselineWorkflowRunId }} - name: Build - uses: microsoft/AL-Go/Actions/RunPipeline@4c5bfbca1adebbf997f63882df4b9074a19aac1d + uses: microsoft/AL-Go/Actions/RunPipeline@564c339085ae0ffa74c5bde71c15fea7fe54bbf1 env: Secrets: '${{ steps.ReadSecrets.outputs.Secrets }}' BuildMode: ${{ inputs.buildMode }} with: shell: ${{ inputs.shell }} - parentTelemetryScopeJson: ${{ inputs.parentTelemetryScopeJson }} artifact: ${{ env.artifact }} project: ${{ inputs.project }} buildMode: ${{ inputs.buildMode }} @@ -151,16 +150,15 @@ jobs: - name: Sign if: inputs.signArtifacts && env.doNotSignApps == 'False' && env.keyVaultCodesignCertificateName != '' id: sign - uses: microsoft/AL-Go/Actions/Sign@4c5bfbca1adebbf997f63882df4b9074a19aac1d + uses: microsoft/AL-Go/Actions/Sign@564c339085ae0ffa74c5bde71c15fea7fe54bbf1 with: shell: ${{ needs.Initialization.outputs.githubRunnerShell }} - azureCredentialsJson: ${{ secrets.AZURE_CREDENTIALS }} + azureCredentialsJson: '${{ fromJson(steps.ReadSecrets.outputs.Secrets).AZURE_CREDENTIALS }}' pathToFiles: '${{ inputs.project }}/.buildartifacts/Apps/*.app' - parentTelemetryScopeJson: ${{ needs.Initialization.outputs.telemetryScopeJson }} - name: Calculate Artifact names id: calculateArtifactsNames - uses: microsoft/AL-Go/Actions/CalculateArtifactNames@4c5bfbca1adebbf997f63882df4b9074a19aac1d + uses: microsoft/AL-Go/Actions/CalculateArtifactNames@564c339085ae0ffa74c5bde71c15fea7fe54bbf1 if: success() || failure() with: shell: ${{ inputs.shell }} @@ -170,7 +168,7 @@ jobs: - name: Upload thisbuild artifacts - apps if: inputs.publishThisBuildArtifacts - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 with: name: ${{ steps.calculateArtifactsNames.outputs.ThisBuildAppsArtifactsName }} path: '${{ inputs.project }}/.buildartifacts/Apps/' @@ -179,7 +177,7 @@ jobs: - name: Upload thisbuild artifacts - dependencies if: inputs.publishThisBuildArtifacts - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 with: name: ${{ steps.calculateArtifactsNames.outputs.ThisBuildDependenciesArtifactsName }} path: '${{ inputs.project }}/.buildartifacts/Dependencies/' @@ -188,7 +186,7 @@ jobs: - name: Upload thisbuild artifacts - test apps if: inputs.publishThisBuildArtifacts - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 with: name: ${{ steps.calculateArtifactsNames.outputs.ThisBuildTestAppsArtifactsName }} path: '${{ inputs.project }}/.buildartifacts/TestApps/' @@ -196,7 +194,7 @@ jobs: retention-days: 1 - name: Publish artifacts - apps - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 if: inputs.publishArtifacts with: name: ${{ steps.calculateArtifactsNames.outputs.AppsArtifactsName }} @@ -204,7 +202,7 @@ jobs: if-no-files-found: ignore - name: Publish artifacts - dependencies - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 if: inputs.publishArtifacts && env.generateDependencyArtifact == 'True' with: name: ${{ steps.calculateArtifactsNames.outputs.DependenciesArtifactsName }} @@ -212,7 +210,7 @@ jobs: if-no-files-found: ignore - name: Publish artifacts - test apps - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 if: inputs.publishArtifacts with: name: ${{ steps.calculateArtifactsNames.outputs.TestAppsArtifactsName }} @@ -220,7 +218,7 @@ jobs: if-no-files-found: ignore - name: Publish artifacts - build output - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 if: (success() || failure()) && (hashFiles(format('{0}/BuildOutput.txt',inputs.project)) != '') with: name: ${{ steps.calculateArtifactsNames.outputs.BuildOutputArtifactsName }} @@ -228,7 +226,7 @@ jobs: if-no-files-found: ignore - name: Publish artifacts - container event log - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 if: (failure()) && (hashFiles(format('{0}/ContainerEventLog.evtx',inputs.project)) != '') with: name: ${{ steps.calculateArtifactsNames.outputs.ContainerEventLogArtifactsName }} @@ -236,7 +234,7 @@ jobs: if-no-files-found: ignore - name: Publish artifacts - test results - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 if: (success() || failure()) && (hashFiles(format('{0}/TestResults.xml',inputs.project)) != '') with: name: ${{ steps.calculateArtifactsNames.outputs.TestResultsArtifactsName }} @@ -244,7 +242,7 @@ jobs: if-no-files-found: ignore - name: Publish artifacts - bcpt test results - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 if: (success() || failure()) && (hashFiles(format('{0}/bcptTestResults.json',inputs.project)) != '') with: name: ${{ steps.calculateArtifactsNames.outputs.BcptTestResultsArtifactsName }} @@ -254,16 +252,14 @@ jobs: - name: Analyze Test Results id: analyzeTestResults if: (success() || failure()) && env.doNotRunTests == 'False' - uses: microsoft/AL-Go/Actions/AnalyzeTests@4c5bfbca1adebbf997f63882df4b9074a19aac1d + uses: microsoft/AL-Go/Actions/AnalyzeTests@564c339085ae0ffa74c5bde71c15fea7fe54bbf1 with: shell: ${{ inputs.shell }} - parentTelemetryScopeJson: ${{ inputs.parentTelemetryScopeJson }} project: ${{ inputs.project }} - name: Cleanup if: always() - uses: microsoft/AL-Go/Actions/PipelineCleanup@4c5bfbca1adebbf997f63882df4b9074a19aac1d + uses: microsoft/AL-Go/Actions/PipelineCleanup@564c339085ae0ffa74c5bde71c15fea7fe54bbf1 with: shell: ${{ inputs.shell }} - parentTelemetryScopeJson: ${{ inputs.parentTelemetryScopeJson }} project: ${{ inputs.project }} diff --git a/.github/workflows/_BuildPowerPlatformSolution.yaml b/.github/workflows/_BuildPowerPlatformSolution.yaml new file mode 100644 index 0000000000..b481af887f --- /dev/null +++ b/.github/workflows/_BuildPowerPlatformSolution.yaml @@ -0,0 +1,96 @@ +name: '_Build PowerPlatform Solution' + +run-name: 'Build PowerPlatform Solution' + +on: + workflow_call: + inputs: + shell: + description: Shell in which you want to run the action (powershell or pwsh) + required: false + default: powershell + type: string + runsOn: + description: JSON-formatted string of the types of machine to run the build job on + required: true + type: string + checkoutRef: + description: Ref to checkout + required: false + default: ${{ github.sha }} + type: string + project: + description: Name of the built project + required: true + type: string + projectName: + description: Friendly name of the built project + required: true + type: string + publishArtifacts: + description: Flag indicating whether the artifacts should be published + type: boolean + default: false + artifactsNameSuffix: + description: Suffix to add to the artifacts names + required: false + default: '' + type: string + parentTelemetryScopeJson: + description: Specifies the telemetry scope for the telemetry signal + required: false + type: string + +env: + ALGoOrgSettings: ${{ vars.ALGoOrgSettings }} + ALGoRepoSettings: ${{ vars.ALGoRepoSettings }} + +jobs: + Build: + needs: [ ] + runs-on: ${{ fromJson(inputs.runsOn) }} + defaults: + run: + shell: ${{ inputs.shell }} + name: '${{ inputs.projectName }}' + steps: + - name: Checkout + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + with: + ref: ${{ inputs.checkoutRef }} + lfs: true + + - name: Read settings + uses: microsoft/AL-Go/Actions/ReadSettings@564c339085ae0ffa74c5bde71c15fea7fe54bbf1 + with: + shell: ${{ inputs.shell }} + project: ${{ inputs.project }} + get: type,powerPlatformSolutionFolder,appRevision,appBuild + + - name: Build + uses: microsoft/AL-Go/Actions/BuildPowerPlatform@564c339085ae0ffa74c5bde71c15fea7fe54bbf1 + with: + shell: ${{ inputs.shell }} + solutionFolder: ${{ inputs.project }} + outputFolder: ${{ inputs.project }}/.buildartifacts/_PowerPlatformSolution/ + outputFileName: ${{ inputs.project }} + appRevision: ${{ env.appRevision }} + appBuild: ${{ env.appBuild }} + + - name: Calculate Artifact names + id: calculateArtifactsNames + uses: microsoft/AL-Go/Actions/CalculateArtifactNames@564c339085ae0ffa74c5bde71c15fea7fe54bbf1 + if: success() || failure() + with: + shell: ${{ inputs.shell }} + project: ${{ inputs.project }} + buildMode: 'default' + suffix: ${{ inputs.artifactsNameSuffix }} + + - name: Publish artifacts - Power Platform Solution + uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 + if: inputs.publishArtifacts + with: + name: ${{ steps.calculateArtifactsNames.outputs.PowerPlatformSolutionArtifactsName }} + path: '${{ inputs.project }}/.buildartifacts/_PowerPlatformSolution/' + if-no-files-found: ignore diff --git a/Build/projects/1st Party Apps (W1)/.AL-Go/cloudDevEnv.ps1 b/Build/projects/1st Party Apps (W1)/.AL-Go/cloudDevEnv.ps1 index 38799b4107..1b8ca3f1a9 100644 --- a/Build/projects/1st Party Apps (W1)/.AL-Go/cloudDevEnv.ps1 +++ b/Build/projects/1st Party Apps (W1)/.AL-Go/cloudDevEnv.ps1 @@ -6,11 +6,27 @@ Param( [string] $environmentName = "", [bool] $reuseExistingEnvironment, - [switch] $fromVSCode + [switch] $fromVSCode, + [switch] $clean ) $errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0 +function DownloadHelperFile { + param( + [string] $url, + [string] $folder + ) + + $prevProgressPreference = $ProgressPreference; $ProgressPreference = 'SilentlyContinue' + $name = [System.IO.Path]::GetFileName($url) + Write-Host "Downloading $name from $url" + $path = Join-Path $folder $name + Invoke-WebRequest -UseBasicParsing -uri $url -OutFile $path + $ProgressPreference = $prevProgressPreference + return $path +} + try { Clear-Host Write-Host @@ -24,17 +40,11 @@ Write-Host -ForegroundColor Yellow @' '@ -$webClient = New-Object System.Net.WebClient -$webClient.CachePolicy = New-Object System.Net.Cache.RequestCachePolicy -argumentList ([System.Net.Cache.RequestCacheLevel]::NoCacheNoStore) -$webClient.Encoding = [System.Text.Encoding]::UTF8 -$GitHubHelperUrl = 'https://raw.githubusercontent.com/microsoft/AL-Go/4c5bfbca1adebbf997f63882df4b9074a19aac1d/Actions/Github-Helper.psm1' -Write-Host "Downloading GitHub Helper module from $GitHubHelperUrl" -$GitHubHelperPath = "$([System.IO.Path]::GetTempFileName()).psm1" -$webClient.DownloadFile($GitHubHelperUrl, $GitHubHelperPath) -$ALGoHelperUrl = 'https://raw.githubusercontent.com/microsoft/AL-Go/4c5bfbca1adebbf997f63882df4b9074a19aac1d/Actions/AL-Go-Helper.ps1' -Write-Host "Downloading AL-Go Helper script from $ALGoHelperUrl" -$ALGoHelperPath = "$([System.IO.Path]::GetTempFileName()).ps1" -$webClient.DownloadFile($ALGoHelperUrl, $ALGoHelperPath) +$tmpFolder = Join-Path ([System.IO.Path]::GetTempPath()) "$([Guid]::NewGuid().ToString())" +New-Item -Path $tmpFolder -ItemType Directory -Force | Out-Null +$GitHubHelperPath = DownloadHelperFile -url 'https://raw.githubusercontent.com/microsoft/AL-Go/564c339085ae0ffa74c5bde71c15fea7fe54bbf1/Actions/Github-Helper.psm1' -folder $tmpFolder +$ALGoHelperPath = DownloadHelperFile -url 'https://raw.githubusercontent.com/microsoft/AL-Go/564c339085ae0ffa74c5bde71c15fea7fe54bbf1/Actions/AL-Go-Helper.ps1' -folder $tmpFolder +DownloadHelperFile -url 'https://raw.githubusercontent.com/microsoft/AL-Go/564c339085ae0ffa74c5bde71c15fea7fe54bbf1/Actions/Packages.json' -folder $tmpFolder | Out-Null Import-Module $GitHubHelperPath . $ALGoHelperPath -local @@ -78,7 +88,8 @@ CreateDevEnv ` -environmentName $environmentName ` -reuseExistingEnvironment:$reuseExistingEnvironment ` -baseFolder $baseFolder ` - -project $project + -project $project ` + -clean:$clean } catch { Write-Host -ForegroundColor Red "Error: $($_.Exception.Message)`nStacktrace: $($_.scriptStackTrace)" diff --git a/Build/projects/1st Party Apps (W1)/.AL-Go/localDevEnv.ps1 b/Build/projects/1st Party Apps (W1)/.AL-Go/localDevEnv.ps1 index a561a18d8f..c98482bd3d 100644 --- a/Build/projects/1st Party Apps (W1)/.AL-Go/localDevEnv.ps1 +++ b/Build/projects/1st Party Apps (W1)/.AL-Go/localDevEnv.ps1 @@ -5,15 +5,32 @@ # Param( [string] $containerName = "", + [ValidateSet("UserPassword", "Windows")] [string] $auth = "", [pscredential] $credential = $null, [string] $licenseFileUrl = "", [switch] $fromVSCode, - [switch] $accept_insiderEula + [switch] $accept_insiderEula, + [switch] $clean ) $errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0 +function DownloadHelperFile { + param( + [string] $url, + [string] $folder + ) + + $prevProgressPreference = $ProgressPreference; $ProgressPreference = 'SilentlyContinue' + $name = [System.IO.Path]::GetFileName($url) + Write-Host "Downloading $name from $url" + $path = Join-Path $folder $name + Invoke-WebRequest -UseBasicParsing -uri $url -OutFile $path + $ProgressPreference = $prevProgressPreference + return $path +} + try { Clear-Host Write-Host @@ -27,17 +44,11 @@ Write-Host -ForegroundColor Yellow @' '@ -$webClient = New-Object System.Net.WebClient -$webClient.CachePolicy = New-Object System.Net.Cache.RequestCachePolicy -argumentList ([System.Net.Cache.RequestCacheLevel]::NoCacheNoStore) -$webClient.Encoding = [System.Text.Encoding]::UTF8 -$GitHubHelperUrl = 'https://raw.githubusercontent.com/microsoft/AL-Go/4c5bfbca1adebbf997f63882df4b9074a19aac1d/Actions/Github-Helper.psm1' -Write-Host "Downloading GitHub Helper module from $GitHubHelperUrl" -$GitHubHelperPath = "$([System.IO.Path]::GetTempFileName()).psm1" -$webClient.DownloadFile($GitHubHelperUrl, $GitHubHelperPath) -$ALGoHelperUrl = 'https://raw.githubusercontent.com/microsoft/AL-Go/4c5bfbca1adebbf997f63882df4b9074a19aac1d/Actions/AL-Go-Helper.ps1' -Write-Host "Downloading AL-Go Helper script from $ALGoHelperUrl" -$ALGoHelperPath = "$([System.IO.Path]::GetTempFileName()).ps1" -$webClient.DownloadFile($ALGoHelperUrl, $ALGoHelperPath) +$tmpFolder = Join-Path ([System.IO.Path]::GetTempPath()) "$([Guid]::NewGuid().ToString())" +New-Item -Path $tmpFolder -ItemType Directory -Force | Out-Null +$GitHubHelperPath = DownloadHelperFile -url 'https://raw.githubusercontent.com/microsoft/AL-Go/564c339085ae0ffa74c5bde71c15fea7fe54bbf1/Actions/Github-Helper.psm1' -folder $tmpFolder +$ALGoHelperPath = DownloadHelperFile -url 'https://raw.githubusercontent.com/microsoft/AL-Go/564c339085ae0ffa74c5bde71c15fea7fe54bbf1/Actions/AL-Go-Helper.ps1' -folder $tmpFolder +DownloadHelperFile -url 'https://raw.githubusercontent.com/microsoft/AL-Go/564c339085ae0ffa74c5bde71c15fea7fe54bbf1/Actions/Packages.json' -folder $tmpFolder | Out-Null Import-Module $GitHubHelperPath . $ALGoHelperPath -local @@ -134,7 +145,8 @@ CreateDevEnv ` -auth $auth ` -credential $credential ` -licenseFileUrl $licenseFileUrl ` - -accept_insiderEula:$accept_insiderEula + -accept_insiderEula:$accept_insiderEula ` + -clean:$clean } catch { Write-Host -ForegroundColor Red "Error: $($_.Exception.Message)`nStacktrace: $($_.scriptStackTrace)" diff --git a/Build/projects/1st Party Apps Tests (W1)/.AL-Go/cloudDevEnv.ps1 b/Build/projects/1st Party Apps Tests (W1)/.AL-Go/cloudDevEnv.ps1 index 38799b4107..1b8ca3f1a9 100644 --- a/Build/projects/1st Party Apps Tests (W1)/.AL-Go/cloudDevEnv.ps1 +++ b/Build/projects/1st Party Apps Tests (W1)/.AL-Go/cloudDevEnv.ps1 @@ -6,11 +6,27 @@ Param( [string] $environmentName = "", [bool] $reuseExistingEnvironment, - [switch] $fromVSCode + [switch] $fromVSCode, + [switch] $clean ) $errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0 +function DownloadHelperFile { + param( + [string] $url, + [string] $folder + ) + + $prevProgressPreference = $ProgressPreference; $ProgressPreference = 'SilentlyContinue' + $name = [System.IO.Path]::GetFileName($url) + Write-Host "Downloading $name from $url" + $path = Join-Path $folder $name + Invoke-WebRequest -UseBasicParsing -uri $url -OutFile $path + $ProgressPreference = $prevProgressPreference + return $path +} + try { Clear-Host Write-Host @@ -24,17 +40,11 @@ Write-Host -ForegroundColor Yellow @' '@ -$webClient = New-Object System.Net.WebClient -$webClient.CachePolicy = New-Object System.Net.Cache.RequestCachePolicy -argumentList ([System.Net.Cache.RequestCacheLevel]::NoCacheNoStore) -$webClient.Encoding = [System.Text.Encoding]::UTF8 -$GitHubHelperUrl = 'https://raw.githubusercontent.com/microsoft/AL-Go/4c5bfbca1adebbf997f63882df4b9074a19aac1d/Actions/Github-Helper.psm1' -Write-Host "Downloading GitHub Helper module from $GitHubHelperUrl" -$GitHubHelperPath = "$([System.IO.Path]::GetTempFileName()).psm1" -$webClient.DownloadFile($GitHubHelperUrl, $GitHubHelperPath) -$ALGoHelperUrl = 'https://raw.githubusercontent.com/microsoft/AL-Go/4c5bfbca1adebbf997f63882df4b9074a19aac1d/Actions/AL-Go-Helper.ps1' -Write-Host "Downloading AL-Go Helper script from $ALGoHelperUrl" -$ALGoHelperPath = "$([System.IO.Path]::GetTempFileName()).ps1" -$webClient.DownloadFile($ALGoHelperUrl, $ALGoHelperPath) +$tmpFolder = Join-Path ([System.IO.Path]::GetTempPath()) "$([Guid]::NewGuid().ToString())" +New-Item -Path $tmpFolder -ItemType Directory -Force | Out-Null +$GitHubHelperPath = DownloadHelperFile -url 'https://raw.githubusercontent.com/microsoft/AL-Go/564c339085ae0ffa74c5bde71c15fea7fe54bbf1/Actions/Github-Helper.psm1' -folder $tmpFolder +$ALGoHelperPath = DownloadHelperFile -url 'https://raw.githubusercontent.com/microsoft/AL-Go/564c339085ae0ffa74c5bde71c15fea7fe54bbf1/Actions/AL-Go-Helper.ps1' -folder $tmpFolder +DownloadHelperFile -url 'https://raw.githubusercontent.com/microsoft/AL-Go/564c339085ae0ffa74c5bde71c15fea7fe54bbf1/Actions/Packages.json' -folder $tmpFolder | Out-Null Import-Module $GitHubHelperPath . $ALGoHelperPath -local @@ -78,7 +88,8 @@ CreateDevEnv ` -environmentName $environmentName ` -reuseExistingEnvironment:$reuseExistingEnvironment ` -baseFolder $baseFolder ` - -project $project + -project $project ` + -clean:$clean } catch { Write-Host -ForegroundColor Red "Error: $($_.Exception.Message)`nStacktrace: $($_.scriptStackTrace)" diff --git a/Build/projects/1st Party Apps Tests (W1)/.AL-Go/localDevEnv.ps1 b/Build/projects/1st Party Apps Tests (W1)/.AL-Go/localDevEnv.ps1 index a561a18d8f..c98482bd3d 100644 --- a/Build/projects/1st Party Apps Tests (W1)/.AL-Go/localDevEnv.ps1 +++ b/Build/projects/1st Party Apps Tests (W1)/.AL-Go/localDevEnv.ps1 @@ -5,15 +5,32 @@ # Param( [string] $containerName = "", + [ValidateSet("UserPassword", "Windows")] [string] $auth = "", [pscredential] $credential = $null, [string] $licenseFileUrl = "", [switch] $fromVSCode, - [switch] $accept_insiderEula + [switch] $accept_insiderEula, + [switch] $clean ) $errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0 +function DownloadHelperFile { + param( + [string] $url, + [string] $folder + ) + + $prevProgressPreference = $ProgressPreference; $ProgressPreference = 'SilentlyContinue' + $name = [System.IO.Path]::GetFileName($url) + Write-Host "Downloading $name from $url" + $path = Join-Path $folder $name + Invoke-WebRequest -UseBasicParsing -uri $url -OutFile $path + $ProgressPreference = $prevProgressPreference + return $path +} + try { Clear-Host Write-Host @@ -27,17 +44,11 @@ Write-Host -ForegroundColor Yellow @' '@ -$webClient = New-Object System.Net.WebClient -$webClient.CachePolicy = New-Object System.Net.Cache.RequestCachePolicy -argumentList ([System.Net.Cache.RequestCacheLevel]::NoCacheNoStore) -$webClient.Encoding = [System.Text.Encoding]::UTF8 -$GitHubHelperUrl = 'https://raw.githubusercontent.com/microsoft/AL-Go/4c5bfbca1adebbf997f63882df4b9074a19aac1d/Actions/Github-Helper.psm1' -Write-Host "Downloading GitHub Helper module from $GitHubHelperUrl" -$GitHubHelperPath = "$([System.IO.Path]::GetTempFileName()).psm1" -$webClient.DownloadFile($GitHubHelperUrl, $GitHubHelperPath) -$ALGoHelperUrl = 'https://raw.githubusercontent.com/microsoft/AL-Go/4c5bfbca1adebbf997f63882df4b9074a19aac1d/Actions/AL-Go-Helper.ps1' -Write-Host "Downloading AL-Go Helper script from $ALGoHelperUrl" -$ALGoHelperPath = "$([System.IO.Path]::GetTempFileName()).ps1" -$webClient.DownloadFile($ALGoHelperUrl, $ALGoHelperPath) +$tmpFolder = Join-Path ([System.IO.Path]::GetTempPath()) "$([Guid]::NewGuid().ToString())" +New-Item -Path $tmpFolder -ItemType Directory -Force | Out-Null +$GitHubHelperPath = DownloadHelperFile -url 'https://raw.githubusercontent.com/microsoft/AL-Go/564c339085ae0ffa74c5bde71c15fea7fe54bbf1/Actions/Github-Helper.psm1' -folder $tmpFolder +$ALGoHelperPath = DownloadHelperFile -url 'https://raw.githubusercontent.com/microsoft/AL-Go/564c339085ae0ffa74c5bde71c15fea7fe54bbf1/Actions/AL-Go-Helper.ps1' -folder $tmpFolder +DownloadHelperFile -url 'https://raw.githubusercontent.com/microsoft/AL-Go/564c339085ae0ffa74c5bde71c15fea7fe54bbf1/Actions/Packages.json' -folder $tmpFolder | Out-Null Import-Module $GitHubHelperPath . $ALGoHelperPath -local @@ -134,7 +145,8 @@ CreateDevEnv ` -auth $auth ` -credential $credential ` -licenseFileUrl $licenseFileUrl ` - -accept_insiderEula:$accept_insiderEula + -accept_insiderEula:$accept_insiderEula ` + -clean:$clean } catch { Write-Host -ForegroundColor Red "Error: $($_.Exception.Message)`nStacktrace: $($_.scriptStackTrace)"