Skip to content

Commit

Permalink
Updated AL-Go System Files
Browse files Browse the repository at this point in the history
  • Loading branch information
mazhelez committed Jul 28, 2023
1 parent f46b667 commit c3bc889
Show file tree
Hide file tree
Showing 18 changed files with 176 additions and 209 deletions.
4 changes: 2 additions & 2 deletions .AL-Go/cloudDevEnv.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ $webClient.CachePolicy = New-Object System.Net.Cache.RequestCachePolicy -argumen
$webClient.Encoding = [System.Text.Encoding]::UTF8
Write-Host "Downloading GitHub Helper module"
$GitHubHelperPath = "$([System.IO.Path]::GetTempFileName()).psm1"
$webClient.DownloadFile('https://raw.githubusercontent.com/freddydk/AL-Go/Actions/SettingsEnv/Github-Helper.psm1', $GitHubHelperPath)
$webClient.DownloadFile('https://raw.githubusercontent.com/mazhelez/AL-Go/output-encoding/Actions/Github-Helper.psm1', $GitHubHelperPath)
Write-Host "Downloading AL-Go Helper script"
$ALGoHelperPath = "$([System.IO.Path]::GetTempFileName()).ps1"
$webClient.DownloadFile('https://raw.githubusercontent.com/freddydk/AL-Go/Actions/SettingsEnv/AL-Go-Helper.ps1', $ALGoHelperPath)
$webClient.DownloadFile('https://raw.githubusercontent.com/mazhelez/AL-Go/output-encoding/Actions/AL-Go-Helper.ps1', $ALGoHelperPath)

Import-Module $GitHubHelperPath
. $ALGoHelperPath -local
Expand Down
4 changes: 2 additions & 2 deletions .AL-Go/localDevEnv.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ $webClient.CachePolicy = New-Object System.Net.Cache.RequestCachePolicy -argumen
$webClient.Encoding = [System.Text.Encoding]::UTF8
Write-Host "Downloading GitHub Helper module"
$GitHubHelperPath = "$([System.IO.Path]::GetTempFileName()).psm1"
$webClient.DownloadFile('https://raw.githubusercontent.com/freddydk/AL-Go/Actions/SettingsEnv/Github-Helper.psm1', $GitHubHelperPath)
$webClient.DownloadFile('https://raw.githubusercontent.com/mazhelez/AL-Go/output-encoding/Actions/Github-Helper.psm1', $GitHubHelperPath)
Write-Host "Downloading AL-Go Helper script"
$ALGoHelperPath = "$([System.IO.Path]::GetTempFileName()).ps1"
$webClient.DownloadFile('https://raw.githubusercontent.com/freddydk/AL-Go/Actions/SettingsEnv/AL-Go-Helper.ps1', $ALGoHelperPath)
$webClient.DownloadFile('https://raw.githubusercontent.com/mazhelez/AL-Go/output-encoding/Actions/AL-Go-Helper.ps1', $ALGoHelperPath)

Import-Module $GitHubHelperPath
. $ALGoHelperPath -local
Expand Down
2 changes: 1 addition & 1 deletion .github/AL-Go-Settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"type": "PTE",
"templateUrl": "https://github.com/freddydk/AL-Go@SettingsEnv",
"templateUrl": "https://github.com/mazhelez/AL-Go@output-encoding",
"repoName": "Ååå"
}
16 changes: 7 additions & 9 deletions .github/workflows/AddExistingAppOrTestApp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,30 +41,28 @@ jobs:

- name: Initialize the workflow
id: init
uses: freddydk/AL-Go/Actions/WorkflowInitialize@SettingsEnv
uses: mazhelez/AL-Go/Actions/WorkflowInitialize@output-encoding
with:
shell: powershell
eventId: "DO0090"

- name: Read settings
uses: freddydk/AL-Go/Actions/ReadSettings@SettingsEnv
id: ReadSettings
uses: mazhelez/AL-Go/Actions/ReadSettings@output-encoding
if: github.event.inputs.useGhTokenWorkflow == 'true'
with:
shell: powershell
parentTelemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}
get: keyVaultName,ghTokenWorkflowSecretName
useBase64: 'Y'

