Skip to content

Commit

Permalink
[main] Update AL-Go System Files from freddydk/AL-Go@nuget - eb4adaab…
Browse files Browse the repository at this point in the history
…5c7ef0b37322697bd604bda4fecac7d6
  • Loading branch information
freddydk committed Sep 13, 2024
1 parent d5dd7bd commit 2fea6e9
Show file tree
Hide file tree
Showing 20 changed files with 237 additions and 195 deletions.
31 changes: 20 additions & 11 deletions .AL-Go/cloudDevEnv.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,21 @@ Param(

$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
Expand All @@ -25,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/freddydk/AL-Go/nuget/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/freddydk/AL-Go/nuget/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/freddydk/AL-Go/nuget/Actions/Github-Helper.psm1' -folder $tmpFolder
$ALGoHelperPath = DownloadHelperFile -url 'https://raw.githubusercontent.com/freddydk/AL-Go/nuget/Actions/AL-Go-Helper.ps1' -folder $tmpFolder
DownloadHelperFile -url 'https://raw.githubusercontent.com/freddydk/AL-Go/nuget/Actions/Packages.json' -folder $tmpFolder | Out-Null

Import-Module $GitHubHelperPath
. $ALGoHelperPath -local
Expand Down
31 changes: 20 additions & 11 deletions .AL-Go/localDevEnv.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,21 @@ Param(

$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
Expand All @@ -29,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/freddydk/AL-Go/nuget/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/freddydk/AL-Go/nuget/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/freddydk/AL-Go/nuget/Actions/Github-Helper.psm1' -folder $tmpFolder
$ALGoHelperPath = DownloadHelperFile -url 'https://raw.githubusercontent.com/freddydk/AL-Go/nuget/Actions/AL-Go-Helper.ps1' -folder $tmpFolder
DownloadHelperFile -url 'https://raw.githubusercontent.com/freddydk/AL-Go/nuget/Actions/Packages.json' -folder $tmpFolder | Out-Null

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
Expand Up @@ -27,5 +27,5 @@
"ContinuousDeployment": true,
"runs-on": "ubuntu-latest"
},
"templateSha": "c01708a3346ea0e3bf7a550dd6a0d9c389dc8993"
"templateSha": "eb4adaab5c7ef0b37322697bd604bda4fecac7d6"
}
10 changes: 6 additions & 4 deletions .github/workflows/AddExistingAppOrTestApp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ on:
default: false

permissions:
actions: read
contents: write
id-token: write
pull-requests: write

defaults:
Expand All @@ -44,14 +46,13 @@ jobs:
shell: pwsh

- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- name: Initialize the workflow
id: init
uses: freddydk/AL-Go/Actions/WorkflowInitialize@nuget
with:
shell: pwsh
eventId: "DO0090"

- name: Read settings
uses: freddydk/AL-Go/Actions/ReadSettings@nuget
Expand All @@ -72,15 +73,16 @@ jobs:
with:
shell: pwsh
token: ${{ steps.ReadSecrets.outputs.TokenForPush }}
parentTelemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}
project: ${{ github.event.inputs.project }}
url: ${{ github.event.inputs.url }}
directCommit: ${{ github.event.inputs.directCommit }}

- name: Finalize the workflow
if: always()
uses: freddydk/AL-Go/Actions/WorkflowPostProcess@nuget
env:
GITHUB_TOKEN: ${{ github.token }}
with:
shell: pwsh
eventId: "DO0090"
telemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}
currentJobContext: ${{ toJson(job) }}
41 changes: 21 additions & 20 deletions .github/workflows/CICD.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ defaults:
shell: pwsh

permissions:
contents: read
actions: read
contents: read
id-token: write
pages: read

env:
Expand Down Expand Up @@ -49,7 +50,7 @@ jobs:
shell: pwsh

- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
lfs: true

Expand All @@ -58,7 +59,6 @@ jobs:
uses: freddydk/AL-Go/Actions/WorkflowInitialize@nuget
with:
shell: pwsh
eventId: "DO0091"

