diff --git a/Actions/Deploy/Deploy.ps1 b/Actions/Deploy/Deploy.ps1 index d94479469..46b0293c3 100644 --- a/Actions/Deploy/Deploy.ps1 +++ b/Actions/Deploy/Deploy.ps1 @@ -169,8 +169,10 @@ try { throw "Authentication failed. $([environment]::Newline) $($_.exception.message)" } - Write-Host "$($bcContainerHelperConfig.baseUrl.TrimEnd('/'))/$($bcAuthContext.tenantId)/$($deploymentSettings.EnvironmentName)/deployment/url" - $response = Invoke-RestMethod -UseBasicParsing -Method Get -Uri "$($bcContainerHelperConfig.baseUrl.TrimEnd('/'))/$($bcAuthContext.tenantId)/$($deploymentSettings.EnvironmentName)/deployment/url" + $environmentUrl = "$($bcContainerHelperConfig.baseUrl.TrimEnd('/'))/$($bcAuthContext.tenantId)/$($deploymentSettings.EnvironmentName)" + Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "environmentUrl=$environmentUrl" + Write-Host "EnvironmentUrl: $environmentUrl" + $response = Invoke-RestMethod -UseBasicParsing -Method Get -Uri "$environmentUrl/deployment/url" if ($response.Status -eq "DoesNotExist") { OutputError -message "Environment with name $($deploymentSettings.EnvironmentName) does not exist in the current authorization context." exit diff --git a/Actions/Deploy/README.md b/Actions/Deploy/README.md index 278769ca8..6f20095ca 100644 --- a/Actions/Deploy/README.md +++ b/Actions/Deploy/README.md @@ -22,4 +22,6 @@ Deploy Apps to online environment | type | | Type of delivery (CD or Release) | CD | ## OUTPUT -none +| Name | Description | +| :-- | :-- | +| environmentUrl | The URL for the environment. This URL is presented in the Deploy Step in summary under the environment name | diff --git a/Actions/Deploy/action.yaml b/Actions/Deploy/action.yaml index 755d5343b..84ed69a86 100644 --- a/Actions/Deploy/action.yaml +++ b/Actions/Deploy/action.yaml @@ -26,11 +26,16 @@ inputs: deploymentEnvironmentsJson: description: The settings for all Deployment Environments required: true +outputs: + environmentUrl: + description: The URL of the deployed environment + value: ${{ steps.Deploy.outputs.environmentUrl }} runs: using: composite steps: - name: run shell: ${{ inputs.shell }} + id: Deploy env: _token: ${{ inputs.token }} _parentTelemetryScopeJson: ${{ inputs.parentTelemetryScopeJson }} diff --git a/RELEASENOTES.md b/RELEASENOTES.md index fb0e6329a..282649d76 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -17,6 +17,8 @@ AL-Go for GitHub allows you to build and test using insider builds without any e ### New Settings - `enableExternalRulesets`: set this setting to true if you want to allow AL-Go to automatically download external references in rulesets. +### Deployment +Environment URL is now displayed underneath the environment being deployed to in the build summary. For Custom Deployment, the script can set the GitHub Output variable `environmentUrl` in order to show a custom URL. ## v3.3 diff --git a/Templates/AppSource App/.github/workflows/CICD.yaml b/Templates/AppSource App/.github/workflows/CICD.yaml index 66a24f19e..6b4ff0e77 100644 --- a/Templates/AppSource App/.github/workflows/CICD.yaml +++ b/Templates/AppSource App/.github/workflows/CICD.yaml @@ -157,6 +157,7 @@ jobs: name: Deploy to ${{ matrix.environment }} environment: name: ${{ matrix.environment }} + url: ${{ steps.Deploy.outputs.environmentUrl }} steps: - name: Checkout uses: actions/checkout@v3 @@ -187,6 +188,7 @@ jobs: 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 }}' diff --git a/Templates/AppSource App/.github/workflows/PublishToEnvironment.yaml b/Templates/AppSource App/.github/workflows/PublishToEnvironment.yaml index 519640cca..e9fe57881 100644 --- a/Templates/AppSource App/.github/workflows/PublishToEnvironment.yaml +++ b/Templates/AppSource App/.github/workflows/PublishToEnvironment.yaml @@ -117,6 +117,7 @@ jobs: name: Deploy to ${{ matrix.environment }} environment: name: ${{ matrix.environment }} + url: ${{ steps.Deploy.outputs.environmentUrl }} env: deviceCode: ${{ needs.Initialization.outputs.deviceCode }} steps: @@ -144,6 +145,7 @@ jobs: 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 }}' diff --git a/Templates/Per Tenant Extension/.github/workflows/CICD.yaml b/Templates/Per Tenant Extension/.github/workflows/CICD.yaml index 66a24f19e..6b4ff0e77 100644 --- a/Templates/Per Tenant Extension/.github/workflows/CICD.yaml +++ b/Templates/Per Tenant Extension/.github/workflows/CICD.yaml @@ -157,6 +157,7 @@ jobs: name: Deploy to ${{ matrix.environment }} environment: name: ${{ matrix.environment }} + url: ${{ steps.Deploy.outputs.environmentUrl }} steps: - name: Checkout uses: actions/checkout@v3 @@ -187,6 +188,7 @@ jobs: 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 }}' diff --git a/Templates/Per Tenant Extension/.github/workflows/PublishToEnvironment.yaml b/Templates/Per Tenant Extension/.github/workflows/PublishToEnvironment.yaml index 519640cca..e9fe57881 100644 --- a/Templates/Per Tenant Extension/.github/workflows/PublishToEnvironment.yaml +++ b/Templates/Per Tenant Extension/.github/workflows/PublishToEnvironment.yaml @@ -117,6 +117,7 @@ jobs: name: Deploy to ${{ matrix.environment }} environment: name: ${{ matrix.environment }} + url: ${{ steps.Deploy.outputs.environmentUrl }} env: deviceCode: ${{ needs.Initialization.outputs.deviceCode }} steps: @@ -144,6 +145,7 @@ jobs: 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 }}' diff --git a/Tests/Deploy.Action.Test.ps1 b/Tests/Deploy.Action.Test.ps1 index ee5938abd..97c8badef 100644 --- a/Tests/Deploy.Action.Test.ps1 +++ b/Tests/Deploy.Action.Test.ps1 @@ -20,6 +20,7 @@ Describe "Deploy Action Tests" { $permissions = [ordered]@{ } $outputs = [ordered]@{ + "environmentUrl" = "The URL of the deployed environment" } YamlTest -scriptRoot $scriptRoot -actionName $actionName -actionScript $actionScript -permissions $permissions -outputs $outputs }