- name: Read secrets
uses: freddydk/AL-Go/Actions/ReadSecrets@SettingsEnv
uses: mazhelez/AL-Go/Actions/ReadSecrets@output-encoding
if: github.event.inputs.useGhTokenWorkflow == 'true'
env:
secrets: ${{ toJson(secrets) }}
with:
shell: powershell
parentTelemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}
settingsJson: ${{ steps.ReadSettings.outputs.SettingsJson }}
settingsJson: ${{ env.Settings }}
secrets: 'ghTokenWorkflow=${{ env.GHTOKENWORKFLOWSECRETNAME }}'

- name: CalculateToken
Expand All @@ -77,10 +75,10 @@ jobs:
} else {
$ghToken = '${{ secrets.GITHUB_TOKEN }}'
}
Add-Content -Path $env:GITHUB_OUTPUT -Value "ghToken=$ghToken"
Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "ghToken=$ghToken"
- name: Add existing app
uses: freddydk/AL-Go/Actions/AddExistingApp@SettingsEnv
uses: mazhelez/AL-Go/Actions/AddExistingApp@output-encoding
with:
shell: powershell
token: ${{ steps.CalculateToken.outputs.ghToken }}
Expand All @@ -91,7 +89,7 @@ jobs:

- name: Finalize the workflow
if: always()
uses: freddydk/AL-Go/Actions/WorkflowPostProcess@SettingsEnv
uses: mazhelez/AL-Go/Actions/WorkflowPostProcess@output-encoding
with:
shell: powershell
eventId: "DO0090"
Expand Down
66 changes: 30 additions & 36 deletions .github/workflows/CICD.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ jobs:
runs-on: [ windows-latest ]
outputs:
telemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}
settings: ${{ steps.ReadSettings.outputs.SettingsJson }}
environments: ${{ steps.ReadSettings.outputs.EnvironmentsJson }}
environmentCount: ${{ steps.ReadSettings.outputs.EnvironmentCount }}
deliveryTargets: ${{ steps.DetermineDeliveryTargets.outputs.DeliveryTargetsJson }}
Expand All @@ -46,28 +47,27 @@ jobs:

- name: Initialize the workflow
id: init
uses: freddydk/AL-Go/Actions/WorkflowInitialize@SettingsEnv
uses: mazhelez/AL-Go/Actions/WorkflowInitialize@output-encoding
with:
shell: powershell
eventId: "DO0091"

- name: Read settings
uses: freddydk/AL-Go/Actions/ReadSettings@SettingsEnv
id: ReadSettings
uses: mazhelez/AL-Go/Actions/ReadSettings@output-encoding
with:
shell: powershell
parentTelemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}
getEnvironments: '*'
useBase64: 'Y'

- name: Determine Workflow Depth
id: DetermineWorkflowDepth
run: |
Add-Content -Path $env:GITHUB_OUTPUT -Value "WorkflowDepth=$($env:workflowDepth)"
Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "WorkflowDepth=$($env:workflowDepth)"
- name: Determine Projects To Build
id: determineProjectsToBuild
uses: freddydk/AL-Go/Actions/DetermineProjectsToBuild@SettingsEnv
uses: mazhelez/AL-Go/Actions/DetermineProjectsToBuild@output-encoding
with:
shell: powershell
maxBuildDepth: ${{ env.workflowDepth }}
Expand All @@ -82,16 +82,15 @@ jobs:
$deliveryTarget = [System.IO.Path]::GetFileNameWithoutExtension($_.Name.SubString($namePrefix.Length))
$deliveryTargetSecrets += @("$($deliveryTarget)Context")
}
Add-Content -Path $env:GITHUB_OUTPUT -Value "Secrets=$($deliveryTargetSecrets -join ',')"
Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "Secrets=$($deliveryTargetSecrets -join ',')"
- name: Read secrets
uses: freddydk/AL-Go/Actions/ReadSecrets@SettingsEnv
id: ReadSecrets
uses: mazhelez/AL-Go/Actions/ReadSecrets@output-encoding
env:
secrets: ${{ toJson(secrets) }}
with:
shell: powershell
settingsJson: ${{ steps.ReadSettings.outputs.SettingsJson }}
settingsJson: ${{ env.Settings }}
secrets: ${{ steps.DetermineDeliveryTargetSecrets.outputs.Secrets }}