- name: Read settings
id: ReadSettings
Expand Down Expand Up @@ -126,7 +126,7 @@ jobs:
runs-on: [ ubuntu-latest ]
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- name: Read settings
uses: freddydk/AL-Go/Actions/ReadSettings@nuget
Expand All @@ -152,9 +152,8 @@ jobs:
uses: ./.github/workflows/_BuildALGoProject.yaml
secrets: inherit
with:
shell: ${{ needs.Initialization.outputs.githubRunnerShell }}
runsOn: ${{ needs.Initialization.outputs.githubRunner }}
parentTelemetryScopeJson: ${{ needs.Initialization.outputs.telemetryScopeJson }}
shell: ${{ matrix.githubRunnerShell }}
runsOn: ${{ matrix.githubRunner }}
project: ${{ matrix.project }}
projectName: ${{ matrix.projectName }}
buildMode: ${{ matrix.buildMode }}
Expand All @@ -168,7 +167,7 @@ jobs:
DeployALDoc:
needs: [ Initialization, Build ]
if: (!cancelled()) && needs.Build.result == 'Success' && needs.Initialization.outputs.generateALDocArtifact == 1 && github.ref_name == 'main'
runs-on: windows-latest
runs-on: [ ubuntu-latest ]
name: Deploy Reference Documentation
permissions:
contents: read
Expand All @@ -180,10 +179,10 @@ 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'

Expand All @@ -194,7 +193,7 @@ jobs:

- name: Setup Pages
if: needs.Initialization.outputs.deployALDocArtifact == 1
uses: actions/configure-pages@v5
uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b # v5.0.0

- name: Build Reference Documentation
uses: freddydk/AL-Go/Actions/BuildReferenceDocumentation@nuget
Expand All @@ -203,14 +202,14 @@ jobs:
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 ]
Expand All @@ -226,10 +225,10 @@ jobs:
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'

Expand All @@ -252,7 +251,7 @@ jobs:
with:
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 to Business Central
id: Deploy
Expand Down Expand Up @@ -288,10 +287,10 @@ 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'

Expand Down Expand Up @@ -325,12 +324,14 @@ jobs:
runs-on: [ ubuntu-latest ]
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- name: Finalize the workflow
id: PostProcess
uses: freddydk/AL-Go/Actions/WorkflowPostProcess@nuget
env:
GITHUB_TOKEN: ${{ github.token }}
with:
shell: pwsh
eventId: "DO0091"
telemetryScopeJson: ${{ needs.Initialization.outputs.telemetryScopeJson }}
currentJobContext: ${{ toJson(job) }}
10 changes: 6 additions & 4 deletions .github/workflows/CreateApp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ on:
default: false

permissions:
actions: read
contents: write
id-token: write
pull-requests: write

defaults:
Expand All @@ -54,14 +56,13 @@ jobs:
shell: pwsh

- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- name: Initialize the workflow
id: init
uses: freddydk/AL-Go/Actions/WorkflowInitialize@nuget
with:
shell: pwsh
eventId: "DO0092"

- name: Read settings
uses: freddydk/AL-Go/Actions/ReadSettings@nuget
Expand All @@ -83,7 +84,6 @@ jobs:
with:
shell: pwsh
token: ${{ steps.ReadSecrets.outputs.TokenForPush }}
parentTelemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}
project: ${{ github.event.inputs.project }}
type: ${{ env.type }}
name: ${{ github.event.inputs.name }}
Expand All @@ -95,7 +95,9 @@ jobs:
- name: Finalize the workflow
if: always()
uses: freddydk/AL-Go/Actions/WorkflowPostProcess@nuget
env:
GITHUB_TOKEN: ${{ github.token }}
with:
shell: pwsh
eventId: "DO0092"
telemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}
currentJobContext: ${{ toJson(job) }}
Loading

0 comments on commit 2fea6e9

Please sign in to comment.