- name: Determine Delivery Targets
Expand Down Expand Up @@ -125,7 +124,7 @@ jobs:
$deliveryContext = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String([System.Environment]::GetEnvironmentVariable($contextName)))
if ($deliveryContext) {
$settingName = "DeliverTo$_"
$settings = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String('${{ steps.ReadSecrets.outputs.SettingsJson }}')) | ConvertFrom-Json
$settings = $env:Settings | ConvertFrom-Json
if (($settings.PSObject.Properties.Name -eq $settingName) -and ($settings."$settingName".PSObject.Properties.Name -eq "Branches")) {
Write-Host "Branches:"
$settings."$settingName".Branches | ForEach-Object {
Expand All @@ -144,13 +143,13 @@ jobs:
}
$include
})
Write-Host "OUTPUTS:"
$deliveryTargetsJson = $deliveryTargets | ConvertTo-Json -Depth 99 -compress
if ($deliveryTargets.Count -lt 2) { $deliveryTargetsJson = "[$($deliveryTargetsJson)]" }
Add-Content -Path $env:GITHUB_OUTPUT -Value "DeliveryTargetsJson=$deliveryTargetsJson"
Write-Host "- DeliveryTargetsJson=$deliveryTargetsJson"
Add-Content -Path $env:GITHUB_OUTPUT -Value "DeliveryTargetCount=$($deliveryTargets.Count)"
Write-Host "- DeliveryTargetCount=$($deliveryTargets.Count)"
Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "DeliveryTargetsJson=$deliveryTargetsJson"
Write-Host "DeliveryTargetsJson=$deliveryTargetsJson"
Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "DeliveryTargetCount=$($deliveryTargets.Count)"
Write-Host "DeliveryTargetCount=$($deliveryTargets.Count)"
Add-Content -Encoding UTF8 -Path $env:GITHUB_ENV -Value "DeliveryTargets=$deliveryTargetsJson"
CheckForUpdates:
runs-on: [ windows-latest ]
Expand All @@ -160,15 +159,14 @@ jobs:
uses: actions/checkout@v3

- name: Read settings
uses: freddydk/AL-Go/Actions/ReadSettings@SettingsEnv
uses: mazhelez/AL-Go/Actions/ReadSettings@output-encoding
with:
shell: powershell
parentTelemetryScopeJson: ${{ needs.Initialization.outputs.telemetryScopeJson }}
get: templateUrl
useBase64: 'Y'

- name: Check for updates to AL-Go system files
uses: freddydk/AL-Go/Actions/CheckForUpdates@SettingsEnv
uses: mazhelez/AL-Go/Actions/CheckForUpdates@output-encoding
with:
shell: powershell
parentTelemetryScopeJson: ${{ needs.Initialization.outputs.telemetryScopeJson }}
Expand Down Expand Up @@ -219,22 +217,20 @@ jobs:
run: |
$errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0
$envName = '${{ matrix.environment }}'.split(' ')[0]
Add-Content -Path $env:GITHUB_OUTPUT -Value "envName=$envName"
Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "envName=$envName"
- name: Read settings
uses: freddydk/AL-Go/Actions/ReadSettings@SettingsEnv
id: ReadSettings
uses: mazhelez/AL-Go/Actions/ReadSettings@output-encoding
with:
shell: powershell
useBase64: 'Y'

- name: Read secrets
uses: freddydk/AL-Go/Actions/ReadSecrets@SettingsEnv
uses: mazhelez/AL-Go/Actions/ReadSecrets@output-encoding
env:
secrets: ${{ toJson(secrets) }}
with:
shell: powershell
settingsJson: ${{ steps.ReadSettings.outputs.SettingsJson }}
settingsJson: ${{ env.Settings }}
secrets: '${{ steps.envName.outputs.envName }}-AuthContext,${{ steps.envName.outputs.envName }}_AuthContext,AuthContext,${{ steps.envName.outputs.envName }}-EnvironmentName,${{ steps.envName.outputs.envName }}_EnvironmentName,EnvironmentName,projects'

- name: AuthContext
Expand Down Expand Up @@ -302,16 +298,16 @@ jobs:
$projects = ($projects.Split(',') | Where-Object { $buildProjects -contains $_ }) -join ','
}
Add-Content -Path $env:GITHUB_OUTPUT -Value "authContext=$authContext"
Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "authContext=$authContext"
Write-Host "authContext=$authContext"
Add-Content -Path $env:GITHUB_OUTPUT -Value "environmentName=$environmentName"
Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "environmentName=$environmentName"
Write-Host "environmentName=$([System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($environmentName)))"
Write-Host "environmentName (as Base64)=$environmentName"
Add-Content -Path $env:GITHUB_OUTPUT -Value "projects=$projects"
Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "projects=$projects"
Write-Host "projects=$projects"
- name: Deploy
uses: freddydk/AL-Go/Actions/Deploy@SettingsEnv
uses: mazhelez/AL-Go/Actions/Deploy@output-encoding
env:
AuthContext: ${{ steps.authContext.outputs.authContext }}
with:
Expand Down Expand Up @@ -340,19 +336,17 @@ jobs:
path: '.artifacts'

- name: Read settings
uses: freddydk/AL-Go/Actions/ReadSettings@SettingsEnv
id: ReadSettings
uses: mazhelez/AL-Go/Actions/ReadSettings@output-encoding
with:
shell: powershell
useBase64: 'Y'

- name: Read secrets
uses: freddydk/AL-Go/Actions/ReadSecrets@SettingsEnv
uses: mazhelez/AL-Go/Actions/ReadSecrets@output-encoding
env:
secrets: ${{ toJson(secrets) }}
with:
shell: powershell
settingsJson: ${{ steps.ReadSettings.outputs.SettingsJson }}
settingsJson: ${{ env.Settings }}
secrets: '${{ matrix.deliveryTarget }}Context'

- name: DeliveryContext
Expand All @@ -361,11 +355,11 @@ jobs:
$errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0
$contextName = '${{ matrix.deliveryTarget }}Context'
$deliveryContext = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String([System.Environment]::GetEnvironmentVariable($contextName)))
Add-Content -Path $env:GITHUB_OUTPUT -Value "deliveryContext=$deliveryContext"
Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "deliveryContext=$deliveryContext"
Write-Host "deliveryContext=$deliveryContext"
- name: Deliver
uses: freddydk/AL-Go/Actions/Deliver@SettingsEnv
uses: mazhelez/AL-Go/Actions/Deliver@output-encoding
env:
deliveryContext: ${{ steps.deliveryContext.outputs.deliveryContext }}
with:
Expand All @@ -385,7 +379,7 @@ jobs:

- name: Finalize the workflow
id: PostProcess
uses: freddydk/AL-Go/Actions/WorkflowPostProcess@SettingsEnv
uses: mazhelez/AL-Go/Actions/WorkflowPostProcess@output-encoding
with:
shell: powershell
eventId: "DO0091"
Expand Down
16 changes: 7 additions & 9 deletions .github/workflows/CreateApp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,29 +51,27 @@ jobs:

- name: Initialize the workflow
id: init
uses: freddydk/AL-Go/Actions/WorkflowInitialize@SettingsEnv
uses: mazhelez/AL-Go/Actions/WorkflowInitialize@output-encoding
with:
shell: powershell
eventId: "DO0092"

- name: Read settings
uses: freddydk/AL-Go/Actions/ReadSettings@SettingsEnv
id: ReadSettings
uses: mazhelez/AL-Go/Actions/ReadSettings@output-encoding
with:
shell: powershell
parentTelemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}
get: type,keyVaultName,ghTokenWorkflowSecretName
useBase64: 'Y'

- name: Read secrets
uses: freddydk/AL-Go/Actions/ReadSecrets@SettingsEnv
uses: mazhelez/AL-Go/Actions/ReadSecrets@output-encoding
if: github.event.inputs.useGhTokenWorkflow == 'true'
env:
secrets: ${{ toJson(secrets) }}
with:
shell: powershell
parentTelemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}
settingsJson: ${{ steps.ReadSettings.outputs.SettingsJson }}
settingsJson: ${{ env.Settings }}
secrets: 'ghTokenWorkflow=${{ env.GHTOKENWORKFLOWSECRETNAME }}'

- name: CalculateToken
Expand All @@ -86,10 +84,10 @@ jobs:
} else {
$ghToken = '${{ secrets.GITHUB_TOKEN }}'
}
Add-Content -Path $env:GITHUB_OUTPUT -Value "ghToken=$ghToken"
Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "ghToken=$ghToken"
- name: Creating a new app
uses: freddydk/AL-Go/Actions/CreateApp@SettingsEnv
uses: mazhelez/AL-Go/Actions/CreateApp@output-encoding
with:
shell: powershell
token: ${{ steps.CalculateToken.outputs.ghToken }}
Expand All @@ -104,7 +102,7 @@ jobs:

- name: Finalize the workflow
if: always()
uses: freddydk/AL-Go/Actions/WorkflowPostProcess@SettingsEnv
uses: mazhelez/AL-Go/Actions/WorkflowPostProcess@output-encoding
with:
shell: powershell
eventId: "DO0092"
Expand Down
Loading

0 comments on commit c3bc889

Please sign in to comment.