зеркало из https://github.com/microsoft/AL-Go.git
Refactor CheckForUpdates (#753)
Refactor CheckForUpdates and modify all Y/N string input fields to type: boolean in all workflows. This PR also adds the TemplateSha to .github/AL-Go-Settings to allow for not downloading latest version of AL-Go system files, but instead update the existing files based on settings changes. --------- Co-authored-by: freddydk <freddydk@users.noreply.github.com> Co-authored-by: Maria Zhelezova <43066499+mazhelez@users.noreply.github.com> Co-authored-by: Alexander Holstrup <117829001+aholstrup1@users.noreply.github.com>
This commit is contained in:
Родитель
8df6c4ae06
Коммит
fab5350536
|
@ -1,62 +0,0 @@
|
|||
name: Collect
|
||||
|
||||
run-name: "Collect from [${{ inputs.branch }}] to [${{ github.ref_name }}]"
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
branch:
|
||||
description: Branch to collect from (default is main)
|
||||
required: false
|
||||
default: 'main'
|
||||
directCommit:
|
||||
description: Direct COMMIT (Y/N)
|
||||
required: false
|
||||
default: "N"
|
||||
|
||||
defaults:
|
||||
run:
|
||||
shell: pwsh
|
||||
|
||||
jobs:
|
||||
Collect:
|
||||
runs-on: [ ubuntu-latest ]
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: CheckUser
|
||||
run: |
|
||||
$threeMusketeers = @("freddydk", "aholstrup1", "mazhelez")
|
||||
if ("$ENV:GITHUB_REPOSITORY" -eq "microsoft/AL-Go" -and "$ENV:GITHUB_ACTOR" -notin $threeMusketeers) {
|
||||
Write-Host "::Error::You cannot run deploy and collect in the microsoft/AL-Go repo"
|
||||
exit 1
|
||||
}
|
||||
|
||||
- name: Collect
|
||||
run: |
|
||||
$errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0
|
||||
try {
|
||||
$token = '${{ Secrets.OrgPAT }}'
|
||||
if (!$token) {
|
||||
throw "In order to run the Collect workflow, you need a Secret called OrgPAT containing a valid Personal Access Token"
|
||||
}
|
||||
else {
|
||||
$githubOwner = "$ENV:GITHUB_REPOSITORY_OWNER"
|
||||
$settings = [ordered]@{
|
||||
"githubOwner" = $githubOwner
|
||||
"actionsRepo" = "AL-Go-Actions"
|
||||
"perTenantExtensionRepo" = "AL-Go-PTE"
|
||||
"appSourceAppRepo" = "AL-Go-AppSource"
|
||||
"branch" = '${{ github.event.inputs.branch }}'
|
||||
"localFolder" = ""
|
||||
"baseFolder" = [System.IO.Path]::GetTempPath()
|
||||
}
|
||||
$settingsFile = Join-Path $settings.baseFolder "deploy.json"
|
||||
$settings | ConvertTo-Json | Set-Content $settingsFile -Encoding UTF8
|
||||
. ".\Internal\Collect.ps1" -configName $settingsFile -githubOwner $githubOwner -token $token -directCOMMIT:('${{ github.event.inputs.directCOMMIT }}' -eq 'Y')
|
||||
}
|
||||
}
|
||||
catch {
|
||||
Write-Host "::Error::Error deploying repositories. The error was $($_.Exception.Message)"
|
||||
exit 1
|
||||
}
|
|
@ -13,17 +13,14 @@ on:
|
|||
default: ''
|
||||
runTestMatrix:
|
||||
description: Run the end to end test scenario for the full test matrix
|
||||
required: false
|
||||
type: boolean
|
||||
default: true
|
||||
runScenarios:
|
||||
description: Run the end to end scenario tests
|
||||
required: false
|
||||
type: boolean
|
||||
default: true
|
||||
runUpgradeTests:
|
||||
description: Run the end to end upgrade tests
|
||||
required: false
|
||||
type: boolean
|
||||
default: true
|
||||
bcContainerHelperVersion:
|
||||
|
|
|
@ -603,6 +603,7 @@ function ReadSettings {
|
|||
"obsoleteTagMinAllowedMajorMinor" = ""
|
||||
"memoryLimit" = ""
|
||||
"templateUrl" = ""
|
||||
"templateSha" = ""
|
||||
"templateBranch" = ""
|
||||
"appDependencyProbingPaths" = @()
|
||||
"useProjectDependencies" = $false
|
||||
|
@ -1253,7 +1254,9 @@ function CloneIntoNewFolder {
|
|||
Param(
|
||||
[string] $actor,
|
||||
[string] $token,
|
||||
[string] $branch
|
||||
[string] $updateBranch = $ENV:GITHUB_REF_NAME,
|
||||
[string] $newBranchPrefix = '',
|
||||
[bool] $directCommit
|
||||
)
|
||||
|
||||
$baseFolder = Join-Path ([System.IO.Path]::GetTempPath()) ([Guid]::NewGuid().ToString())
|
||||
|
@ -1275,13 +1278,16 @@ function CloneIntoNewFolder {
|
|||
invoke-git clone $serverUrl
|
||||
|
||||
Set-Location *
|
||||
invoke-git checkout $ENV:GITHUB_REF_NAME
|
||||
invoke-git checkout $updateBranch
|
||||
|
||||
if ($branch) {
|
||||
$branch = ''
|
||||
if (!$directCommit) {
|
||||
$branch = "$newBranchPrefix/$updateBranch/$((Get-Date).ToUniversalTime().ToString(`"yyMMddHHmmss`"))" # e.g. create-development-environment/main/210101120000
|
||||
invoke-git checkout -b $branch
|
||||
}
|
||||
|
||||
$serverUrl
|
||||
$branch
|
||||
}
|
||||
|
||||
function CommitFromNewFolder {
|
||||
|
@ -1292,21 +1298,29 @@ function CommitFromNewFolder {
|
|||
)
|
||||
|
||||
invoke-git add *
|
||||
if ($commitMessage.Length -gt 250) {
|
||||
$commitMessage = "$($commitMessage.Substring(0,250))...)"
|
||||
}
|
||||
invoke-git commit --allow-empty -m "'$commitMessage'"
|
||||
if ($branch) {
|
||||
invoke-git push -u $serverUrl $branch
|
||||
try {
|
||||
invoke-gh pr create --fill --head $branch --repo $env:GITHUB_REPOSITORY --base $ENV:GITHUB_REF_NAME
|
||||
$status = invoke-git -returnValue status --porcelain=v1
|
||||
if ($status) {
|
||||
if ($commitMessage.Length -gt 250) {
|
||||
$commitMessage = "$($commitMessage.Substring(0,250))...)"
|
||||
}
|
||||
catch {
|
||||
OutputError("GitHub actions are not allowed to create Pull Requests (see GitHub Organization or Repository Actions Settings). You can create the PR manually by navigating to $($env:GITHUB_SERVER_URL)/$($env:GITHUB_REPOSITORY)/tree/$branch")
|
||||
invoke-git commit --allow-empty -m "$commitMessage"
|
||||
if ($branch) {
|
||||
invoke-git push -u $serverUrl $branch
|
||||
try {
|
||||
invoke-gh pr create --fill --head $branch --repo $env:GITHUB_REPOSITORY --base $ENV:GITHUB_REF_NAME
|
||||
}
|
||||
catch {
|
||||
OutputError("GitHub actions are not allowed to create Pull Requests (see GitHub Organization or Repository Actions Settings). You can create the PR manually by navigating to $($env:GITHUB_SERVER_URL)/$($env:GITHUB_REPOSITORY)/tree/$branch")
|
||||
}
|
||||
}
|
||||
else {
|
||||
invoke-git push $serverUrl
|
||||
}
|
||||
return $true
|
||||
}
|
||||
else {
|
||||
invoke-git push $serverUrl
|
||||
Write-Host "No changes detected in files"
|
||||
return $false
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2222,3 +2236,34 @@ function RetryCommand {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
function GetProjectsFromRepository {
|
||||
Param(
|
||||
[string] $baseFolder,
|
||||
[string[]] $projectsFromSettings,
|
||||
[string] $selectProjects = ''
|
||||
)
|
||||
if ($projectsFromSettings) {
|
||||
$projects = $projectsFromSettings
|
||||
}
|
||||
else {
|
||||
# For multiple projects, get all folders in two levels below the base folder containing an .AL-Go folder with a settings.json file
|
||||
$projects = @(Get-ChildItem -Path $baseFolder -Recurse -Depth 2 -Force | Where-Object { $_.PSIsContainer -and (Test-Path (Join-Path $_.FullName ".AL-Go/settings.json") -PathType Leaf) } | ForEach-Object { $_.FullName.Substring($baseFolder.length+1) })
|
||||
# To support single project repositories, we check for the .AL-Go folder in the root
|
||||
if (Test-Path (Join-Path $baseFolder ".AL-Go/settings.json") -PathType Leaf) {
|
||||
$projects += @(".")
|
||||
}
|
||||
}
|
||||
if ($selectProjects) {
|
||||
# Filter the project list based on the projects parameter
|
||||
if ($selectProjects.StartsWith('[')) {
|
||||
$selectProjects = ($selectProjects | ConvertFrom-Json) -join ","
|
||||
}
|
||||
$projectArr = $selectProjects.Split(',').Trim()
|
||||
$projects = @($projects | Where-Object { $project = $_; if ($projectArr | Where-Object { $project -like $_ }) { $project } })
|
||||
if ($projects.Count -eq 0) {
|
||||
throw "No projects matches '$selectProjects'"
|
||||
}
|
||||
}
|
||||
return $projects
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
[string] $url,
|
||||
[Parameter(HelpMessage = "Set the branch to update", Mandatory = $false)]
|
||||
[string] $updateBranch,
|
||||
[Parameter(HelpMessage = "Direct Commit (Y/N)", Mandatory = $false)]
|
||||
[Parameter(HelpMessage = "Direct Commit?", Mandatory = $false)]
|
||||
[bool] $directCommit
|
||||
)
|
||||
|
||||
|
@ -82,12 +82,7 @@ $telemetryScope = $null
|
|||
|
||||
try {
|
||||
. (Join-Path -Path $PSScriptRoot -ChildPath "..\AL-Go-Helper.ps1" -Resolve)
|
||||
$branch = ''
|
||||
if (!$directcommit) {
|
||||
# If not direct commit, create a new branch with name, relevant to the current date and base branch, and switch to it
|
||||
$branch = "add-existing-app/$updateBranch/$((Get-Date).ToUniversalTime().ToString(`"yyMMddHHmmss`"))" # e.g. add-existing-app/main/210101120000
|
||||
}
|
||||
$serverUrl = CloneIntoNewFolder -actor $actor -token $token -branch $branch
|
||||
$serverUrl, $branch = CloneIntoNewFolder -actor $actor -token $token -updateBranch $updateBranch -DirectCommit $directCommit -newBranchPrefix 'add-existing-app'
|
||||
$baseFolder = (Get-Location).path
|
||||
DownloadAndImportBcContainerHelper -baseFolder $baseFolder
|
||||
|
||||
|
@ -219,7 +214,7 @@ try {
|
|||
}
|
||||
}
|
||||
Set-Location $baseFolder
|
||||
CommitFromNewFolder -serverUrl $serverUrl -commitMessage "Add existing apps ($($appNames -join ', '))" -branch $branch
|
||||
CommitFromNewFolder -serverUrl $serverUrl -commitMessage "Add existing apps ($($appNames -join ', '))" -branch $branch | Out-Null
|
||||
|
||||
TrackTrace -telemetryScope $telemetryScope
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ none
|
|||
| project | | Project name if the repository is setup for multiple projects | . |
|
||||
| url | Yes | Direct Download Url of .app or .zip file to add to the repository | |
|
||||
| updateBranch | | Which branch should the app be added to | github.ref_name |
|
||||
| directCommit | | Y if the action should create a direct commit against the branch or N to create a Pull Request | N |
|
||||
| directCommit | | true if the action should create a direct commit against the branch or false to create a Pull Request | false |
|
||||
|
||||
## OUTPUT
|
||||
none
|
|
@ -32,9 +32,9 @@ inputs:
|
|||
required: false
|
||||
default: ${{ github.ref_name }}
|
||||
directCommit:
|
||||
description: Direct Commit (Y/N)
|
||||
description: Direct Commit?
|
||||
required: false
|
||||
default: 'N'
|
||||
default: 'false'
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
|
@ -51,7 +51,7 @@ runs:
|
|||
run: |
|
||||
$errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0
|
||||
try {
|
||||
${{ github.action_path }}/AddExistingApp.ps1 -actor $ENV:_actor -token $ENV:_token -parentTelemetryScopeJson $ENV:_parentTelemetryScopeJson -project $ENV:_project -url $ENV:_url -updateBranch $ENV:_updateBranch -directCommit ($ENV:_directCommit -eq 'Y')
|
||||
${{ github.action_path }}/AddExistingApp.ps1 -actor $ENV:_actor -token $ENV:_token -parentTelemetryScopeJson $ENV:_parentTelemetryScopeJson -project $ENV:_project -url $ENV:_url -updateBranch $ENV:_updateBranch -directCommit ($ENV:_directCommit -eq 'true')
|
||||
}
|
||||
catch {
|
||||
Write-Host "::ERROR::Unexpected error when running action. Error Message: $($_.Exception.Message.Replace("`r",'').Replace("`n",' ')), StackTrace: $($_.ScriptStackTrace.Replace("`r",'').Replace("`n",' <- '))";
|
||||
|
|
|
@ -0,0 +1,345 @@
|
|||
<#
|
||||
.SYNOPSIS
|
||||
Downloads a template repository and returns the path to the downloaded folder
|
||||
.PARAMETER headers
|
||||
The headers to use when calling the GitHub API
|
||||
.PARAMETER templateUrl
|
||||
The URL to the template repository
|
||||
.PARAMETER templateSha
|
||||
The SHA of the template repository (returned by reference if downloadLatest is true)
|
||||
.PARAMETER downloadLatest
|
||||
If true, the latest SHA of the template repository will be downloaded
|
||||
#>
|
||||
function DownloadTemplateRepository {
|
||||
Param(
|
||||
[hashtable] $headers,
|
||||
[string] $templateUrl,
|
||||
[ref] $templateSha,
|
||||
[bool] $downloadLatest
|
||||
)
|
||||
|
||||
# Construct API URL
|
||||
$apiUrl = $templateUrl.Split('@')[0] -replace "^(https:\/\/github\.com\/)(.*)$", "$ENV:GITHUB_API_URL/repos/`$2"
|
||||
$branch = $templateUrl.Split('@')[1]
|
||||
|
||||
Write-Host "TemplateUrl: $templateUrl"
|
||||
Write-Host "TemplateSha: $($templateSha.Value)"
|
||||
Write-Host "DownloadLatest: $downloadLatest"
|
||||
|
||||
if ($downloadLatest) {
|
||||
# Get Branches from template repository
|
||||
$response = InvokeWebRequest -Headers $headers -Uri "$apiUrl/branches" -retry
|
||||
$branchInfo = ($response.content | ConvertFrom-Json) | Where-Object { $_.Name -eq $branch }
|
||||
if (!$branchInfo) {
|
||||
throw "$templateUrl doesn't exist"
|
||||
}
|
||||
$templateSha.Value = $branchInfo.commit.sha
|
||||
Write-Host "Latest SHA for $($templateUrl): $($templateSha.Value)"
|
||||
}
|
||||
$archiveUrl = "$apiUrl/zipball/$($templateSha.Value)"
|
||||
Write-Host "Using ArchiveUrl: $archiveUrl"
|
||||
|
||||
# Download template repository
|
||||
$tempName = Join-Path ([System.IO.Path]::GetTempPath()) ([Guid]::NewGuid().ToString())
|
||||
InvokeWebRequest -Headers $headers -Uri $archiveUrl -OutFile "$tempName.zip" -retry
|
||||
Expand-7zipArchive -Path "$tempName.zip" -DestinationPath $tempName
|
||||
Remove-Item -Path "$tempName.zip"
|
||||
return $tempName
|
||||
}
|
||||
|
||||
function ModifyCICDWorkflow {
|
||||
Param(
|
||||
[Yaml] $yaml,
|
||||
[hashtable] $repoSettings
|
||||
)
|
||||
|
||||
# The CICD workflow can have a RepoSetting called CICDPushBranches, which will be used to set the branches for the workflow
|
||||
# Setting the CICDSchedule will disable the push trigger for the CI/CD workflow (unless CICDPushBranches is set)
|
||||
if ($repoSettings.Keys -contains 'CICDPushBranches') {
|
||||
$CICDPushBranches = $repoSettings.CICDPushBranches
|
||||
}
|
||||
elseif ($repoSettings.Keys -contains $workflowScheduleKey) {
|
||||
$CICDPushBranches = ''
|
||||
}
|
||||
else {
|
||||
$CICDPushBranches = $defaultCICDPushBranches
|
||||
}
|
||||
# update the branches: line with the new branches
|
||||
if ($CICDPushBranches) {
|
||||
$yaml.Replace('on:/push:/branches:', "branches: [ '$($cicdPushBranches -join "', '")' ]")
|
||||
}
|
||||
else {
|
||||
$yaml.Replace('on:/push:',@())
|
||||
}
|
||||
}
|
||||
|
||||
function ModifyPullRequestHandlerWorkflow {
|
||||
Param(
|
||||
[Yaml] $yaml,
|
||||
[hashtable] $repoSettings
|
||||
)
|
||||
# The PullRequestHandler workflow can have a RepoSetting called PullRequestTrigger which specifies the trigger to use for Pull Requests
|
||||
$triggerSection = $yaml.Get('on:/pull')
|
||||
$triggerSection.content = "$($repoSettings.PullRequestTrigger):"
|
||||
$yaml.Replace('on:/pull', $triggerSection.Content)
|
||||
|
||||
# The PullRequestHandler workflow can have a RepoSetting called CICDPullRequestBranches, which will be used to set the branches for the workflow
|
||||
if ($repoSettings.Keys -contains 'CICDPullRequestBranches') {
|
||||
$CICDPullRequestBranches = $repoSettings.CICDPullRequestBranches
|
||||
}
|
||||
else {
|
||||
$CICDPullRequestBranches = $defaultCICDPullRequestBranches
|
||||
}
|
||||
|
||||
# update the branches: line with the new branches
|
||||
$yaml.Replace("on:/$($repoSettings.PullRequestTrigger):/branches:", "branches: [ '$($CICDPullRequestBranches -join "', '")' ]")
|
||||
}
|
||||
|
||||
function ModifyRunsOnAndShell {
|
||||
Param(
|
||||
[Yaml] $yaml,
|
||||
[hashtable] $repoSettings
|
||||
)
|
||||
|
||||
# The default for runs-on is windows-latest and the default for shell is powershell
|
||||
# The default for GitHubRunner/GitHubRunnerShell is runs-on/shell (unless Ubuntu-latest are selected here, as build jobs cannot run on Ubuntu)
|
||||
# We do not change runs-on in Update AL Go System Files and Pull Request Handler workflows
|
||||
# These workflows will always run on windows-latest (or maybe Ubuntu-latest later) and not follow settings
|
||||
# Reasons:
|
||||
# - Update AL-Go System files is needed for changing runs-on - by having non-functioning runners, you might dead-lock yourself
|
||||
# - Pull Request Handler workflow for security reasons
|
||||
if ($repoSettings."runs-on" -ne "windows-latest") {
|
||||
Write-Host "Setting runs-on to [ $($repoSettings."runs-on") ]"
|
||||
$yaml.ReplaceAll('runs-on: [ windows-latest ]', "runs-on: [ $($repoSettings."runs-on") ]")
|
||||
}
|
||||
if ($repoSettings.shell -ne "powershell" -and $repoSettings.shell -ne "pwsh") {
|
||||
throw "The shell can only be set to powershell or pwsh"
|
||||
}
|
||||
Write-Host "Setting shell to $($repoSettings.shell)"
|
||||
$yaml.ReplaceAll('shell: powershell', "shell: $($repoSettings.shell)")
|
||||
}
|
||||
|
||||
function ModifyBuildWorkflows {
|
||||
Param(
|
||||
[Yaml] $yaml,
|
||||
[int] $depth
|
||||
)
|
||||
|
||||
$yaml.Replace('env:/workflowDepth:',"workflowDepth: $depth")
|
||||
$build = $yaml.Get('jobs:/Build:/')
|
||||
if (!$build) {
|
||||
throw "No build job found in the workflow"
|
||||
}
|
||||
|
||||
# Duplicate the build job for each dependency depth
|
||||
$newBuild = @()
|
||||
for($index = 0; $index -lt $depth; $index++) {
|
||||
# All build job needs to have a dependency on the Initialization job
|
||||
$needs = @('Initialization')
|
||||
if ($index -eq 0) {
|
||||
# First build job needs to have a dependency on the Initialization job only
|
||||
# Example (depth 1):
|
||||
# needs: [ Initialization ]
|
||||
# if: (!failure()) && (!cancelled()) && fromJson(needs.Initialization.outputs.buildOrderJson)[0].projectsCount > 0
|
||||
$if = "if: (!failure()) && (!cancelled()) && fromJson(needs.Initialization.outputs.buildOrderJson)[$index].projectsCount > 0"
|
||||
}
|
||||
else {
|
||||
# Subsequent build jobs needs to have a dependency on all previous build jobs
|
||||
# Example (depth 2):
|
||||
# needs: [ Initialization, Build1 ]
|
||||
# if: (!failure()) && (!cancelled()) && (needs.Build1.result == 'success' || needs.Build1.result == 'skipped') && fromJson(needs.Initialization.outputs.buildOrderJson)[0].projectsCount > 0
|
||||
# Another example (depth 3):
|
||||
# needs: [ Initialization, Build2, Build1 ]
|
||||
# if: (!failure()) && (!cancelled()) && (needs.Build2.result == 'success' || needs.Build2.result == 'skipped') && (needs.Build1.result == 'success' || needs.Build1.result == 'skipped') && fromJson(needs.Initialization.outputs.buildOrderJson)[0].projectsCount > 0
|
||||
$newBuild += @('')
|
||||
$ifpart = ""
|
||||
$index..1 | ForEach-Object {
|
||||
$needs += @("Build$_")
|
||||
$ifpart += " && (needs.Build$_.result == 'success' || needs.Build$_.result == 'skipped')"
|
||||
}
|
||||
$if = "if: (!failure()) && (!cancelled())$ifpart && fromJson(needs.Initialization.outputs.buildOrderJson)[$index].projectsCount > 0"
|
||||
}
|
||||
|
||||
# Replace the if:, the needs: and the strategy/matrix/project: in the build job with the correct values
|
||||
$build.Replace('if:', $if)
|
||||
$build.Replace('needs:', "needs: [ $($needs -join ', ') ]")
|
||||
$build.Replace('strategy:/matrix:/include:',"include: `${{ fromJson(needs.Initialization.outputs.buildOrderJson)[$index].buildDimensions }}")
|
||||
|
||||
# Last build job is called build, all other build jobs are called build1, build2, etc.
|
||||
if ($depth -eq ($index + 1)) {
|
||||
$newBuild += @("Build:")
|
||||
}
|
||||
else {
|
||||
$newBuild += @("Build$($index + 1):")
|
||||
}
|
||||
|
||||
# Add the content of the calculated build job to the new build job list with an indentation of 2 spaces
|
||||
$build.content | ForEach-Object { $newBuild += @(" $_") }
|
||||
}
|
||||
|
||||
# Replace the entire build: job with the new build job list
|
||||
$yaml.Replace('jobs:/Build:', $newBuild)
|
||||
}
|
||||
|
||||
function GetWorkflowContentWithChangesFromSettings {
|
||||
Param(
|
||||
[string] $srcFile,
|
||||
[hashtable] $repoSettings,
|
||||
[int] $depth
|
||||
)
|
||||
|
||||
$baseName = [System.IO.Path]::GetFileNameWithoutExtension($srcFile)
|
||||
$yaml = [Yaml]::Load($srcFile)
|
||||
$workflowScheduleKey = "$($baseName)Schedule"
|
||||
|
||||
# Any workflow (except for the PullRequestHandler and reusable workflows (_*)) can have a RepoSetting called <workflowname>Schedule, which will be used to set the schedule for the workflow
|
||||
if ($baseName -ne "PullRequestHandler" -and $baseName -notlike '_*') {
|
||||
if ($repoSettings.Keys -contains $workflowScheduleKey) {
|
||||
# Read the section under the on: key and add the schedule section
|
||||
$yamlOn = $yaml.Get('on:/')
|
||||
$yaml.Replace('on:/', $yamlOn.content+@('schedule:', " - cron: '$($repoSettings."$workflowScheduleKey")'"))
|
||||
}
|
||||
}
|
||||
|
||||
if ($baseName -eq "CICD") {
|
||||
ModifyCICDWorkflow -yaml $yaml -repoSettings $repoSettings
|
||||
}
|
||||
|
||||
if ($baseName -eq "PullRequestHandler") {
|
||||
ModifyPullRequestHandlerWorkflow -yaml $yaml -repoSettings $repoSettings
|
||||
}
|
||||
|
||||
if ($baseName -ne "UpdateGitHubGoSystemFiles" -and $baseName -ne "PullRequestHandler") {
|
||||
ModifyRunsOnAndShell -yaml $yaml -repoSettings $repoSettings
|
||||
}
|
||||
|
||||
# PullRequestHandler, CICD, Current, NextMinor and NextMajor workflows all include a build step.
|
||||
# If the dependency depth is higher than 1, we need to add multiple dependent build jobs to the workflow
|
||||
if ($depth -gt 1 -and ($baseName -eq 'PullRequestHandler' -or $baseName -eq 'CICD' -or $baseName -eq 'Current' -or $baseName -eq 'NextMinor' -or $baseName -eq 'NextMajor')) {
|
||||
ModifyBuildWorkflows -yaml $yaml -depth $depth
|
||||
}
|
||||
|
||||
# combine all the yaml file lines into a single string with LF line endings
|
||||
$yaml.content -join "`n"
|
||||
}
|
||||
|
||||
# Using direct AL-Go repo, we need to change the owner to the templateOwner, the repo names to AL-Go and AL-Go/Actions and the branch to templateBranch
|
||||
|
||||
function ReplaceOwnerRepoAndBranch {
|
||||
Param(
|
||||
[ref] $srcContent,
|
||||
[string] $templateOwner,
|
||||
[string] $templateBranch
|
||||
)
|
||||
|
||||
$lines = $srcContent.Value.Split("`n")
|
||||
|
||||
# The Original Owner and Repo in the AL-Go repository are microsoft/AL-Go-Actions, microsoft/AL-Go-PTE and microsoft/AL-Go-AppSource
|
||||
$originalOwnerAndRepo = @{
|
||||
"actionsRepo" = "microsoft/AL-Go-Actions"
|
||||
"perTenantExtensionRepo" = "microsoft/AL-Go-PTE"
|
||||
"appSourceAppRepo" = "microsoft/AL-Go-AppSource"
|
||||
}
|
||||
# Original branch is always main
|
||||
$originalBranch = "main"
|
||||
|
||||
# Modify the file to use repository names based on whether or not we are using the direct AL-Go repo
|
||||
$templateRepos = @{
|
||||
"actionsRepo" = "AL-Go/Actions"
|
||||
"perTenantExtensionRepo" = "AL-Go"
|
||||
"appSourceAppRepo" = "AL-Go"
|
||||
}
|
||||
|
||||
# Replace URL's to actions repository first
|
||||
$regex = "^(.*)https:\/\/raw\.githubusercontent\.com\/microsoft\/AL-Go-Actions\/$originalBranch(.*)$"
|
||||
$replace = "`${1}https://raw.githubusercontent.com/$($templateOwner)/AL-Go/$($templateBranch)/Actions`${2}"
|
||||
$lines = $lines | ForEach-Object { $_ -replace $regex, $replace }
|
||||
|
||||
# Replace the owner and repo names in the workflow
|
||||
"actionsRepo","perTenantExtensionRepo","appSourceAppRepo" | ForEach-Object {
|
||||
$regex = "^(.*)$($originalOwnerAndRepo."$_")(.*)$originalBranch(.*)$"
|
||||
$replace = "`${1}$($templateOwner)/$($templateRepos."$_")`${2}$($templateBranch)`${3}"
|
||||
$lines = $lines | ForEach-Object { $_ -replace $regex, $replace }
|
||||
}
|
||||
$srcContent.Value = $lines -join "`n"
|
||||
}
|
||||
|
||||
function IsDirectALGo {
|
||||
param (
|
||||
[string] $templateUrl
|
||||
)
|
||||
$directALGo = $templateUrl -like 'https://github.com/*/AL-Go@*'
|
||||
if ($directALGo) {
|
||||
if ($templateUrl -like 'https://github.com/microsoft/AL-Go@*' -and -not ($templateUrl -like 'https://github.com/microsoft/AL-Go@*/*')) {
|
||||
throw "You cannot use microsoft/AL-Go as a template repository. Please use a fork of AL-Go instead."
|
||||
}
|
||||
}
|
||||
return $directALGo
|
||||
}
|
||||
|
||||
function GetSrcFolder {
|
||||
Param(
|
||||
[hashtable] $repoSettings,
|
||||
[string] $templateUrl,
|
||||
[string] $templateFolder,
|
||||
[string] $srcPath
|
||||
)
|
||||
Write-Host $templateUrl
|
||||
Write-Host $templateFolder
|
||||
Write-Host $srcPath
|
||||
if (!$templateUrl) {
|
||||
return ''
|
||||
}
|
||||
if (IsDirectALGo -templateUrl $templateUrl) {
|
||||
switch ($repoSettings.type) {
|
||||
"PTE" {
|
||||
$typePath = "Per Tenant Extension"
|
||||
}
|
||||
"AppSource App" {
|
||||
$typePath = "AppSource App"
|
||||
}
|
||||
default {
|
||||
throw "Unknown repository type"
|
||||
}
|
||||
}
|
||||
$path = Join-Path $templateFolder "*/Templates/$typePath/$srcPath"
|
||||
}
|
||||
else {
|
||||
$path = Join-Path $templateFolder "*/$srcPath"
|
||||
}
|
||||
Resolve-Path -Path $path -ErrorAction SilentlyContinue
|
||||
}
|
||||
|
||||
function UpdateSettingsFile {
|
||||
Param(
|
||||
[string] $settingsFile,
|
||||
[hashtable] $updateSettings,
|
||||
[hashtable] $additionalSettings = @{}
|
||||
)
|
||||
|
||||
# Update Repo Settings file with the template URL
|
||||
if (Test-Path $settingsFile) {
|
||||
$settings = Get-Content $settingsFile -Encoding UTF8 | ConvertFrom-Json
|
||||
}
|
||||
else {
|
||||
$settings = [PSCustomObject]@{}
|
||||
}
|
||||
foreach($key in $updateSettings.Keys) {
|
||||
if ($settings.PSObject.Properties.Name -eq $key) {
|
||||
$settings."$key" = $updateSettings."$key"
|
||||
}
|
||||
else {
|
||||
# Add the property if it doesn't exist
|
||||
$settings | Add-Member -MemberType NoteProperty -Name "$key" -Value $updateSettings."$key"
|
||||
}
|
||||
}
|
||||
# Grab settings from additionalSettings if they are not already in settings
|
||||
foreach($key in $additionalSettings.Keys) {
|
||||
if (!($settings.PSObject.Properties.Name -eq $key)) {
|
||||
# Add the property if it doesn't exist
|
||||
$settings | Add-Member -MemberType NoteProperty -Name "$key" -Value $additionalSettings."$key"
|
||||
}
|
||||
}
|
||||
# Save the file with LF line endings and UTF8 encoding
|
||||
$settings | Set-JsonContentLF -path $settingsFile
|
||||
}
|
|
@ -3,363 +3,161 @@
|
|||
[string] $actor,
|
||||
[Parameter(HelpMessage = "The GitHub token running the action", Mandatory = $false)]
|
||||
[string] $token,
|
||||
[Parameter(HelpMessage = "Specifies the parent telemetry scope for the telemetry signal", Mandatory = $false)]
|
||||
[string] $parentTelemetryScopeJson = '7b7d',
|
||||
[Parameter(HelpMessage = "URL of the template repository (default is the template repository used to create the repository)", Mandatory = $false)]
|
||||
[string] $templateUrl = "",
|
||||
[Parameter(HelpMessage = "Branch in template repository to use for the update (default is the default branch)", Mandatory = $false)]
|
||||
[string] $templateBranch = "",
|
||||
[Parameter(HelpMessage = "Set this input to true in order to download latest version of the template repository (else it will reuse the SHA from last update)", Mandatory = $true)]
|
||||
[bool] $downloadLatest,
|
||||
[Parameter(HelpMessage = "Set this input to Y in order to update AL-Go System Files if needed", Mandatory = $false)]
|
||||
[bool] $update,
|
||||
[string] $update = 'N',
|
||||
[Parameter(HelpMessage = "Set the branch to update", Mandatory = $false)]
|
||||
[string] $updateBranch,
|
||||
[Parameter(HelpMessage = "Direct Commit (Y/N)", Mandatory = $false)]
|
||||
[Parameter(HelpMessage = "Direct Commit?", Mandatory = $false)]
|
||||
[bool] $directCommit
|
||||
)
|
||||
|
||||
$telemetryScope = $null
|
||||
. (Join-Path -Path $PSScriptRoot -ChildPath "..\AL-Go-Helper.ps1" -Resolve)
|
||||
. (Join-Path -Path $PSScriptRoot -ChildPath "yamlclass.ps1")
|
||||
. (Join-Path -Path $PSScriptRoot -ChildPath "CheckForUpdates.HelperFunctions.ps1")
|
||||
|
||||
try {
|
||||
. (Join-Path -Path $PSScriptRoot -ChildPath "..\AL-Go-Helper.ps1" -Resolve)
|
||||
. (Join-Path -Path $PSScriptRoot -ChildPath "yamlclass.ps1")
|
||||
# ContainerHelper is used for determining project folders and dependencies
|
||||
DownloadAndImportBcContainerHelper
|
||||
|
||||
DownloadAndImportBcContainerHelper
|
||||
|
||||
import-module (Join-Path -path $PSScriptRoot -ChildPath "..\TelemetryHelper.psm1" -Resolve)
|
||||
$telemetryScope = CreateScope -eventId 'DO0071' -parentTelemetryScopeJson $parentTelemetryScopeJson
|
||||
|
||||
if ($update) {
|
||||
if (-not $token) {
|
||||
throw "A personal access token with permissions to modify Workflows is needed. You must add a secret called GhTokenWorkflow containing a personal access token. You can Generate a new token from https://github.com/settings/tokens. Make sure that the workflow scope is checked."
|
||||
}
|
||||
else {
|
||||
$token = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($token))
|
||||
}
|
||||
}
|
||||
|
||||
# Support old calling convention
|
||||
if (-not $templateUrl.Contains('@')) {
|
||||
if ($templateBranch) {
|
||||
$templateUrl += "@$templateBranch"
|
||||
}
|
||||
else {
|
||||
$templateUrl += "@main"
|
||||
}
|
||||
}
|
||||
if ($templateUrl -notlike "https://*") {
|
||||
$templateUrl = "https://github.com/$templateUrl"
|
||||
}
|
||||
|
||||
# DirectALGo is used to determine if the template is a direct link to an AL-Go repository
|
||||
$directALGo = $templateUrl -like 'https://github.com/*/AL-Go@*'
|
||||
if ($directALGo) {
|
||||
if ($templateUrl -like 'https://github.com/microsoft/AL-Go@*' -and -not ($templateUrl -like 'https://github.com/microsoft/AL-Go@*/*')) {
|
||||
throw "You cannot use microsoft/AL-Go as a template repository. Please use a fork of AL-Go instead."
|
||||
}
|
||||
}
|
||||
|
||||
# TemplateUrl is now always a full url + @ and a branch name
|
||||
|
||||
# CheckForUpdates will read all AL-Go System files from the Template repository and compare them to the ones in the current repository
|
||||
# CheckForUpdates will apply changes to the AL-Go System files based on AL-Go repo settings, such as "runs-on", "UseProjectDependencies", etc.
|
||||
# if $update is set to true, CheckForUpdates will also update the AL-Go System files in the current repository using a PR or a direct commit (if $directCommit is set to true)
|
||||
# if $update is set to false, CheckForUpdates will only check for updates and output a warning if there are updates available
|
||||
|
||||
# Get Repo settings as a hashtable
|
||||
$repoSettings = ReadSettings -project '' -workflowName '' -userName '' -branchName '' | ConvertTo-HashTable
|
||||
$unusedALGoSystemFiles = $repoSettings.unusedALGoSystemFiles
|
||||
|
||||
# if UpdateSettings is true, we need to update the settings file with the new template url (i.e. there are changes to your AL-Go System files)
|
||||
$updateSettings = $true
|
||||
if ($repoSettings.templateUrl -eq $templateUrl) {
|
||||
# No need to update settings file
|
||||
$updateSettings = $false
|
||||
}
|
||||
|
||||
AddTelemetryProperty -telemetryScope $telemetryScope -key "templateUrl" -value $templateUrl
|
||||
|
||||
$templateBranch = $templateUrl.Split('@')[1]
|
||||
$templateUrl = $templateUrl.Split('@')[0]
|
||||
$templateOwner = $templateUrl.Split('/')[3]
|
||||
|
||||
# Build the $archiceUrl instead of using the GitHub API
|
||||
# The GitHub API has a rate limit of 60 requests per hour, which is not enough for a large number of repositories using AL-Go
|
||||
$archiveUrl = "$($templateUrl -replace "https://www.github.com/","$ENV:GITHUB_API_URL/repos/" -replace "https://github.com/","$ENV:GITHUB_API_URL/repos/")/zipball/$templateBranch"
|
||||
|
||||
Write-Host "Using template from $templateUrl@$templateBranch"
|
||||
Write-Host "Using ArchiveUrl $archiveUrl"
|
||||
|
||||
# Download the template repository and unpack to a temp folder
|
||||
$headers = @{
|
||||
"Accept" = "application/vnd.github.baptiste-preview+json"
|
||||
"token" = $token
|
||||
}
|
||||
$tempName = Join-Path ([System.IO.Path]::GetTempPath()) ([Guid]::NewGuid().ToString())
|
||||
InvokeWebRequest -Headers $headers -Uri $archiveUrl -OutFile "$tempName.zip" -retry
|
||||
Expand-7zipArchive -Path "$tempName.zip" -DestinationPath $tempName
|
||||
Remove-Item -Path "$tempName.zip"
|
||||
|
||||
# CheckFiles is an array of hashtables with the following properties:
|
||||
# dstPath: The path to the file in the current repository
|
||||
# srcPath: The path to the file in the template repository
|
||||
# pattern: The pattern to use when searching for files in the template repository
|
||||
# type: The type of file (script, workflow, releasenotes)
|
||||
# The files currently checked are:
|
||||
# - All files in .github/workflows
|
||||
# - All files in .github that ends with .copy.md
|
||||
# - All PowerShell scripts in .AL-Go folders (all projects)
|
||||
$srcGitHubPath = '.github'
|
||||
$srcALGoPath = '.AL-Go'
|
||||
if ($directALGo) {
|
||||
# When using a direct link to an AL-Go repository, the files are in a subfolder of the template repository
|
||||
$typePath = $repoSettings.type
|
||||
if ($typePath -eq "PTE") {
|
||||
$typePath = "Per Tenant Extension"
|
||||
}
|
||||
$srcGitHubPath = Join-Path "Templates/$typePath" $srcGitHubPath
|
||||
$srcALGoPath = Join-Path "Templates/$typePath" $srcALGoPath
|
||||
}
|
||||
$checkfiles = @(
|
||||
@{ "dstPath" = Join-Path ".github" "workflows"; "srcPath" = Join-Path $srcGitHubPath 'workflows'; "pattern" = "*"; "type" = "workflow" },
|
||||
@{ "dstPath" = ".github"; "srcPath" = $srcGitHubPath; "pattern" = "*.copy.md"; "type" = "releasenotes" }
|
||||
)
|
||||
# Get the list of projects in the current repository
|
||||
$baseFolder = $ENV:GITHUB_WORKSPACE
|
||||
if ($repoSettings.projects) {
|
||||
$projects = $repoSettings.projects
|
||||
if ($update -eq 'Y') {
|
||||
if (-not $token) {
|
||||
throw "A personal access token with permissions to modify Workflows is needed. You must add a secret called GhTokenWorkflow containing a personal access token. You can Generate a new token from https://github.com/settings/tokens. Make sure that the workflow scope is checked."
|
||||
}
|
||||
else {
|
||||
$projects = @(Get-ChildItem -Path $baseFolder -Recurse -Depth 2 -Force | Where-Object { $_.PSIsContainer -and (Test-Path (Join-Path $_.FullName ".AL-Go/settings.json") -PathType Leaf) } | ForEach-Object { $_.FullName.Substring($baseFolder.length+1) })
|
||||
$token = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($token))
|
||||
}
|
||||
# To support single project repositories, we check for the .AL-Go folder in the root
|
||||
if (Test-Path (Join-Path $baseFolder ".AL-Go")) {
|
||||
$projects += @(".")
|
||||
}
|
||||
$projects | ForEach-Object {
|
||||
$checkfiles += @(@{ "dstPath" = Join-Path $_ ".AL-Go"; "srcPath" = $srcALGoPath; "pattern" = "*.ps1"; "type" = "script" })
|
||||
}
|
||||
|
||||
# Use Authenticated API request to avoid the 60 API calls per hour limit
|
||||
$headers = @{
|
||||
"Accept" = "application/vnd.github.baptiste-preview+json"
|
||||
"Authorization" = "Bearer $token"
|
||||
}
|
||||
|
||||
if (-not $templateUrl.Contains('@')) {
|
||||
$templateUrl += "@main"
|
||||
}
|
||||
if ($templateUrl -notlike "https://*") {
|
||||
$templateUrl = "https://github.com/$templateUrl"
|
||||
}
|
||||
# Remove www part (if exists)
|
||||
$templateUrl = $templateUrl -replace "^(https:\/\/)(www\.)(.*)$", '$1$3'
|
||||
|
||||
# TemplateUrl is now always a full url + @ and a branch name
|
||||
|
||||
# CheckForUpdates will read all AL-Go System files from the Template repository and compare them to the ones in the current repository
|
||||
# CheckForUpdates will apply changes to the AL-Go System files based on AL-Go repo settings, such as "runs-on", "useProjectDependencies", etc.
|
||||
# if $update is set to Y, CheckForUpdates will also update the AL-Go System files in the current repository using a PR or a direct commit (if $directCommit is set to true)
|
||||
# if $update is set to N, CheckForUpdates will only check for updates and output a warning if there are updates available
|
||||
# if $downloadLatest is set to true, CheckForUpdates will download the latest version of the template repository, else it will use the templateSha setting in the .github/AL-Go-Settings file
|
||||
|
||||
# Get Repo settings as a hashtable (do NOT read any specific project settings, nor any specific workflow, user or branch settings)
|
||||
$repoSettings = ReadSettings -project '' -workflowName '' -userName '' -branchName '' | ConvertTo-HashTable -recurse
|
||||
$templateSha = $repoSettings.templateSha
|
||||
$unusedALGoSystemFiles = $repoSettings.unusedALGoSystemFiles
|
||||
|
||||
# If templateUrl has changed, download latest version of the template repository (ignore templateSha)
|
||||
if ($repoSettings.templateUrl -ne $templateUrl -or $templateSha -eq '') {
|
||||
$downloadLatest = $true
|
||||
}
|
||||
|
||||
$templateFolder = DownloadTemplateRepository -headers $headers -templateUrl $templateUrl -templateSha ([ref]$templateSha) -downloadLatest $downloadLatest
|
||||
Write-Host "Template Folder: $templateFolder"
|
||||
|
||||
$templateBranch = $templateUrl.Split('@')[1]
|
||||
$templateOwner = $templateUrl.Split('/')[3]
|
||||
|
||||
$isDirectALGo = IsDirectALGo -templateUrl $templateUrl
|
||||
if (-not $isDirectALGo) {
|
||||
$ALGoSettingsFile = Join-Path $templateFolder "*/$repoSettingsFile"
|
||||
if (Test-Path -Path $ALGoSettingsFile -PathType Leaf) {
|
||||
$templateRepoSettings = Get-Content $ALGoSettingsFile -Encoding UTF8 | ConvertFrom-Json | ConvertTo-HashTable -Recurse
|
||||
if ($templateRepoSettings.Keys -contains "templateUrl" -and $templateRepoSettings.templateUrl -ne $templateUrl) {
|
||||
throw "The specified template repository is not a template repository, but instead another AL-Go repository. This is not supported."
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# $updateFiles will hold an array of files, which needs to be updated
|
||||
$updateFiles = @()
|
||||
# $removeFiles will hold an array of files, which needs to be removed
|
||||
$removeFiles = @()
|
||||
# CheckFiles is an array of hashtables with the following properties:
|
||||
# dstPath: The path to the file in the current repository
|
||||
# srcPath: The path to the file in the template repository
|
||||
# pattern: The pattern to use when searching for files in the template repository
|
||||
# type: The type of file (script, workflow, releasenotes)
|
||||
# The files currently checked are:
|
||||
# - All files in .github/workflows
|
||||
# - All files in .github that ends with .copy.md
|
||||
# - All PowerShell scripts in .AL-Go folders (all projects)
|
||||
$checkfiles = @(
|
||||
@{ 'dstPath' = Join-Path '.github' 'workflows'; 'srcPath' = Join-Path '.github' 'workflows'; 'pattern' = '*'; 'type' = 'workflow' },
|
||||
@{ 'dstPath' = '.github'; 'srcPath' = '.AL-Go'; 'pattern' = '*.copy.md'; 'type' = 'releasenotes' }
|
||||
)
|
||||
|
||||
Write-Host "Projects found: $($projects.Count)"
|
||||
$projects | ForEach-Object {
|
||||
Write-Host "- $_"
|
||||
}
|
||||
# Get the list of projects in the current repository
|
||||
$baseFolder = $ENV:GITHUB_WORKSPACE
|
||||
$projects = @(GetProjectsFromRepository -baseFolder $baseFolder -projectsFromSettings $repoSettings.projects)
|
||||
Write-Host "Projects found: $($projects.Count)"
|
||||
foreach($project in $projects) {
|
||||
Write-Host "- $project"
|
||||
$checkfiles += @(@{ 'dstPath' = Join-Path $project '.AL-Go'; 'srcPath' = '.AL-Go'; 'pattern' = '*.ps1'; 'type' = 'script' })
|
||||
}
|
||||
|
||||
# If useProjectDependencies is true, we need to calculate the dependency depth for all projects
|
||||
# Dependency depth determines how many build jobs we need to run sequentially
|
||||
# Every build job might spin up multiple jobs in parallel to build the projects without unresolved deependencies
|
||||
$depth = 1
|
||||
if ($repoSettings.useProjectDependencies -and $projects.Count -gt 1) {
|
||||
$buildAlso = @{}
|
||||
$projectDependencies = @{}
|
||||
$projectsOrder = AnalyzeProjectDependencies -baseFolder $baseFolder -projects $projects -buildAlso ([ref]$buildAlso) -projectDependencies ([ref]$projectDependencies)
|
||||
# $updateFiles will hold an array of files, which needs to be updated
|
||||
$updateFiles = @()
|
||||
# $removeFiles will hold an array of files, which needs to be removed
|
||||
$removeFiles = @()
|
||||
|
||||
$depth = $projectsOrder.Count
|
||||
Write-Host "Calculated dependency depth to be $depth"
|
||||
}
|
||||
# If useProjectDependencies is true, we need to calculate the dependency depth for all projects
|
||||
# Dependency depth determines how many build jobs we need to run sequentially
|
||||
# Every build job might spin up multiple jobs in parallel to build the projects without unresolved deependencies
|
||||
$depth = 1
|
||||
if ($repoSettings.useProjectDependencies -and $projects.Count -gt 1) {
|
||||
$buildAlso = @{}
|
||||
$projectDependencies = @{}
|
||||
$projectsOrder = AnalyzeProjectDependencies -baseFolder $baseFolder -projects $projects -buildAlso ([ref]$buildAlso) -projectDependencies ([ref]$projectDependencies)
|
||||
$depth = $projectsOrder.Count
|
||||
Write-Host "Calculated dependency depth to be $depth"
|
||||
}
|
||||
|
||||
# Loop through all folders in CheckFiles and check if there are any files that needs to be updated
|
||||
$checkfiles | ForEach-Object {
|
||||
Write-Host "Checking $($_.srcPath)\$($_.pattern)"
|
||||
$type = $_.type
|
||||
$srcPath = $_.srcPath
|
||||
$dstPath = $_.dstPath
|
||||
$dstFolder = Join-Path $baseFolder $dstPath
|
||||
$srcFolder = Resolve-Path -path (Join-Path $tempName "*\$($srcPath)") -ErrorAction SilentlyContinue
|
||||
if ($srcFolder) {
|
||||
# Loop through all folders in CheckFiles and check if there are any files that needs to be updated
|
||||
foreach($checkfile in $checkfiles) {
|
||||
Write-Host "Checking $($checkfile.srcPath)\$($checkfile.pattern)"
|
||||
$type = $checkfile.type
|
||||
$srcPath = $checkfile.srcPath
|
||||
$dstPath = $checkfile.dstPath
|
||||
$dstFolder = Join-Path $baseFolder $dstPath
|
||||
$srcFolder = GetSrcFolder -repoSettings $repoSettings -templateUrl $templateUrl -templateFolder $templateFolder -srcPath $srcPath
|
||||
if ($srcFolder) {
|
||||
Push-Location -Path $srcFolder
|
||||
try {
|
||||
# Loop through all files in the template repository matching the pattern
|
||||
Get-ChildItem -Path $srcFolder -Filter $_.pattern | ForEach-Object {
|
||||
Get-ChildItem -Path $srcFolder -Filter $checkfile.pattern | ForEach-Object {
|
||||
# Read the template file and modify it based on the settings
|
||||
# Compare the modified file with the file in the current repository
|
||||
$srcFile = $_.FullName
|
||||
$fileName = $_.Name
|
||||
Write-Host "- $filename"
|
||||
$baseName = $_.BaseName
|
||||
$name = $type
|
||||
$dstFile = Join-Path $dstFolder $fileName
|
||||
$srcFile = $_.FullName
|
||||
Write-Host "SrcFolder: $srcFolder"
|
||||
if ($type -eq "workflow") {
|
||||
# for workflow files, we might need to modify the file based on the settings
|
||||
$yaml = [Yaml]::Load($srcFile)
|
||||
$name = "$type $($yaml.get('name:').content[0].SubString(5).trim())"
|
||||
$workflowScheduleKey = "$($baseName)Schedule"
|
||||
|
||||
# Any workflow (except for the PullRequestHandler) can have a RepoSetting called <workflowname>Schedule, which will be used to set the schedule for the workflow
|
||||
if ($baseName -ne "PullRequestHandler") {
|
||||
if ($repoSettings.Keys -contains $workflowScheduleKey) {
|
||||
# Read the section under the on: key and add the schedule section
|
||||
$yamlOn = $yaml.Get('on:/')
|
||||
$yaml.Replace('on:/', $yamlOn.content+@('schedule:', " - cron: '$($repoSettings."$workflowScheduleKey")'"))
|
||||
}
|
||||
}
|
||||
|
||||
# The CICD workflow can have a RepoSetting called CICDPushBranches, which will be used to set the branches for the workflow
|
||||
# Setting the CICDSchedule will disable the push trigger for the CI/CD workflow (unless CICDPushBranches is set)
|
||||
if ($baseName -eq "CICD") {
|
||||
if ($repoSettings.Keys -contains 'CICDPushBranches') {
|
||||
$CICDPushBranches = $repoSettings.CICDPushBranches
|
||||
}
|
||||
elseif ($repoSettings.Keys -contains $workflowScheduleKey) {
|
||||
$CICDPushBranches = ''
|
||||
}
|
||||
else {
|
||||
$CICDPushBranches = $defaultCICDPushBranches
|
||||
}
|
||||
# update the branches: line with the new branches
|
||||
if ($CICDPushBranches) {
|
||||
$yaml.Replace('on:/push:/branches:', "branches: [ '$($cicdPushBranches -join "', '")' ]")
|
||||
}
|
||||
else {
|
||||
$yaml.Replace('on:/push:',@())
|
||||
}
|
||||
}
|
||||
|
||||
if ($baseName -eq "PullRequestHandler") {
|
||||
# The PullRequestHandler workflow can have a RepoSetting called PullRequestTrigger which specifies the trigger to use for Pull Requests
|
||||
$triggerSection = $yaml.Get('on:/pull')
|
||||
$triggerSection.content = "$($repoSettings.PullRequestTrigger):"
|
||||
$yaml.Replace('on:/pull', $triggerSection.Content)
|
||||
|
||||
# The PullRequestHandler workflow can have a RepoSetting called CICDPullRequestBranches, which will be used to set the branches for the workflow
|
||||
if ($repoSettings.Keys -contains 'CICDPullRequestBranches') {
|
||||
$CICDPullRequestBranches = $repoSettings.CICDPullRequestBranches
|
||||
}
|
||||
else {
|
||||
$CICDPullRequestBranches = $defaultCICDPullRequestBranches
|
||||
}
|
||||
|
||||
# update the branches: line with the new branches
|
||||
$yaml.Replace("on:/$($repoSettings.PullRequestTrigger):/branches:", "branches: [ '$($CICDPullRequestBranches -join "', '")' ]")
|
||||
}
|
||||
|
||||
# Repo Setting runs-on and shell determines which GitHub runner is used for all non-build jobs (build jobs are run using the GitHubRunner/GitHubRunnerShell repo settings)
|
||||
# The default for runs-on is windows-latest and the default for shell is powershell
|
||||
# The default for GitHubRunner/GitHubRunnerShell is runs-on/shell (unless Ubuntu-latest are selected here, as build jobs cannot run on Ubuntu)
|
||||
# We do not change runs-on in Update AL Go System Files and Pull Request Handler workflows
|
||||
# These workflows will always run on windows-latest (or maybe Ubuntu-latest later) and not follow settings
|
||||
# Reasons:
|
||||
# - Update AL-Go System files is needed for changing runs-on - by having non-functioning runners, you might dead-lock yourself
|
||||
# - Pull Request Handler workflow for security reasons
|
||||
if ($baseName -ne "UpdateGitHubGoSystemFiles" -and $baseName -ne "PullRequestHandler") {
|
||||
if ($repoSettings."runs-on" -ne "windows-latest") {
|
||||
Write-Host "Setting runs-on to [ $($repoSettings."runs-on") ]"
|
||||
$yaml.ReplaceAll('runs-on: [ windows-latest ]', "runs-on: [ $($repoSettings."runs-on") ]")
|
||||
}
|
||||
if ($repoSettings.shell -ne "powershell") {
|
||||
Write-Host "Setting shell to $($repoSettings.shell)"
|
||||
$yaml.ReplaceAll('shell: powershell', "shell: $($repoSettings.shell)")
|
||||
}
|
||||
}
|
||||
|
||||
# PullRequestHandler, CICD, Current, NextMinor and NextMajor workflows all include a build step.
|
||||
# If the dependency depth is higher than 1, we need to add multiple dependent build jobs to the workflow
|
||||
if ($baseName -eq 'PullRequestHandler' -or $baseName -eq 'CICD' -or $baseName -eq 'Current' -or $baseName -eq 'NextMinor' -or $baseName -eq 'NextMajor') {
|
||||
$yaml.Replace('env:/workflowDepth:',"workflowDepth: $depth")
|
||||
|
||||
if ($depth -gt 1) {
|
||||
# Also, duplicate the build job for each dependency depth
|
||||
|
||||
$build = $yaml.Get('jobs:/Build:/')
|
||||
if($build)
|
||||
{
|
||||
$newBuild = @()
|
||||
|
||||
1..$depth | ForEach-Object {
|
||||
$index = $_-1
|
||||
|
||||
# All build job needs to have a dependency on the Initialization job
|
||||
$needs = @('Initialization')
|
||||
if ($_ -eq 1) {
|
||||
# First build job needs to have a dependency on the Initialization job only
|
||||
# Example (depth 1):
|
||||
# needs: [ Initialization ]
|
||||
# if: (!failure()) && (!cancelled()) && fromJson(needs.Initialization.outputs.buildOrderJson)[0].projectsCount > 0
|
||||
$if = "if: (!failure()) && (!cancelled()) && fromJson(needs.Initialization.outputs.buildOrderJson)[$index].projectsCount > 0"
|
||||
}
|
||||
else {
|
||||
# Subsequent build jobs needs to have a dependency on all previous build jobs
|
||||
# Example (depth 2):
|
||||
# needs: [ Initialization, Build1 ]
|
||||
# if: (!failure()) && (!cancelled()) && (needs.Build1.result == 'success' || needs.Build1.result == 'skipped') && fromJson(needs.Initialization.outputs.buildOrderJson)[0].projectsCount > 0
|
||||
# Another example (depth 3):
|
||||
# needs: [ Initialization, Build2, Build1 ]
|
||||
# if: (!failure()) && (!cancelled()) && (needs.Build2.result == 'success' || needs.Build2.result == 'skipped') && (needs.Build1.result == 'success' || needs.Build1.result == 'skipped') && fromJson(needs.Initialization.outputs.buildOrderJson)[0].projectsCount > 0
|
||||
$newBuild += @('')
|
||||
$ifpart = ""
|
||||
($_-1)..1 | ForEach-Object {
|
||||
$needs += @("Build$_")
|
||||
$ifpart += " && (needs.Build$_.result == 'success' || needs.Build$_.result == 'skipped')"
|
||||
}
|
||||
$if = "if: (!failure()) && (!cancelled())$ifpart && fromJson(needs.Initialization.outputs.buildOrderJson)[$index].projectsCount > 0"
|
||||
}
|
||||
|
||||
# Replace the if:, the needs: and the strategy/matrix/project: in the build job with the correct values
|
||||
$build.Replace('if:', $if)
|
||||
$build.Replace('needs:', "needs: [ $($needs -join ', ') ]")
|
||||
$build.Replace('strategy:/matrix:/include:',"include: `${{ fromJson(needs.Initialization.outputs.buildOrderJson)[$index].buildDimensions }}")
|
||||
|
||||
# Last build job is called build, all other build jobs are called build1, build2, etc.
|
||||
if ($depth -eq $_) {
|
||||
$newBuild += @("Build:")
|
||||
}
|
||||
else {
|
||||
$newBuild += @("Build$($_):")
|
||||
}
|
||||
# Add the content of the calculated build job to the new build job list with an indentation of 2 spaces
|
||||
$build.content | ForEach-Object { $newBuild += @(" $_") }
|
||||
}
|
||||
|
||||
# Replace the entire build: job with the new build job list
|
||||
$yaml.Replace('jobs:/Build:', $newBuild)
|
||||
}
|
||||
}
|
||||
}
|
||||
# combine all the yaml file lines into a single string with LF line endings
|
||||
$srcContent = $yaml.content -join "`n"
|
||||
$srcContent = GetWorkflowContentWithChangesFromSettings -srcFile $srcFile -repoSettings $repoSettings -depth $depth
|
||||
}
|
||||
else {
|
||||
# For non-workflow files, just read the file content
|
||||
$srcContent = Get-ContentLF -Path $srcFile
|
||||
}
|
||||
|
||||
$srcContent = $srcContent.Replace('{TEMPLATEURL}', "$($templateUrl)@$($templateBranch)")
|
||||
if ($directALGo) {
|
||||
# If we are using the direct AL-Go repo, we need to change the owner and repo names in the workflow
|
||||
$lines = $srcContent.Split("`n")
|
||||
# Replace static placeholders
|
||||
$srcContent = $srcContent.Replace('{TEMPLATEURL}', $templateUrl)
|
||||
|
||||
# The Original Owner and Repo in the AL-Go repository are microsoft/AL-Go-Actions, microsoft/AL-Go-PTE and microsoft/AL-Go-AppSource
|
||||
$originalOwnerAndRepo = @{
|
||||
"actionsRepo" = "microsoft/AL-Go-Actions"
|
||||
"perTenantExtensionRepo" = "microsoft/AL-Go-PTE"
|
||||
"appSourceAppRepo" = "microsoft/AL-Go-AppSource"
|
||||
}
|
||||
# Original branch is always main
|
||||
$originalBranch = "main"
|
||||
|
||||
# Modify the file to use repository names based on whether or not we are using the direct AL-Go repo
|
||||
$templateRepos = @{
|
||||
"actionsRepo" = "AL-Go/Actions"
|
||||
"perTenantExtensionRepo" = "AL-Go"
|
||||
"appSourceAppRepo" = "AL-Go"
|
||||
}
|
||||
|
||||
# Replace URL's to actions repository first
|
||||
$regex = "^(.*)https:\/\/raw\.githubusercontent\.com\/microsoft\/AL-Go-Actions\/$originalBranch(.*)$"
|
||||
$replace = "`${1}https://raw.githubusercontent.com/$($templateOwner)/AL-Go/$($templateBranch)/Actions`${2}"
|
||||
$lines = $lines | ForEach-Object { $_ -replace $regex, $replace }
|
||||
|
||||
# Replace the owner and repo names in the workflow
|
||||
"actionsRepo","perTenantExtensionRepo","appSourceAppRepo" | ForEach-Object {
|
||||
$regex = "^(.*)$($originalOwnerAndRepo."$_")(.*)$originalBranch(.*)$"
|
||||
$replace = "`${1}$($templateOwner)/$($templateRepos."$_")`${2}$($templateBranch)`${3}"
|
||||
$lines = $lines | ForEach-Object { $_ -replace $regex, $replace }
|
||||
}
|
||||
$srcContent = $lines -join "`n"
|
||||
if ($isDirectALGo) {
|
||||
# If we are using direct AL-Go repo, we need to change the owner to the remplateOwner, the repo names to AL-Go and AL-Go/Actions and the branch to templateBranch
|
||||
ReplaceOwnerRepoAndBranch -srcContent ([ref]$srcContent) -templateOwner $templateOwner -templateBranch $templateBranch
|
||||
}
|
||||
|
||||
$dstFile = Join-Path $dstFolder $fileName
|
||||
$dstFileExists = Test-Path -Path $dstFile -PathType Leaf
|
||||
if ($unusedALGoSystemFiles -contains $fileName) {
|
||||
# file is not used by ALGo, remove it if it exists
|
||||
|
@ -372,171 +170,94 @@ try {
|
|||
# file exists, compare and add to $updateFiles if different
|
||||
$dstContent = Get-ContentLF -Path $dstFile
|
||||
if ($dstContent -cne $srcContent) {
|
||||
Write-Host "Updated $name ($(Join-Path $dstPath $filename)) available"
|
||||
Write-Host "Updated $type ($(Join-Path $dstPath $filename)) available"
|
||||
$updateFiles += @{ "DstFile" = Join-Path $dstPath $filename; "content" = $srcContent }
|
||||
}
|
||||
}
|
||||
else {
|
||||
# new file, add to $updateFiles
|
||||
Write-Host "New $name ($(Join-Path $dstPath $filename)) available"
|
||||
Write-Host "New $type ($(Join-Path $dstPath $filename)) available"
|
||||
$updateFiles += @{ "DstFile" = Join-Path $dstPath $filename; "content" = $srcContent }
|
||||
}
|
||||
}
|
||||
}
|
||||
finally {
|
||||
Pop-Location
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (-not $update) {
|
||||
# $update not set, just issue a warning in the CI/CD workflow that updates are available
|
||||
if (($updateFiles) -or ($removeFiles)) {
|
||||
OutputWarning -message "There are updates for your AL-Go system, run 'Update AL-Go System Files' workflow to download the latest version of AL-Go."
|
||||
AddTelemetryProperty -telemetryScope $telemetryScope -key "updatesExists" -value $true
|
||||
}
|
||||
else {
|
||||
Write-Host "No updates available for AL-Go for GitHub."
|
||||
AddTelemetryProperty -telemetryScope $telemetryScope -key "updatesExists" -value $false
|
||||
}
|
||||
if ($update -ne 'Y') {
|
||||
# $update not set, just issue a warning in the CI/CD workflow that updates are available
|
||||
if (($updateFiles) -or ($removeFiles)) {
|
||||
OutputWarning -message "There are updates for your AL-Go system, run 'Update AL-Go System Files' workflow to download the latest version of AL-Go."
|
||||
}
|
||||
else {
|
||||
# $update set, update the files
|
||||
if ($updateSettings -or ($updateFiles) -or ($removeFiles)) {
|
||||
try {
|
||||
# URL for git commands
|
||||
$tempRepo = Join-Path ([System.IO.Path]::GetTempPath()) ([Guid]::NewGuid().ToString())
|
||||
New-Item $tempRepo -ItemType Directory | Out-Null
|
||||
Set-Location $tempRepo
|
||||
$serverUri = [Uri]::new($env:GITHUB_SERVER_URL)
|
||||
$url = "$($serverUri.Scheme)://$($actor):$($token)@$($serverUri.Host)/$($env:GITHUB_REPOSITORY)"
|
||||
Write-Host "No updates available for AL-Go for GitHub."
|
||||
}
|
||||
}
|
||||
else {
|
||||
# $update set, update the files
|
||||
try {
|
||||
# If $directCommit, then changes are made directly to the default branch
|
||||
$serverUrl, $branch = CloneIntoNewFolder -actor $actor -token $token -updateBranch $updateBranch -DirectCommit $directCommit -newBranchPrefix 'update-al-go-system-files'
|
||||
|
||||
# Environment variables for hub commands
|
||||
$env:GITHUB_USER = $actor
|
||||
$env:GITHUB_TOKEN = $token
|
||||
invoke-git status
|
||||
|
||||
# Configure git
|
||||
invoke-git config --global user.email "$actor@users.noreply.github.com"
|
||||
invoke-git config --global user.name "$actor"
|
||||
invoke-git config --global hub.protocol https
|
||||
invoke-git config --global core.autocrlf false
|
||||
UpdateSettingsFile -settingsFile (Join-Path ".github" "AL-Go-Settings.json") -updateSettings @{ "templateUrl" = $templateUrl; "templateSha" = $templateSha }
|
||||
|
||||
# Clone URL
|
||||
invoke-git clone $url
|
||||
|
||||
# Set current location to the repository folder
|
||||
Set-Location -Path *
|
||||
|
||||
# checkout branch to update
|
||||
invoke-git checkout $updateBranch
|
||||
|
||||
# If $directCommit, then changes are made directly to the default branch
|
||||
if (!$directcommit) {
|
||||
# If not direct commit, create a new branch with name, relevant to the current date and base branch, and switch to it
|
||||
$branch = "update-al-go-system-files/$updateBranch/$((Get-Date).ToUniversalTime().ToString(`"yyMMddHHmmss`"))" # e.g. update-al-go-system-files/main/210101120000
|
||||
invoke-git checkout -b $branch
|
||||
}
|
||||
|
||||
# Show git status
|
||||
invoke-git status
|
||||
|
||||
# Update Repo Settings file with the template URL
|
||||
$templateUrl = "$templateUrl@$templateBranch"
|
||||
$RepoSettingsFile = Join-Path ".github" "AL-Go-Settings.json"
|
||||
if (Test-Path $RepoSettingsFile) {
|
||||
$repoSettings = Get-Content $repoSettingsFile -Encoding UTF8 | ConvertFrom-Json
|
||||
}
|
||||
else {
|
||||
$repoSettings = [PSCustomObject]@{}
|
||||
}
|
||||
if ($repoSettings.PSObject.Properties.Name -eq "templateUrl") {
|
||||
$repoSettings.templateUrl = $templateUrl
|
||||
}
|
||||
else {
|
||||
# Add the property if it doesn't exist
|
||||
$repoSettings | Add-Member -MemberType NoteProperty -Name "templateUrl" -Value $templateUrl
|
||||
}
|
||||
# Save the file with LF line endings and UTF8 encoding
|
||||
$repoSettings | Set-JsonContentLF -path $repoSettingsFile
|
||||
|
||||
# Update the files
|
||||
# Calculate the release notes, while updating
|
||||
$releaseNotes = ""
|
||||
$updateFiles | ForEach-Object {
|
||||
# Create the destination folder if it doesn't exist
|
||||
$path = [System.IO.Path]::GetDirectoryName($_.DstFile)
|
||||
if (-not (Test-Path -path $path -PathType Container)) {
|
||||
New-Item -Path $path -ItemType Directory | Out-Null
|
||||
}
|
||||
if (([System.IO.Path]::GetFileName($_.DstFile) -eq "RELEASENOTES.copy.md") -and (Test-Path $_.DstFile)) {
|
||||
$oldReleaseNotes = Get-ContentLF -Path $_.DstFile
|
||||
while ($oldReleaseNotes) {
|
||||
$releaseNotes = $_.Content
|
||||
if ($releaseNotes.indexOf($oldReleaseNotes) -gt 0) {
|
||||
$releaseNotes = $releaseNotes.SubString(0, $releaseNotes.indexOf($oldReleaseNotes))
|
||||
$oldReleaseNotes = ""
|
||||
}
|
||||
else {
|
||||
$idx = $oldReleaseNotes.IndexOf("`n## ")
|
||||
if ($idx -gt 0) {
|
||||
$oldReleaseNotes = $oldReleaseNotes.Substring($idx)
|
||||
}
|
||||
else {
|
||||
$oldReleaseNotes = ""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Write-Host "Update $($_.DstFile)"
|
||||
$_.Content | Set-ContentLF -Path $_.DstFile
|
||||
}
|
||||
if ($releaseNotes -eq "") {
|
||||
$releaseNotes = "No release notes available!"
|
||||
}
|
||||
$removeFiles | ForEach-Object {
|
||||
Write-Host "Remove $_"
|
||||
Remove-Item (Join-Path (Get-Location).Path $_) -Force
|
||||
}
|
||||
|
||||
# Add changes files to git changeset
|
||||
invoke-git add *
|
||||
|
||||
Write-Host "ReleaseNotes:"
|
||||
Write-Host $releaseNotes
|
||||
|
||||
$status = invoke-git -returnValue status --porcelain=v1
|
||||
if ($status) {
|
||||
$message = "Updated AL-Go System Files"
|
||||
|
||||
invoke-git commit --allow-empty -m "$message"
|
||||
|
||||
if ($directcommit) {
|
||||
invoke-git push $url
|
||||
# Update the files
|
||||
# Calculate the release notes, while updating
|
||||
$releaseNotes = ""
|
||||
$updateFiles | ForEach-Object {
|
||||
# Create the destination folder if it doesn't exist
|
||||
$path = [System.IO.Path]::GetDirectoryName($_.DstFile)
|
||||
if (-not (Test-Path -path $path -PathType Container)) {
|
||||
New-Item -Path $path -ItemType Directory | Out-Null
|
||||
}
|
||||
if (([System.IO.Path]::GetFileName($_.DstFile) -eq "RELEASENOTES.copy.md") -and (Test-Path $_.DstFile)) {
|
||||
$oldReleaseNotes = Get-ContentLF -Path $_.DstFile
|
||||
while ($oldReleaseNotes) {
|
||||
$releaseNotes = $_.Content
|
||||
if ($releaseNotes.indexOf($oldReleaseNotes) -gt 0) {
|
||||
$releaseNotes = $releaseNotes.SubString(0, $releaseNotes.indexOf($oldReleaseNotes))
|
||||
$oldReleaseNotes = ""
|
||||
}
|
||||
else {
|
||||
invoke-git push -u $url $branch
|
||||
invoke-gh pr create --fill --head $branch --base $updateBranch --repo $env:GITHUB_REPOSITORY --body "$releaseNotes"
|
||||
$idx = $oldReleaseNotes.IndexOf("`n## ")
|
||||
if ($idx -gt 0) {
|
||||
$oldReleaseNotes = $oldReleaseNotes.Substring($idx)
|
||||
}
|
||||
else {
|
||||
$oldReleaseNotes = ""
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
Write-Host "No changes detected in files"
|
||||
}
|
||||
}
|
||||
catch {
|
||||
if ($directCommit) {
|
||||
throw "Failed to update AL-Go System Files. Make sure that the personal access token, defined in the secret called GhTokenWorkflow, is not expired and it has permission to update workflows. (Error was $($_.Exception.Message))"
|
||||
}
|
||||
else {
|
||||
throw "Failed to create a pull-request to AL-Go System Files. Make sure that the personal access token, defined in the secret called GhTokenWorkflow, is not expired and it has permission to update workflows. (Error was $($_.Exception.Message))"
|
||||
}
|
||||
}
|
||||
Write-Host "Update $($_.DstFile)"
|
||||
$_.Content | Set-ContentLF -Path $_.DstFile
|
||||
}
|
||||
else {
|
||||
if ($releaseNotes -eq "") {
|
||||
$releaseNotes = "No release notes available!"
|
||||
}
|
||||
$removeFiles | ForEach-Object {
|
||||
Write-Host "Remove $_"
|
||||
Remove-Item (Join-Path (Get-Location).Path $_) -Force
|
||||
}
|
||||
|
||||
Write-Host "ReleaseNotes:"
|
||||
Write-Host $releaseNotes
|
||||
|
||||
if (!(CommitFromNewFolder -serverUrl $serverUrl -commitMessage "Update AL-Go System Files" -branch $branch)) {
|
||||
OutputWarning "No updates available for AL-Go for GitHub."
|
||||
}
|
||||
}
|
||||
|
||||
TrackTrace -telemetryScope $telemetryScope
|
||||
}
|
||||
catch {
|
||||
if (Get-Module BcContainerHelper) {
|
||||
TrackException -telemetryScope $telemetryScope -errorRecord $_
|
||||
catch {
|
||||
if ($directCommit) {
|
||||
throw "Failed to update AL-Go System Files. Make sure that the personal access token, defined in the secret called GhTokenWorkflow, is not expired and it has permission to update workflows. (Error was $($_.Exception.Message))"
|
||||
}
|
||||
else {
|
||||
throw "Failed to create a pull-request to AL-Go System Files. Make sure that the personal access token, defined in the secret called GhTokenWorkflow, is not expired and it has permission to update workflows. (Error was $($_.Exception.Message))"
|
||||
}
|
||||
}
|
||||
throw
|
||||
}
|
||||
|
|
|
@ -12,11 +12,11 @@ none
|
|||
| shell | | The shell (powershell or pwsh) in which the PowerShell script in this action should run | powershell |
|
||||
| actor | | The GitHub actor running the action | github.actor |
|
||||
| token | | The GitHub token running the action | github.token |
|
||||
| parentTelemetryScopeJson | | Specifies the parent telemetry scope for the telemetry signal | {} |
|
||||
| templateBranch | | Branch in template repository to use for the update | default branch |
|
||||
| templateUrl | | URL of the template repository (default is the template repository used to create the repository) | default |
|
||||
| downloadLatest | Yes | Set this input to true in order to download latest version of the template repository (else it will reuse the SHA from last update) | |
|
||||
| update | | Set this input to Y in order to update AL-Go System Files if needed | N |
|
||||
| updateBranch | | Set the branch to update. In case `directCommit` parameter is set to 'Y', then the branch the action is run on will be updated | github.ref_name |
|
||||
| directCommit | | Y if the action should create a direct commit against the branch or N to create a Pull Request | N |
|
||||
| updateBranch | | Set the branch to update. In case `directCommit` parameter is set to true, then the branch the action is run on will be updated | github.ref_name |
|
||||
| directCommit | | True if the action should create a direct commit against the branch or false to create a Pull Request | false |
|
||||
|
||||
## OUTPUT
|
||||
none
|
|
@ -17,18 +17,13 @@ inputs:
|
|||
description: The GitHub token running the action
|
||||
required: false
|
||||
default: ${{ github.token }}
|
||||
parentTelemetryScopeJson:
|
||||
description: Specifies the parent telemetry scope for the telemetry signal
|
||||
required: false
|
||||
default: '7b7d'
|
||||
templateUrl:
|
||||
description: URL of the template repository (default is the template repository used to create the repository)
|
||||
required: false
|
||||
default: ''
|
||||
templateBranch:
|
||||
description: Branch in template repository to use for the update (default is the default branch)
|
||||
required: false
|
||||
default: ''
|
||||
downloadLatest:
|
||||
description: Set this input to true in order to download latest version of the template repository (else it will reuse the SHA from last update)
|
||||
required: true
|
||||
update:
|
||||
description: Set this input to Y in order to update AL-Go System Files if needed
|
||||
required: false
|
||||
|
@ -38,9 +33,9 @@ inputs:
|
|||
required: false
|
||||
default: ${{ github.ref_name }}
|
||||
directCommit:
|
||||
description: Direct Commit (Y/N)
|
||||
description: Direct Commit?
|
||||
required: false
|
||||
default: 'N'
|
||||
default: 'false'
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
|
@ -49,16 +44,15 @@ runs:
|
|||
env:
|
||||
_actor: ${{ inputs.actor }}
|
||||
_token: ${{ inputs.token }}
|
||||
_parentTelemetryScopeJson: ${{ inputs.parentTelemetryScopeJson }}
|
||||
_templateUrl: ${{ inputs.templateUrl }}
|
||||
_templateBranch: ${{ inputs.templateBranch }}
|
||||
_downloadLatest: ${{ inputs.downloadLatest }}
|
||||
_update: ${{ inputs.update }}
|
||||
_updateBranch: ${{ inputs.updateBranch }}
|
||||
_directCommit: ${{ inputs.directCommit }}
|
||||
run: |
|
||||
$errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0
|
||||
try {
|
||||
${{ github.action_path }}/CheckForUpdates.ps1 -actor $ENV:_actor -token $ENV:_token -parentTelemetryScopeJson $ENV:_parentTelemetryScopeJson -templateUrl $ENV:_templateUrl -templateBranch $ENV:_templateBranch -update ($ENV:_update -eq 'Y') -updateBranch $ENV:_updateBranch -directCommit ($ENV:_directCommit -eq 'Y')
|
||||
${{ github.action_path }}/CheckForUpdates.ps1 -actor $ENV:_actor -token $ENV:_token -templateUrl $ENV:_templateUrl -downloadLatest ($ENV:_downloadLatest -eq 'true') -update $ENV:_update -updateBranch $ENV:_updateBranch -directCommit ($ENV:_directCommit -eq 'true')
|
||||
}
|
||||
catch {
|
||||
Write-Host "::ERROR::Unexpected error when running action. Error Message: $($_.Exception.Message.Replace("`r",'').Replace("`n",' ')), StackTrace: $($_.ScriptStackTrace.Replace("`r",'').Replace("`n",' <- '))";
|
||||
|
|
|
@ -1,163 +1,185 @@
|
|||
#requires -Version 5.0
|
||||
|
||||
# This class holds the content of a Yaml file
|
||||
# The content is stored in an array of strings, where each string is a line of the Yaml file
|
||||
# The class provides methods to find and replace lines in the Yaml file
|
||||
class Yaml {
|
||||
|
||||
[string[]] $content
|
||||
|
||||
# Constructor based on an array of strings
|
||||
Yaml([string[]] $content) {
|
||||
$this.content = $content
|
||||
}
|
||||
|
||||
# Static load function to load a Yaml file into a Yaml class
|
||||
static [Yaml] Load([string] $filename) {
|
||||
$fileContent = Get-Content -Path $filename -Encoding UTF8
|
||||
return [Yaml]::new($fileContent)
|
||||
}
|
||||
|
||||
# Save the Yaml file with LF line endings using UTF8 encoding
|
||||
Save([string] $filename) {
|
||||
$this.content | Set-ContentLF -Path $filename
|
||||
}
|
||||
|
||||
# Find the lines for the specified Yaml path, given by $line
|
||||
# If $line contains multiple segments separated by '/', then the segments are searched for recursively
|
||||
# The Yaml path is case insensitive
|
||||
# The Search mechanism finds only lines with the right indentation. When searching for a specific job, use jobs:/(job name)/
|
||||
# $start and $count are set to the start and count of the lines found
|
||||
# Returns $true if the line are found, otherwise $false
|
||||
# If $line ends with '/', then the lines for the section are returned only
|
||||
# If $line doesn't end with '/', then the line + the lines for the section are returned (and the lines for the section are indented)
|
||||
[bool] Find([string] $line, [ref] $start, [ref] $count) {
|
||||
if ($line.Contains('/')) {
|
||||
$idx = $line.IndexOf('/')
|
||||
$find = $line.Split('/')[0]
|
||||
$rest = $line.Substring($idx+1)
|
||||
$s1 = 0
|
||||
$c1 = 0
|
||||
if ($rest -eq '') {
|
||||
[Yaml] $yaml = $this.Get($find, [ref] $s1, [ref] $c1)
|
||||
if ($yaml) {
|
||||
$start.value = $s1+1
|
||||
$count.value = $c1-1
|
||||
return $true
|
||||
}
|
||||
}
|
||||
else {
|
||||
[Yaml] $yaml = $this.Get("$find/", [ref] $s1, [ref] $c1)
|
||||
if ($yaml) {
|
||||
$s2 = 0
|
||||
$c2 = 0
|
||||
if ($yaml.Find($rest, [ref] $s2, [ref] $c2)) {
|
||||
$start.value = $s1+$s2
|
||||
$count.value = $c2
|
||||
return $true
|
||||
}
|
||||
}
|
||||
}
|
||||
return $false
|
||||
}
|
||||
else {
|
||||
$start.value = -1
|
||||
$count.value = 0
|
||||
for($i=0; $i -lt $this.content.Count; $i++) {
|
||||
$s = "$($this.content[$i]) "
|
||||
if ($s -like "$($line)*") {
|
||||
if ($s.TrimEnd() -eq $line) {
|
||||
$start.value = $i
|
||||
}
|
||||
else {
|
||||
$start.value = $i
|
||||
$count.value = 1
|
||||
return $true
|
||||
}
|
||||
}
|
||||
elseif ($start.value -ne -1 -and $s -notlike " *") {
|
||||
if ($this.content[$i-1].Trim() -eq '') {
|
||||
$count.value = ($i-$start.value-1)
|
||||
}
|
||||
else {
|
||||
$count.value = ($i-$start.value)
|
||||
}
|
||||
return $true
|
||||
}
|
||||
}
|
||||
if ($start.value -ne -1) {
|
||||
$count.value = $this.content.Count-$start.value
|
||||
return $true
|
||||
}
|
||||
else {
|
||||
return $false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Locate the lines for the specified Yaml path, given by $line and return lines as a Yaml object
|
||||
# $start and $count are set to the start and count of the lines found
|
||||
# Indentation of the first line returned is 0
|
||||
# Indentation of the other lines returned is the original indentation - the original indentation of the first line
|
||||
# Returns $null if the lines are not found
|
||||
# See Find for more details
|
||||
[Yaml] Get([string] $line, [ref] $start, [ref] $count) {
|
||||
$s = 0
|
||||
$c = 0
|
||||
if ($this.Find($line, [ref] $s, [ref] $c)) {
|
||||
$charCount = ($line.ToCharArray() | Where-Object {$_ -eq '/'} | Measure-Object).Count
|
||||
[string[]] $result = @($this.content | Select-Object -Skip $s -First $c | ForEach-Object {
|
||||
"$_$(" "*$charCount)".Substring(2*$charCount).TrimEnd()
|
||||
} )
|
||||
$start.value = $s
|
||||
$count.value = $c
|
||||
return [Yaml]::new($result)
|
||||
}
|
||||
else {
|
||||
return $null
|
||||
}
|
||||
}
|
||||
|
||||
# Locate the lines for the specified Yaml path, given by $line and return lines as a Yaml object
|
||||
# Same function as Get, but $start and $count are not set
|
||||
[Yaml] Get([string] $line) {
|
||||
[int]$start = 0
|
||||
[int]$count = 0
|
||||
return $this.Get($line, [ref] $start, [ref] $count)
|
||||
}
|
||||
|
||||
# Replace the lines for the specified Yaml path, given by $line with the lines in $content
|
||||
# If $line ends with '/', then the lines for the section are replaced only
|
||||
# If $line doesn't end with '/', then the line + the lines for the section are replaced
|
||||
# See Find for more details
|
||||
[void] Replace([string] $line, [string[]] $content) {
|
||||
[int]$start = 0
|
||||
[int]$count = 0
|
||||
if ($this.Find($line, [ref] $start, [ref] $count)) {
|
||||
$charCount = ($line.ToCharArray() | Where-Object {$_ -eq '/'} | Measure-Object).Count
|
||||
if ($charCount) {
|
||||
$yamlContent = $content | ForEach-Object { "$(" "*$charCount)$_".TrimEnd() }
|
||||
}
|
||||
else {
|
||||
$yamlContent = $content
|
||||
}
|
||||
if ($start -eq 0) {
|
||||
$this.content = $yamlContent+$this.content[($start+$count)..($this.content.Count-1)]
|
||||
}
|
||||
elseif ($start+$count -eq $this.content.Count) {
|
||||
$this.content = $this.content[0..($start-1)]+$yamlContent
|
||||
}
|
||||
else {
|
||||
$this.content = $this.content[0..($start-1)]+$yamlContent+$this.content[($start+$count)..($this.content.Count-1)]
|
||||
}
|
||||
}
|
||||
else {
|
||||
Write-Host -ForegroundColor Red "cannot locate $line"
|
||||
}
|
||||
}
|
||||
|
||||
# Replace all occurrences of $from with $to throughout the Yaml content
|
||||
[void] ReplaceAll([string] $from, [string] $to) {
|
||||
$this.content = $this.content | ForEach-Object { $_.replace($from, $to) }
|
||||
}
|
||||
}
|
||||
#requires -Version 5.0
|
||||
|
||||
# This class holds the content of a Yaml file
|
||||
# The content is stored in an array of strings, where each string is a line of the Yaml file
|
||||
# The class provides methods to find and replace lines in the Yaml file
|
||||
class Yaml {
|
||||
|
||||
[string[]] $content
|
||||
|
||||
# Constructor based on an array of strings
|
||||
Yaml([string[]] $content) {
|
||||
$this.content = $content
|
||||
}
|
||||
|
||||
# Static load function to load a Yaml file into a Yaml class
|
||||
static [Yaml] Load([string] $filename) {
|
||||
$fileContent = Get-Content -Path $filename -Encoding UTF8
|
||||
return [Yaml]::new($fileContent)
|
||||
}
|
||||
|
||||
# Save the Yaml file with LF line endings using UTF8 encoding
|
||||
Save([string] $filename) {
|
||||
$this.content | Set-ContentLF -Path $filename
|
||||
}
|
||||
|
||||
# Find the lines for the specified Yaml path, given by $line
|
||||
# If $line contains multiple segments separated by '/', then the segments are searched for recursively
|
||||
# The Yaml path is case insensitive
|
||||
# The Search mechanism finds only lines with the right indentation. When searching for a specific job, use jobs:/(job name)/
|
||||
# $start and $count are set to the start and count of the lines found
|
||||
# Returns $true if the line are found, otherwise $false
|
||||
# If $line ends with '/', then the lines for the section are returned only
|
||||
# If $line doesn't end with '/', then the line + the lines for the section are returned (and the lines for the section are indented)
|
||||
[bool] Find([string] $line, [ref] $start, [ref] $count) {
|
||||
if ($line.Contains('/')) {
|
||||
$idx = $line.IndexOf('/')
|
||||
$find = $line.Split('/')[0]
|
||||
$rest = $line.Substring($idx+1)
|
||||
$s1 = 0
|
||||
$c1 = 0
|
||||
if ($rest -eq '') {
|
||||
[Yaml] $yaml = $this.Get($find, [ref] $s1, [ref] $c1)
|
||||
if ($yaml) {
|
||||
$start.value = $s1+1
|
||||
$count.value = $c1-1
|
||||
return $true
|
||||
}
|
||||
}
|
||||
else {
|
||||
[Yaml] $yaml = $this.Get("$find/", [ref] $s1, [ref] $c1)
|
||||
if ($yaml) {
|
||||
$s2 = 0
|
||||
$c2 = 0
|
||||
if ($yaml.Find($rest, [ref] $s2, [ref] $c2)) {
|
||||
$start.value = $s1+$s2
|
||||
$count.value = $c2
|
||||
return $true
|
||||
}
|
||||
}
|
||||
}
|
||||
return $false
|
||||
}
|
||||
else {
|
||||
$start.value = -1
|
||||
$count.value = 0
|
||||
for($i=0; $i -lt $this.content.Count; $i++) {
|
||||
$s = "$($this.content[$i]) "
|
||||
if ($s -like "$($line)*") {
|
||||
if ($s.TrimEnd() -eq $line) {
|
||||
$start.value = $i
|
||||
}
|
||||
else {
|
||||
$start.value = $i
|
||||
$count.value = 1
|
||||
return $true
|
||||
}
|
||||
}
|
||||
elseif ($start.value -ne -1 -and $s -notlike " *") {
|
||||
if ($this.content[$i-1].Trim() -eq '') {
|
||||
$count.value = ($i-$start.value-1)
|
||||
}
|
||||
else {
|
||||
$count.value = ($i-$start.value)
|
||||
}
|
||||
return $true
|
||||
}
|
||||
}
|
||||
if ($start.value -ne -1) {
|
||||
$count.value = $this.content.Count-$start.value
|
||||
return $true
|
||||
}
|
||||
else {
|
||||
return $false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Locate the lines for the specified Yaml path, given by $line and return lines as a Yaml object
|
||||
# $start and $count are set to the start and count of the lines found
|
||||
# Indentation of the first line returned is 0
|
||||
# Indentation of the other lines returned is the original indentation - the original indentation of the first line
|
||||
# Returns $null if the lines are not found
|
||||
# See Find for more details
|
||||
[Yaml] Get([string] $line, [ref] $start, [ref] $count) {
|
||||
$s = 0
|
||||
$c = 0
|
||||
if ($this.Find($line, [ref] $s, [ref] $c)) {
|
||||
$charCount = ($line.ToCharArray() | Where-Object {$_ -eq '/'} | Measure-Object).Count
|
||||
[string[]] $result = @($this.content | Select-Object -Skip $s -First $c | ForEach-Object {
|
||||
"$_$(" "*$charCount)".Substring(2*$charCount).TrimEnd()
|
||||
} )
|
||||
$start.value = $s
|
||||
$count.value = $c
|
||||
return [Yaml]::new($result)
|
||||
}
|
||||
else {
|
||||
return $null
|
||||
}
|
||||
}
|
||||
|
||||
# Locate the lines for the specified Yaml path, given by $line and return lines as a Yaml object
|
||||
# Same function as Get, but $start and $count are not set
|
||||
[Yaml] Get([string] $line) {
|
||||
[int]$start = 0
|
||||
[int]$count = 0
|
||||
return $this.Get($line, [ref] $start, [ref] $count)
|
||||
}
|
||||
|
||||
# Replace the lines for the specified Yaml path, given by $line with the lines in $content
|
||||
# If $line ends with '/', then the lines for the section are replaced only
|
||||
# If $line doesn't end with '/', then the line + the lines for the section are replaced
|
||||
# See Find for more details
|
||||
[void] Replace([string] $line, [string[]] $content) {
|
||||
[int]$start = 0
|
||||
[int]$count = 0
|
||||
if ($this.Find($line, [ref] $start, [ref] $count)) {
|
||||
$charCount = ($line.ToCharArray() | Where-Object {$_ -eq '/'} | Measure-Object).Count
|
||||
if ($charCount) {
|
||||
$yamlContent = $content | ForEach-Object { "$(" "*$charCount)$_".TrimEnd() }
|
||||
}
|
||||
else {
|
||||
$yamlContent = $content
|
||||
}
|
||||
$this.Remove($start, $count)
|
||||
$this.Insert($start, $yamlContent)
|
||||
}
|
||||
else {
|
||||
Write-Host -ForegroundColor Red "cannot locate $line"
|
||||
}
|
||||
}
|
||||
|
||||
# Replace all occurrences of $from with $to throughout the Yaml content
|
||||
[void] ReplaceAll([string] $from, [string] $to) {
|
||||
$this.content = $this.content | ForEach-Object { $_.replace($from, $to) }
|
||||
}
|
||||
|
||||
# Remove lines in Yaml content
|
||||
[void] Remove([int] $start, [int] $count) {
|
||||
if ($count -eq 0) {
|
||||
return
|
||||
}
|
||||
if ($start -eq 0) {
|
||||
$this.content = $this.content[$count..($this.content.Count-1)]
|
||||
}
|
||||
else {
|
||||
$this.content = $this.content[0..($start-1)] + $this.content[($start+$count)..($this.content.Count-1)]
|
||||
}
|
||||
}
|
||||
|
||||
# Insert lines in Yaml content
|
||||
[void] Insert([int] $index, [string[]] $yamlContent) {
|
||||
if (!$yamlContent) {
|
||||
return
|
||||
}
|
||||
if ($index -eq 0) {
|
||||
$this.content = $yamlContent + $this.content
|
||||
}
|
||||
elseif ($index -eq $this.content.Count) {
|
||||
$this.content = $this.content + $yamlContent
|
||||
}
|
||||
else {
|
||||
$this.content = $this.content[0..($index-1)] + $yamlContent + $this.content[$index..($this.content.Count-1)]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,13 +16,13 @@
|
|||
[string] $publisher,
|
||||
[Parameter(HelpMessage = "ID range", Mandatory = $true)]
|
||||
[string] $idrange,
|
||||
[Parameter(HelpMessage = "Include Sample Code (Y/N)", Mandatory = $false)]
|
||||
[Parameter(HelpMessage = "Include Sample Code?", Mandatory = $false)]
|
||||
[bool] $sampleCode,
|
||||
[Parameter(HelpMessage = "Include Sample BCPT Suite (Y/N)", Mandatory = $false)]
|
||||
[Parameter(HelpMessage = "Include Sample BCPT Suite?", Mandatory = $false)]
|
||||
[bool] $sampleSuite,
|
||||
[Parameter(HelpMessage = "Set the branch to update", Mandatory = $false)]
|
||||
[string] $updateBranch,
|
||||
[Parameter(HelpMessage = "Direct Commit (Y/N)", Mandatory = $false)]
|
||||
[Parameter(HelpMessage = "Direct Commit?", Mandatory = $false)]
|
||||
[bool] $directCommit
|
||||
)
|
||||
|
||||
|
@ -31,12 +31,7 @@ $tmpFolder = Join-Path ([System.IO.Path]::GetTempPath()) ([Guid]::NewGuid().ToSt
|
|||
|
||||
try {
|
||||
. (Join-Path -Path $PSScriptRoot -ChildPath "..\AL-Go-Helper.ps1" -Resolve)
|
||||
$branch = ''
|
||||
if (!$directcommit) {
|
||||
# If not direct commit, create a new branch with name, relevant to the current date and base branch, and switch to it
|
||||
$branch = "create-$($type.replace(' ','-').ToLowerInvariant())/$updateBranch/$((Get-Date).ToUniversalTime().ToString(`"yyMMddHHmmss`"))" # e.g. create-pte/main/210101120000
|
||||
}
|
||||
$serverUrl = CloneIntoNewFolder -actor $actor -token $token -branch $branch
|
||||
$serverUrl, $branch = CloneIntoNewFolder -actor $actor -token $token -updateBranch $updateBranch -DirectCommit $directCommit -newBranchPrefix "create-$($type.replace(' ','-').ToLowerInvariant())"
|
||||
$baseFolder = (Get-Location).Path
|
||||
DownloadAndImportBcContainerHelper -baseFolder $baseFolder
|
||||
|
||||
|
@ -134,7 +129,7 @@ try {
|
|||
UpdateWorkspaces -projectFolder $projectFolder -appName $folderName
|
||||
|
||||
Set-Location $baseFolder
|
||||
CommitFromNewFolder -serverUrl $serverUrl -commitMessage "New $type ($Name)" -branch $branch
|
||||
CommitFromNewFolder -serverUrl $serverUrl -commitMessage "New $type ($Name)" -branch $branch | Out-Null
|
||||
|
||||
TrackTrace -telemetryScope $telemetryScope
|
||||
|
||||
|
|
|
@ -18,10 +18,10 @@ none
|
|||
| name | Yes | App Name | |
|
||||
| publisher | Yes | Publisher | |
|
||||
| idrange | Yes | ID range | |
|
||||
| sampleCode | | Include Sample Code (Y/N) | N |
|
||||
| sampleSuite | | Include Sample BCPT Suite (Y/N) | N |
|
||||
| sampleCode | | Include Sample Code? | false |
|
||||
| sampleSuite | | Include Sample BCPT Suite? | false |
|
||||
| updateBranch | | Which branch should the app be added to | github.ref_name |
|
||||
| directCommit | | Y if the action should create a direct commit against the branch or N to create a Pull Request | N |
|
||||
| directCommit | | true if the action should create a direct commit against the branch or false to create a Pull Request | false |
|
||||
|
||||
## OUTPUT
|
||||
none
|
||||
|
|
|
@ -37,21 +37,21 @@ inputs:
|
|||
description: ID range
|
||||
required: true
|
||||
sampleCode:
|
||||
description: Include Sample Code (Y/N)
|
||||
description: Include Sample Code?
|
||||
required: false
|
||||
default: 'N'
|
||||
default: 'false'
|
||||
sampleSuite:
|
||||
description: Include Sample BCPT Suite (Y/N)
|
||||
description: Include Sample BCPT Suite?
|
||||
required: false
|
||||
default: 'N'
|
||||
default: 'false'
|
||||
updateBranch:
|
||||
description: Set the branch to update
|
||||
required: false
|
||||
default: ${{ github.ref_name }}
|
||||
directCommit:
|
||||
description: Direct Commit (Y/N)
|
||||
description: Direct Commit?
|
||||
required: false
|
||||
default: 'N'
|
||||
default: 'false'
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
|
@ -73,7 +73,7 @@ runs:
|
|||
run: |
|
||||
$errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0
|
||||
try {
|
||||
${{ github.action_path }}/CreateApp.ps1 -actor $ENV:_actor -token $ENV:_token -parentTelemetryScopeJson $ENV:_parentTelemetryScopeJson -project $ENV:_project -type $ENV:_type -name $ENV:_name -publisher $ENV:_publisher -idrange $ENV:_idrange -sampleCode ($ENV:_sampleCode -eq 'Y') -sampleSuite ($ENV:_sampleSuite -eq 'Y') -updateBranch $ENV:_updateBranch -directCommit ($ENV:_directCommit -eq 'Y')
|
||||
${{ github.action_path }}/CreateApp.ps1 -actor $ENV:_actor -token $ENV:_token -parentTelemetryScopeJson $ENV:_parentTelemetryScopeJson -project $ENV:_project -type $ENV:_type -name $ENV:_name -publisher $ENV:_publisher -idrange $ENV:_idrange -sampleCode ($ENV:_sampleCode -eq 'true') -sampleSuite ($ENV:_sampleSuite -eq 'true') -updateBranch $ENV:_updateBranch -directCommit ($ENV:_directCommit -eq 'true')
|
||||
}
|
||||
catch {
|
||||
Write-Host "::ERROR::Unexpected error when running action. Error Message: $($_.Exception.Message.Replace("`r",'').Replace("`n",' ')), StackTrace: $($_.ScriptStackTrace.Replace("`r",'').Replace("`n",' <- '))";
|
||||
|
|
|
@ -12,11 +12,11 @@ Param(
|
|||
[string] $project = '.',
|
||||
[Parameter(HelpMessage = "Admin center API credentials", Mandatory = $false)]
|
||||
[string] $adminCenterApiCredentials,
|
||||
[Parameter(HelpMessage = "Reuse environment if it exists", Mandatory = $false)]
|
||||
[Parameter(HelpMessage = "Reuse environment if it exists?", Mandatory = $false)]
|
||||
[bool] $reUseExistingEnvironment,
|
||||
[Parameter(HelpMessage = "Set the branch to update", Mandatory = $false)]
|
||||
[string] $updateBranch,
|
||||
[Parameter(HelpMessage = "Direct Commit (Y/N)", Mandatory = $false)]
|
||||
[Parameter(HelpMessage = "Direct Commit?", Mandatory = $false)]
|
||||
[bool] $directCommit
|
||||
)
|
||||
|
||||
|
@ -24,12 +24,7 @@ $telemetryScope = $null
|
|||
|
||||
try {
|
||||
. (Join-Path -Path $PSScriptRoot -ChildPath "..\AL-Go-Helper.ps1" -Resolve)
|
||||
$branch = ''
|
||||
if (!$directcommit) {
|
||||
# If not direct commit, create a new branch with name, relevant to the current date and base branch, and switch to it
|
||||
$branch = "create-development-environment/$updateBranch/$((Get-Date).ToUniversalTime().ToString(`"yyMMddHHmmss`"))" # e.g. create-development-environment/main/210101120000
|
||||
}
|
||||
$serverUrl = CloneIntoNewFolder -actor $actor -token $token -branch $branch
|
||||
$serverUrl, $branch = CloneIntoNewFolder -actor $actor -token $token -updateBranch $updateBranch -DirectCommit $directCommit -newBranchPrefix 'create-development-environment'
|
||||
$baseFolder = (Get-Location).Path
|
||||
DownloadAndImportBcContainerHelper -baseFolder $baseFolder
|
||||
|
||||
|
@ -46,7 +41,7 @@ try {
|
|||
-project $project `
|
||||
-adminCenterApiCredentials ($adminCenterApiCredentials | ConvertFrom-Json | ConvertTo-HashTable)
|
||||
|
||||
CommitFromNewFolder -serverUrl $serverUrl -commitMessage "Create a development environment $environmentName" -branch $branch
|
||||
CommitFromNewFolder -serverUrl $serverUrl -commitMessage "Create a development environment $environmentName" -branch $branch | Out-Null
|
||||
|
||||
TrackTrace -telemetryScope $telemetryScope
|
||||
}
|
||||
|
|
|
@ -16,9 +16,9 @@ none
|
|||
| environmentName | Yes | Name of the online environment to create |
|
||||
| project | | Project name if the repository is setup for multiple projects | . |
|
||||
| adminCenterApiCredentials | | ClientId/ClientSecret or Refresh token for Admin Center API authentication | |
|
||||
| reUseExistingEnvironment | | Reuse existing environment if it exists | N |
|
||||
| reUseExistingEnvironment | | Reuse existing environment if it exists? | false |
|
||||
| updateBranch | | Which branch should the app be added to | github.ref_name |
|
||||
| directCommit | | Y if the action should create a direct commit against the branch or N to create a Pull Request | N |
|
||||
| directCommit | | true if the action should create a direct commit against the branch or false to create a Pull Request | false |
|
||||
|
||||
## OUTPUT
|
||||
none
|
|
@ -32,17 +32,17 @@ inputs:
|
|||
required: false
|
||||
default: ''
|
||||
reUseExistingEnvironment:
|
||||
description: Reuse environment if it exists
|
||||
description: Reuse environment if it exists?
|
||||
required: false
|
||||
default: 'N'
|
||||
default: 'false'
|
||||
updateBranch:
|
||||
description: Set the branch to update
|
||||
required: false
|
||||
default: ${{ github.ref_name }}
|
||||
directCommit:
|
||||
description: Direct Commit (Y/N)
|
||||
description: Direct Commit?
|
||||
required: false
|
||||
default: 'N'
|
||||
default: 'false'
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
|
@ -61,7 +61,7 @@ runs:
|
|||
run: |
|
||||
$errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0
|
||||
try {
|
||||
${{ github.action_path }}/CreateDevelopmentEnvironment.ps1 -actor $ENV:_actor -token $ENV:_token -parentTelemetryScopeJson $ENV:_parentTelemetryScopeJson -environmentName $ENV:_environmentName -project $ENV:_project -adminCenterApiCredentials $ENV:_adminCenterApiCredentials -reUseExistingEnvironment ($ENV:_reUseExistingEnvironment -eq 'Y') -updateBranch $ENV:_updateBranch -directCommit ($ENV:_directCommit -eq 'Y')
|
||||
${{ github.action_path }}/CreateDevelopmentEnvironment.ps1 -actor $ENV:_actor -token $ENV:_token -parentTelemetryScopeJson $ENV:_parentTelemetryScopeJson -environmentName $ENV:_environmentName -project $ENV:_project -adminCenterApiCredentials $ENV:_adminCenterApiCredentials -reUseExistingEnvironment ($ENV:_reUseExistingEnvironment -eq 'true') -updateBranch $ENV:_updateBranch -directCommit ($ENV:_directCommit -eq 'true')
|
||||
}
|
||||
catch {
|
||||
Write-Host "::ERROR::Unexpected error when running action. Error Message: $($_.Exception.Message.Replace("`r",'').Replace("`n",' ')), StackTrace: $($_.ScriptStackTrace.Replace("`r",'').Replace("`n",' <- '))";
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
[string] $type = "CD",
|
||||
[Parameter(HelpMessage = "Types of artifacts to deliver (Apps,Dependencies,TestApps)", Mandatory = $false)]
|
||||
[string] $atypes = "Apps,Dependencies,TestApps",
|
||||
[Parameter(HelpMessage = "Promote AppSource App to Go Live? (Y/N)", Mandatory = $false)]
|
||||
[Parameter(HelpMessage = "Promote AppSource App to Go Live?", Mandatory = $false)]
|
||||
[bool] $goLive
|
||||
)
|
||||
|
||||
|
@ -54,30 +54,11 @@ try {
|
|||
|
||||
$refname = "$ENV:GITHUB_REF_NAME".Replace('/','_')
|
||||
|
||||
if ($projects -eq '') { $projects = "*" }
|
||||
if ($projects.StartsWith('[')) {
|
||||
$projects = ($projects | ConvertFrom-Json) -join ","
|
||||
}
|
||||
|
||||
$artifacts = $artifacts.Replace('/',([System.IO.Path]::DirectorySeparatorChar)).Replace('\',([System.IO.Path]::DirectorySeparatorChar))
|
||||
|
||||
$baseFolder = $ENV:GITHUB_WORKSPACE
|
||||
$settings = ReadSettings -baseFolder $baseFolder
|
||||
if ($settings.projects) {
|
||||
$projectList = $settings.projects | Where-Object { $_ -like $projects }
|
||||
}
|
||||
else {
|
||||
$projectList = @(Get-ChildItem -Path $baseFolder -Recurse -Depth 2 | Where-Object { $_.PSIsContainer -and (Test-Path (Join-Path $_.FullName ".AL-Go/settings.json") -PathType Leaf) } | ForEach-Object { $_.FullName.Substring($baseFolder.length+1) })
|
||||
if (Test-Path (Join-Path $baseFolder ".AL-Go") -PathType Container) {
|
||||
$projectList += @(".")
|
||||
}
|
||||
}
|
||||
$projectArr = $projects.Split(',')
|
||||
$projectList = @($projectList | Where-Object { $project = $_; if ($projectArr | Where-Object { $project -like $_ }) { $project } })
|
||||
|
||||
if ($projectList.Count -eq 0) {
|
||||
throw "No projects matches the pattern '$projects'"
|
||||
}
|
||||
$projectList = @(GetProjectsFromRepository -baseFolder $baseFolder -projectsFromSettings $settings.projects -selectProjects $projects)
|
||||
if ($deliveryTarget -eq "AppSource") {
|
||||
$atypes = "Apps,Dependencies"
|
||||
}
|
||||
|
|
|
@ -16,12 +16,12 @@ Deliver App to deliveryTarget (AppSource, Storage, or...)
|
|||
| actor | | The GitHub actor running the action | github.actor |
|
||||
| token | | The GitHub token running the action | github.token |
|
||||
| parentTelemetryScopeJson | | Specifies the parent telemetry scope for the telemetry signal | {} |
|
||||
| projects | | Comma separated list of projects to deliver | * |
|
||||
| projects | | Comma-separated list of projects to deliver | * |
|
||||
| deliveryTarget | Yes | Delivery target (AppSource, Storage, GitHubPackages,...) | |
|
||||
| artifacts | Yes | The artifacts to deliver | |
|
||||
| type | | Type of delivery (CD or Release) | CD |
|
||||
| atypes | | Artifact types to deliver | Apps,Dependencies,TestApps |
|
||||
| goLive | | Only relevant for AppSource delivery type. Promote AppSource App to Go Live? | N |
|
||||
| goLive | | Only relevant for AppSource delivery type. Promote AppSource App to Go Live? | false |
|
||||
|
||||
## OUTPUT
|
||||
none
|
||||
|
|
|
@ -36,9 +36,9 @@ inputs:
|
|||
required: false
|
||||
default: 'Apps,Dependencies,TestApps'
|
||||
goLive:
|
||||
description: Promote AppSource App to Go Live? (Y/N)
|
||||
description: Promote AppSource App to Go Live?
|
||||
required: false
|
||||
default: 'N'
|
||||
default: 'false'
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
|
@ -57,7 +57,7 @@ runs:
|
|||
run: |
|
||||
$errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0
|
||||
try {
|
||||
${{ github.action_path }}/Deliver.ps1 -actor $ENV:_actor -token $ENV:_token -parentTelemetryScopeJson $ENV:_parentTelemetryScopeJson -projects $ENV:_projects -deliveryTarget $ENV:_deliveryTarget -artifacts $ENV:_artifacts -type $ENV:_type -atypes $ENV:_atypes -goLive ($ENV:_goLive -eq 'Y')
|
||||
${{ github.action_path }}/Deliver.ps1 -actor $ENV:_actor -token $ENV:_token -parentTelemetryScopeJson $ENV:_parentTelemetryScopeJson -projects $ENV:_projects -deliveryTarget $ENV:_deliveryTarget -artifacts $ENV:_artifacts -type $ENV:_type -atypes $ENV:_atypes -goLive ($ENV:_goLive -eq 'true')
|
||||
}
|
||||
catch {
|
||||
Write-Host "::ERROR::Unexpected error when running action. Error Message: $($_.Exception.Message.Replace("`r",'').Replace("`n",' ')), StackTrace: $($_.ScriptStackTrace.Replace("`r",'').Replace("`n",' <- '))";
|
||||
|
|
|
@ -16,7 +16,7 @@ Deploy Apps to online environment
|
|||
| shell | | The shell (powershell or pwsh) in which the PowerShell script in this action should run | powershell |
|
||||
| token | | The GitHub token running the action | github.token |
|
||||
| parentTelemetryScopeJson | | Specifies the parent telemetry scope for the telemetry signal | {} |
|
||||
| projects | | Comma separated list of projects to deploy. | |
|
||||
| projects | | Comma-separated list of projects to deploy. | |
|
||||
| environmentName | Yes | Name of environment to deploy to |
|
||||
| artifacts | Yes | Artifacts to deploy |
|
||||
| type | | Type of delivery (CD or Release) | CD |
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
Param(
|
||||
[Parameter(HelpMessage = "Projects to investigate", Mandatory = $false)]
|
||||
[string] $projectsJson = '["."]',
|
||||
[Parameter(HelpMessage = "Check whether context secret exists", Mandatory = $false)]
|
||||
[Parameter(HelpMessage = "Check whether context secret exists?", Mandatory = $false)]
|
||||
[bool] $checkContextSecrets
|
||||
)
|
||||
|
||||
|
|
|
@ -14,12 +14,12 @@ Determines the delivery targets to use for the build
|
|||
| :-- | :-: | :-- | :-- |
|
||||
| shell | | The shell (powershell or pwsh) in which the PowerShell script in this action should run | powershell |
|
||||
| projectsJson | | Projects folder if repository is setup for multiple projects | . |
|
||||
| checkContextSecrets | | Determines whether to check that delivery targets have a corresponding context secret defined | Y |
|
||||
| checkContextSecrets | | Determines whether to check that delivery targets have a corresponding context secret defined | true |
|
||||
|
||||
## OUTPUT
|
||||
| Name | Description |
|
||||
| :-- | :-- |
|
||||
| deliveryTargets | Compressed JSON array containing all delivery targets to use for the build |
|
||||
| contextSecrets | A comma separated string with the names of the secrets to pass to ReadSecrets |
|
||||
| contextSecrets | A comma-separated string with the names of the secrets to pass to ReadSecrets |
|
||||
|
||||
### ENV variables
|
||||
|
|
|
@ -10,15 +10,15 @@ inputs:
|
|||
required: false
|
||||
default: '["."]'
|
||||
checkContextSecrets:
|
||||
description: Check whether context secret exists
|
||||
description: Check whether context secret exists?
|
||||
required: false
|
||||
default: 'N'
|
||||
default: 'false'
|
||||
outputs:
|
||||
DeliveryTargetsJson:
|
||||
description: An array of Delivery Targets in compressed JSON format
|
||||
value: ${{ steps.determineDeliveryTargets.outputs.DeliveryTargetsJson }}
|
||||
ContextSecrets:
|
||||
description: A comma seperated list of Context Secret names used
|
||||
description: A comma-separated list of Context Secret names used
|
||||
value: ${{ steps.determineDeliveryTargets.outputs.ContextSecrets }}
|
||||
runs:
|
||||
using: composite
|
||||
|
@ -32,7 +32,7 @@ runs:
|
|||
run: |
|
||||
$errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0
|
||||
try {
|
||||
${{ github.action_path }}/DetermineDeliveryTargets.ps1 -projectsJson $ENV:_projectsJson -checkContextSecrets ($ENV:_checkContextSecrets -eq 'Y')
|
||||
${{ github.action_path }}/DetermineDeliveryTargets.ps1 -projectsJson $ENV:_projectsJson -checkContextSecrets ($ENV:_checkContextSecrets -eq 'true')
|
||||
}
|
||||
catch {
|
||||
Write-Host "::ERROR::Unexpected error when running action. Error Message: $($_.Exception.Message.Replace("`r",'').Replace("`n",' ')), StackTrace: $($_.ScriptStackTrace.Replace("`r",'').Replace("`n",' <- '))";
|
||||
|
|
|
@ -139,21 +139,7 @@ function Get-ProjectsToBuild(
|
|||
|
||||
try {
|
||||
$settings = $env:Settings | ConvertFrom-Json
|
||||
|
||||
if ($settings.projects) {
|
||||
Write-Host "Projects specified in settings"
|
||||
$projects = $settings.projects
|
||||
}
|
||||
else {
|
||||
# Get all projects that have a settings.json file
|
||||
$projects = @(Get-ChildItem -Path $baseFolder -Recurse -Depth 2 | Where-Object { $_.PSIsContainer -and (Test-Path (Join-Path $_.FullName ".AL-Go/settings.json") -PathType Leaf) } | ForEach-Object { $_.FullName.Substring($baseFolder.length+1) })
|
||||
|
||||
# If the repo has a settings.json file, add it to the list of projects to build
|
||||
if (Test-Path (Join-Path ".AL-Go" "settings.json") -PathType Leaf) {
|
||||
$projects += @(".")
|
||||
}
|
||||
}
|
||||
|
||||
$projects = @(GetProjectsFromRepository -baseFolder $baseFolder -projectsFromSettings $settings.projects)
|
||||
Write-Host "Found AL-Go Projects: $($projects -join ', ')"
|
||||
|
||||
$projectsToBuild = @()
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
Write-Host "Event name: $env:GITHUB_EVENT_NAME"
|
||||
if ($env:GITHUB_EVENT_NAME -eq 'workflow_dispatch') {
|
||||
Write-Host "Inputs:"
|
||||
$eventPath = Get-Content -Encoding UTF8 -Path $env:GITHUB_EVENT_PATH -Raw | ConvertFrom-Json
|
||||
if ($null -ne $eventPath.inputs) {
|
||||
$eventPath.inputs.psObject.Properties | Sort-Object { $_.Name } | ForEach-Object {
|
||||
$property = $_.Name
|
||||
$value = $eventPath.inputs."$property"
|
||||
Write-Host "- $property = '$value'"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
# Dump Workflow Info
|
||||
Dump workflow info
|
||||
|
||||
## INPUT
|
||||
|
||||
### ENV variables
|
||||
none
|
||||
|
||||
### Parameters
|
||||
| Name | Required | Description | Default value |
|
||||
| :-- | :-: | :-- | :-- |
|
||||
| shell | | The shell (powershell or pwsh) in which the PowerShell script in this action should run | powershell |
|
||||
|
||||
## OUTPUT
|
||||
none
|
|
@ -0,0 +1,24 @@
|
|||
name: Dump Workflow Info
|
||||
author: Microsoft Corporation
|
||||
inputs:
|
||||
shell:
|
||||
description: Shell in which you want to run the action (powershell or pwsh)
|
||||
required: false
|
||||
default: powershell
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: run
|
||||
shell: ${{ inputs.shell }}
|
||||
run: |
|
||||
$errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0
|
||||
try {
|
||||
${{ github.action_path }}/DumpWorkflowInfo.ps1
|
||||
}
|
||||
catch {
|
||||
Write-Host "::ERROR::Unexpected error when running action. Error Message: $($_.Exception.Message.Replace("`r",'').Replace("`n",' ')), StackTrace: $($_.ScriptStackTrace.Replace("`r",'').Replace("`n",' <- '))";
|
||||
exit 1
|
||||
}
|
||||
branding:
|
||||
icon: terminal
|
||||
color: blue
|
|
@ -5,13 +5,13 @@
|
|||
[string] $token,
|
||||
[Parameter(HelpMessage = "Specifies the parent telemetry scope for the telemetry signal", Mandatory = $false)]
|
||||
[string] $parentTelemetryScopeJson = '7b7d',
|
||||
[Parameter(HelpMessage = "Project name if the repository is setup for multiple projects (* for all projects)", Mandatory = $false)]
|
||||
[string] $project = '*',
|
||||
[Parameter(HelpMessage = "List of project names if the repository is setup for multiple projects (* for all projects)", Mandatory = $false)]
|
||||
[string] $projects = '*',
|
||||
[Parameter(HelpMessage = "Updated Version Number. Use Major.Minor for absolute change, use +Major.Minor for incremental change.", Mandatory = $true)]
|
||||
[string] $versionnumber,
|
||||
[string] $versionNumber,
|
||||
[Parameter(HelpMessage = "Set the branch to update", Mandatory = $false)]
|
||||
[string] $updateBranch,
|
||||
[Parameter(HelpMessage = "Direct commit (Y/N)", Mandatory = $false)]
|
||||
[Parameter(HelpMessage = "Direct commit?", Mandatory = $false)]
|
||||
[bool] $directCommit
|
||||
)
|
||||
|
||||
|
@ -19,48 +19,27 @@ $telemetryScope = $null
|
|||
|
||||
try {
|
||||
. (Join-Path -Path $PSScriptRoot -ChildPath "..\AL-Go-Helper.ps1" -Resolve)
|
||||
$branch = ''
|
||||
if (!$directcommit) {
|
||||
# If not direct commit, create a new branch with name, relevant to the current date and base branch, and switch to it
|
||||
$branch = "increment-version-number/$updateBranch/$((Get-Date).ToUniversalTime().ToString(`"yyMMddHHmmss`"))" # e.g. increment-version-number/main/210101120000
|
||||
}
|
||||
$serverUrl = CloneIntoNewFolder -actor $actor -token $token -branch $branch
|
||||
$serverUrl, $branch = CloneIntoNewFolder -actor $actor -token $token -updateBranch $updateBranch -DirectCommit $directCommit -newBranchPrefix 'increment-version-number'
|
||||
$baseFolder = (Get-Location).path
|
||||
DownloadAndImportBcContainerHelper -baseFolder $baseFolder
|
||||
|
||||
import-module (Join-Path -path $PSScriptRoot -ChildPath "..\TelemetryHelper.psm1" -Resolve)
|
||||
$telemetryScope = CreateScope -eventId 'DO0076' -parentTelemetryScopeJson $parentTelemetryScopeJson
|
||||
|
||||
$addToVersionNumber = "$versionnumber".StartsWith('+')
|
||||
$addToVersionNumber = "$versionNumber".StartsWith('+')
|
||||
if ($addToVersionNumber) {
|
||||
$versionnumber = $versionnumber.Substring(1)
|
||||
$versionNumber = $versionNumber.Substring(1)
|
||||
}
|
||||
try {
|
||||
$newVersion = [System.Version]"$($versionnumber).0.0"
|
||||
$newVersion = [System.Version]"$($versionNumber).0.0"
|
||||
}
|
||||
catch {
|
||||
throw "Version number ($versionnumber) is malformed. A version number must be structured as <Major>.<Minor> or +<Major>.<Minor>"
|
||||
throw "Version number ($versionNumber) is malformed. A version number must be structured as <Major>.<Minor> or +<Major>.<Minor>"
|
||||
}
|
||||
|
||||
if (!$project) { $project = '*' }
|
||||
|
||||
if ($project -ne '.') {
|
||||
$projects = @(Get-ChildItem -Path $baseFolder -Directory -Recurse -Depth 2 | Where-Object { Test-Path (Join-Path $_.FullName ".AL-Go/settings.json") -PathType Leaf } | ForEach-Object { $_.FullName.Substring($baseFolder.length+1) } | Where-Object { $_ -like $project })
|
||||
if ($projects.Count -eq 0) {
|
||||
if ($project -eq '*') {
|
||||
$projects = @( '.' )
|
||||
}
|
||||
else {
|
||||
throw "Project folder $project not found"
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
$projects = @( '.' )
|
||||
}
|
||||
|
||||
$projects | ForEach-Object {
|
||||
$project = $_
|
||||
$settings = $env:Settings | ConvertFrom-Json
|
||||
$projectList = @(GetProjectsFromRepository -baseFolder $baseFolder -projectsFromSettings $settings.projects -selectProjects $projects)
|
||||
foreach($project in $projectList) {
|
||||
try {
|
||||
Write-Host "Reading settings from $project\$ALGoSettingsFile"
|
||||
$settingsJson = Get-Content "$project\$ALGoSettingsFile" -Encoding UTF8 | ConvertFrom-Json
|
||||
|
@ -120,10 +99,10 @@ try {
|
|||
}
|
||||
}
|
||||
if ($addToVersionNumber) {
|
||||
CommitFromNewFolder -serverUrl $serverUrl -commitMessage "Increment Version number by $($newVersion.Major).$($newVersion.Minor)" -branch $branch
|
||||
CommitFromNewFolder -serverUrl $serverUrl -commitMessage "Increment Version number by $($newVersion.Major).$($newVersion.Minor)" -branch $branch | Out-Null
|
||||
}
|
||||
else {
|
||||
CommitFromNewFolder -serverUrl $serverUrl -commitMessage "New Version number $($newVersion.Major).$($newVersion.Minor)" -branch $branch
|
||||
CommitFromNewFolder -serverUrl $serverUrl -commitMessage "New Version number $($newVersion.Major).$($newVersion.Minor)" -branch $branch | Out-Null
|
||||
}
|
||||
|
||||
TrackTrace -telemetryScope $telemetryScope
|
||||
|
|
|
@ -4,7 +4,9 @@ Increment version number in AL-Go repository
|
|||
## INPUT
|
||||
|
||||
### ENV variables
|
||||
none
|
||||
| Name | Description |
|
||||
| :-- | :-- |
|
||||
| Settings | env.Settings must be set by a prior call to the ReadSettings Action |
|
||||
|
||||
### Parameters
|
||||
| Name | Required | Description | Default value |
|
||||
|
@ -13,10 +15,10 @@ none
|
|||
| actor | | The GitHub actor running the action | github.actor |
|
||||
| token | | The GitHub token running the action | github.token |
|
||||
| parentTelemetryScopeJson | | Specifies the parent telemetry scope for the telemetry signal | {} |
|
||||
| project | | Project name if the repository is setup for multiple projects | . |
|
||||
| versionnumber | Yes | Updated Version Number. Use Major.Minor for absolute change, use +Major.Minor for incremental change | |
|
||||
| projects | | List of project names if the repository is setup for multiple projects (* for all projects) | * |
|
||||
| versionNumber | Yes | Updated Version Number. Use Major.Minor for absolute change, use +Major.Minor for incremental change | |
|
||||
| updateBranch | | Which branch should the app be added to | github.ref_name |
|
||||
| directCommit | | Y if the action should create a direct commit against the branch or N to create a Pull Request | N |
|
||||
| directCommit | | true if the action should create a direct commit against the branch or false to create a Pull Request | false |
|
||||
|
||||
## OUTPUT
|
||||
none
|
||||
|
|
|
@ -20,11 +20,11 @@ inputs:
|
|||
description: Specifies the parent telemetry scope for the telemetry signal
|
||||
required: false
|
||||
default: '7b7d'
|
||||
project:
|
||||
description: Project name if the repository is setup for multiple projects (* for all projects)
|
||||
projects:
|
||||
description: List of project names if the repository is setup for multiple projects (* for all projects)
|
||||
required: false
|
||||
default: '*'
|
||||
versionnumber:
|
||||
versionNumber:
|
||||
description: Updated Version Number. Use Major.Minor for absolute change, use +Major.Minor for incremental change.
|
||||
required: true
|
||||
updateBranch:
|
||||
|
@ -32,9 +32,9 @@ inputs:
|
|||
required: false
|
||||
default: ${{ github.ref_name }}
|
||||
directCommit:
|
||||
description: Direct Commit (Y/N)
|
||||
description: Direct Commit?
|
||||
required: false
|
||||
default: 'N'
|
||||
default: 'false'
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
|
@ -44,14 +44,14 @@ runs:
|
|||
_actor: ${{ inputs.actor }}
|
||||
_token: ${{ inputs.token }}
|
||||
_parentTelemetryScopeJson: ${{ inputs.parentTelemetryScopeJson }}
|
||||
_project: ${{ inputs.project }}
|
||||
_versionnumber: ${{ inputs.versionnumber }}
|
||||
_projects: ${{ inputs.projects }}
|
||||
_versionNumber: ${{ inputs.versionNumber }}
|
||||
_updateBranch: ${{ inputs.updateBranch }}
|
||||
_directCommit: ${{ inputs.directCommit }}
|
||||
run: |
|
||||
$errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0
|
||||
try {
|
||||
${{ github.action_path }}/IncrementVersionNumber.ps1 -actor $ENV:_actor -token $ENV:_token -parentTelemetryScopeJson $ENV:_parentTelemetryScopeJson -project $ENV:_project -versionnumber $ENV:_versionnumber -updateBranch $ENV:_updateBranch -directCommit ($ENV:_directCommit -eq 'Y')
|
||||
${{ github.action_path }}/IncrementVersionNumber.ps1 -actor $ENV:_actor -token $ENV:_token -parentTelemetryScopeJson $ENV:_parentTelemetryScopeJson -projects $ENV:_projects -versionNumber $ENV:_versionNumber -updateBranch $ENV:_updateBranch -directCommit ($ENV:_directCommit -eq 'true')
|
||||
}
|
||||
catch {
|
||||
Write-Host "::ERROR::Unexpected error when running action. Error Message: $($_.Exception.Message.Replace("`r",'').Replace("`n",' ')), StackTrace: $($_.ScriptStackTrace.Replace("`r",'').Replace("`n",' <- '))";
|
||||
|
|
|
@ -17,7 +17,7 @@ Secrets, which name is preceded by an asterisk (*) are encrypted and Base64 enco
|
|||
| :-- | :-: | :-- | :-- |
|
||||
| shell | | The shell (powershell or pwsh) in which the PowerShell script in this action should run | powershell |
|
||||
| parentTelemetryScopeJson | | Specifies the parent telemetry scope for the telemetry signal | {} |
|
||||
| getSecrets | Yes | Comma separated list of secrets to get (add appDependencyProbingPathsSecrets to request secrets needed for resolving dependencies in AppDependencyProbingPaths, add TokenForPush in order to request a token to use for pull requests and commits). Secrets preceded by an asterisk are returned encrypted | |
|
||||
| getSecrets | Yes | Comma-separated list of secrets to get (add appDependencyProbingPathsSecrets to request secrets needed for resolving dependencies in AppDependencyProbingPaths, add TokenForPush in order to request a token to use for pull requests and commits). Secrets preceded by an asterisk are returned encrypted | |
|
||||
| useGhTokenWorkflowForPush | false | Determines whether you want to use the GhTokenWorkflow secret for TokenForPush |
|
||||
|
||||
## OUTPUT
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
Param(
|
||||
[Parameter(HelpMessage = "All GitHub Secrets in compressed JSON format", Mandatory = $true)]
|
||||
[string] $gitHubSecrets = "",
|
||||
[Parameter(HelpMessage = "Comma separated list of Secrets to get. Secrets preceded by an asterisk are returned encrypted", Mandatory = $true)]
|
||||
[Parameter(HelpMessage = "Comma-separated list of Secrets to get. Secrets preceded by an asterisk are returned encrypted", Mandatory = $true)]
|
||||
[string] $getSecrets = "",
|
||||
[Parameter(HelpMessage = "Determines whether you want to use the GhTokenWorkflow secret for TokenForPush", Mandatory = $false)]
|
||||
[string] $useGhTokenWorkflowForPush = 'false'
|
||||
|
|
|
@ -9,7 +9,7 @@ inputs:
|
|||
description: All GitHub Secrets in compressed JSON format
|
||||
required: true
|
||||
getSecrets:
|
||||
description: Comma separated list of Secrets to get. Secrets preceded by an asterisk are returned encrypted
|
||||
description: Comma-separated list of Secrets to get. Secrets preceded by an asterisk are returned encrypted
|
||||
required: true
|
||||
useGhTokenWorkflowForPush:
|
||||
description: Determines whether you want to use the GhTokenWorkflow secret for TokenForPush
|
||||
|
|
|
@ -2,6 +2,16 @@
|
|||
|
||||
Note that when using the preview version of AL-Go for GitHub, we recommend you Update your AL-Go system files, as soon as possible when informed that an update is available.
|
||||
|
||||
### New Settings
|
||||
- `templateSha`: The SHA of the version of AL-Go currently used
|
||||
|
||||
### New Actions
|
||||
- `DumpWorkflowInfo`: Dump information about running workflow
|
||||
|
||||
### Update AL-Go System Files
|
||||
Add another parameter when running Update AL-Go System Files, called downloadLatest, used to indicate whether to download latest version from template repository. Default value is true.
|
||||
If false, the templateSha repository setting is used to download specific AL-Go System Files when calculating new files.
|
||||
|
||||
### Issues
|
||||
- Issue 782 Exclude '.altestrunner/' from template .gitignore
|
||||
- Issue 823 Dependencies from prior build jobs are not included when using useProjectDependencies
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
1. Enter **app1** as repository name, select Public or Private and select **Create Repository from template**
|
||||
1. Select **Actions** -> **Create a new app** -> **Run workflow**
|
||||
![Run workflow](https://github.com/microsoft/AL-Go/assets/10775043/6c1ac9c3-14c2-4917-a31a-d94e5bb7bd66)
|
||||
1. Enter **Name**, **Publisher**, **ID range** and specify **Y** in **Direct COMMIT** and choose **Run workflow**.
|
||||
1. Enter **Name**, **Publisher**, **ID range** and specify **Y** in **Direct Commit** and choose **Run workflow**.
|
||||
1. When the workflow is complete, select **< > Code** in the top bar
|
||||
1. Choose the **Code** button and copy the **https Clone Url** (in this picture: *https://github.com/freddydk/App1.git*)
|
||||
![Clone](https://github.com/microsoft/AL-Go/assets/10775043/84b92edb-72b8-4444-908c-0c6f6bc2b7f7)
|
||||
|
|
|
@ -57,13 +57,13 @@ The repository settings are only read from the repository settings file (.github
|
|||
| <a id="githubRunnerShell"></a>githubRunnerShell | Specifies which shell is used for build jobs in workflows including a build job. The default is to use the same as defined in **shell**. If the shell setting isn't defined, **powershell** is the default, which results in using _PowerShell 5.1_. Use **pwsh** for _PowerShell 7_. |
|
||||
| <a id="environments"></a>environments | Array of logical environment names. You can specify environments in GitHub environments or in the repo settings file. If you specify environments in the settings file, you can create your AUTHCONTEXT secret using **<environmentname>_AUTHCONTEXT**. You can specify additional information about environments in a setting called **DeployTo<environmentname>** | [ ] |
|
||||
| <a id="deliverto"></a>DeliverTo<deliveryTarget> | Structure with additional properties for the deliveryTarget specified. Some properties are deliveryTarget specific. The structure can contain the following properties:<br />**Branches** = an array of branch patterns, which are allowed to deliver to this deliveryTarget. (Default main)<br />**CreateContainerIfNotExist** = *[Only for DeliverToStorage]* Create Blob Storage Container if it doesn't already exist. (Default false)<br /> | { } |
|
||||
| <a id="deployto"></a>DeployTo<environmentname> | Structure with additional properties for the environment specified. The structure can contain the following properties:<br />**EnvironmentType** = specifies the type of environment. The environment type can be used to invoke a custom deployment. (Default SaaS)<br />**EnvironmentName** = specifies the "real" name of the environment if it differs from the GitHub environment.<br />**Branches** = an array of branch patterns, which are allowed to deploy to this environment. (Default main)<br />**Projects** = In multi-project repositories, this property can be a comma separated list of project patterns to deploy to this environment. (Default *)<br />**SyncMode** = ForceSync if deployment to this environment should happen with ForceSync, else Add. If deploying to the development endpoint you can also specify Development or Clean. (Default Add)<br />**ContinuousDeployment** = true if this environment should be used for continuous deployment, else false. (Default: AL-Go will continuously deploy to sandbox environments or environments, which doesn't end in (PROD) or (FAT)<br />**runs-on** = specifies which runner to use when deploying to this environment. (Default is settings.runs-on)<br /> | { } |
|
||||
| <a id="deployto"></a>DeployTo<environmentname> | Structure with additional properties for the environment specified. The structure can contain the following properties:<br />**EnvironmentType** = specifies the type of environment. The environment type can be used to invoke a custom deployment. (Default SaaS)<br />**EnvironmentName** = specifies the "real" name of the environment if it differs from the GitHub environment.<br />**Branches** = an array of branch patterns, which are allowed to deploy to this environment. (Default main)<br />**Projects** = In multi-project repositories, this property can be a comma-separated list of project patterns to deploy to this environment. (Default *)<br />**SyncMode** = ForceSync if deployment to this environment should happen with ForceSync, else Add. If deploying to the development endpoint you can also specify Development or Clean. (Default Add)<br />**ContinuousDeployment** = true if this environment should be used for continuous deployment, else false. (Default: AL-Go will continuously deploy to sandbox environments or environments, which doesn't end in (PROD) or (FAT)<br />**runs-on** = specifies which runner to use when deploying to this environment. (Default is settings.runs-on)<br /> | { } |
|
||||
| <a id="useProjectDependencies"></a>useProjectDependencies | Determines whether your projects are built using a multi-stage built workflow or single stage. After setting useProjectDependencies to true, you need to run Update AL-Go System Files and your workflows including a build job will change to have multiple build jobs, depending on each other. The number of build jobs will be determined by the dependency depth in your projects.<br />You can change dependencies between your projects, but if the dependency **depth** changes, AL-Go will warn you that updates for your AL-Go System Files are available and you will need to run the workflow. |
|
||||
| <a id="CICDPushBranches"></a>CICDPushBranches | CICDPushBranches can be specified as an array of branches, which triggers a CI/CD workflow on commit.<br />Default is [ "main", "release/\*", "feature/\*" ] |
|
||||
| <a id="CICDPullrequestBranches"></a>CICDPullRequestBranches | CICDPullRequestBranches can be specified as an array of branches, which triggers a CI/CD workflow on a PR.<br />Default is [ "main" ] |
|
||||
| <a id="PullRequestTrigger"></a>PullRequestTrigger | Setting for specifying the trigger AL-Go should use to trigger Pull Request Builds. By default it is set to [pull_request_target](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request_target) |
|
||||
| <a id="CICDSchedule"></a>CICDSchedule | CRON schedule for when CI/CD workflow should run. Default is no scheduled run, only manually triggered or triggered by Push or Pull Request. Build your CRON string here: [https://crontab.guru](https://crontab.guru) |
|
||||
| <a id="UpdateGitHubGoSystemFilesSchedule"></a>UpdateGitHubGoSystemFilesSchedule | CRON schedule for when Update AL-Go System Files should run. When Update AL-Go System Files runs on a schedule, it uses direct COMMIT instead of creating a PR. Default is no scheduled run, only manual trigger. Build your CRON string here: [https://crontab.guru](https://crontab.guru) |
|
||||
| <a id="UpdateGitHubGoSystemFilesSchedule"></a>UpdateGitHubGoSystemFilesSchedule | CRON schedule for when Update AL-Go System Files should run. When Update AL-Go System Files runs on a schedule, it uses direct Commit instead of creating a PR. Default is no scheduled run, only manual trigger. Build your CRON string here: [https://crontab.guru](https://crontab.guru) |
|
||||
| <a id="buildModes"></a>buildModes | A list of build modes to use when building the AL-Go projects. Every AL-Go projects will be built using each built mode. Available build modes are:<br /> **Default**: Apps are compiled as they are in the source code.<br />**Clean**: _PreprocessorSymbols_ are enabled when compiling the apps. The values for the symbols correspond to the `cleanModePreprocessorSymbols` setting of the AL-Go project.<br />**Translated**: `TranslationFile` compiler feature is enabled when compiling the apps. |
|
||||
|
||||
## Advanced settings
|
||||
|
|
|
@ -13,12 +13,13 @@ on:
|
|||
description: Direct Download Url of .app or .zip file
|
||||
required: true
|
||||
directCommit:
|
||||
description: Direct COMMIT (Y/N)
|
||||
required: false
|
||||
default: 'N'
|
||||
useGhTokenWorkflow:
|
||||
description: Use GhTokenWorkflow for Pull Request/COMMIT
|
||||
description: Direct Commit?
|
||||
type: boolean
|
||||
default: false
|
||||
useGhTokenWorkflow:
|
||||
description: Use GhTokenWorkflow for PR/Commit?
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
@ -34,8 +35,14 @@ env:
|
|||
|
||||
jobs:
|
||||
AddExistingAppOrTestApp:
|
||||
needs: [ ]
|
||||
runs-on: [ windows-latest ]
|
||||
steps:
|
||||
- name: Dump Workflow Information
|
||||
uses: microsoft/AL-Go-Actions/DumpWorkflowInfo@main
|
||||
with:
|
||||
shell: powershell
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@ env:
|
|||
|
||||
jobs:
|
||||
Initialization:
|
||||
needs: [ ]
|
||||
runs-on: [ windows-latest ]
|
||||
outputs:
|
||||
telemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}
|
||||
|
@ -38,6 +39,11 @@ jobs:
|
|||
buildOrderJson: ${{ steps.determineProjectsToBuild.outputs.BuildOrderJson }}
|
||||
workflowDepth: ${{ steps.DetermineWorkflowDepth.outputs.WorkflowDepth }}
|
||||
steps:
|
||||
- name: Dump Workflow Information
|
||||
uses: microsoft/AL-Go-Actions/DumpWorkflowInfo@main
|
||||
with:
|
||||
shell: powershell
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
|
@ -75,7 +81,7 @@ jobs:
|
|||
with:
|
||||
shell: powershell
|
||||
projectsJson: '${{ steps.determineProjectsToBuild.outputs.ProjectsJson }}'
|
||||
checkContextSecrets: 'N'
|
||||
checkContextSecrets: 'false'
|
||||
|
||||
- name: Read secrets
|
||||
id: ReadSecrets
|
||||
|
@ -93,7 +99,7 @@ jobs:
|
|||
with:
|
||||
shell: powershell
|
||||
projectsJson: '${{ steps.determineProjectsToBuild.outputs.ProjectsJson }}'
|
||||
checkContextSecrets: 'Y'
|
||||
checkContextSecrets: 'true'
|
||||
|
||||
- name: Determine Deployment Environments
|
||||
id: DetermineDeploymentEnvironments
|
||||
|
@ -106,8 +112,8 @@ jobs:
|
|||
type: 'CD'
|
||||
|
||||
CheckForUpdates:
|
||||
runs-on: [ windows-latest ]
|
||||
needs: [ Initialization ]
|
||||
runs-on: [ windows-latest ]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
@ -122,8 +128,8 @@ jobs:
|
|||
uses: microsoft/AL-Go-Actions/CheckForUpdates@main
|
||||
with:
|
||||
shell: powershell
|
||||
parentTelemetryScopeJson: ${{ needs.Initialization.outputs.telemetryScopeJson }}
|
||||
templateUrl: ${{ env.templateUrl }}
|
||||
downloadLatest: true
|
||||
|
||||
Build:
|
||||
needs: [ Initialization ]
|
||||
|
@ -242,9 +248,9 @@ jobs:
|
|||
artifacts: '.artifacts'
|
||||
|
||||
PostProcess:
|
||||
needs: [ Initialization, Build, Deploy, Deliver ]
|
||||
if: (!cancelled())
|
||||
runs-on: [ windows-latest ]
|
||||
needs: [ Initialization, Build, Deploy, Deliver ]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
|
|
@ -19,16 +19,17 @@ on:
|
|||
description: ID range (from..to)
|
||||
required: true
|
||||
sampleCode:
|
||||
description: Include Sample code (Y/N)
|
||||
required: false
|
||||
default: 'Y'
|
||||
directCommit:
|
||||
description: Direct COMMIT (Y/N)
|
||||
required: false
|
||||
default: "N"
|
||||
useGhTokenWorkflow:
|
||||
description: Use GhTokenWorkflow for Pull Request/COMMIT
|
||||
description: Include Sample code?
|
||||
type: boolean
|
||||
default: true
|
||||
directCommit:
|
||||
description: Direct Commit?
|
||||
type: boolean
|
||||
default: false
|
||||
useGhTokenWorkflow:
|
||||
description: Use GhTokenWorkflow for PR/Commit?
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
@ -44,8 +45,14 @@ env:
|
|||
|
||||
jobs:
|
||||
CreateApp:
|
||||
needs: [ ]
|
||||
runs-on: [ windows-latest ]
|
||||
steps:
|
||||
- name: Dump Workflow Information
|
||||
uses: microsoft/AL-Go-Actions/DumpWorkflowInfo@main
|
||||
with:
|
||||
shell: powershell
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
|
|
|
@ -13,16 +13,17 @@ on:
|
|||
description: Name of the online environment
|
||||
required: true
|
||||
reUseExistingEnvironment:
|
||||
description: Reuse environment if it exists
|
||||
required: false
|
||||
default: 'N'
|
||||
directCommit:
|
||||
description: Direct COMMIT (Y/N)
|
||||
required: false
|
||||
default: 'N'
|
||||
useGhTokenWorkflow:
|
||||
description: Use GhTokenWorkflow for Pull Request/COMMIT
|
||||
description: Reuse environment if it exists?
|
||||
type: boolean
|
||||
default: false
|
||||
directCommit:
|
||||
description: Direct Commit?
|
||||
type: boolean
|
||||
default: false
|
||||
useGhTokenWorkflow:
|
||||
description: Use GhTokenWorkflow for PR/Commit?
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
@ -38,6 +39,7 @@ env:
|
|||
|
||||
jobs:
|
||||
Initialization:
|
||||
needs: [ ]
|
||||
runs-on: [ windows-latest ]
|
||||
outputs:
|
||||
deviceCode: ${{ steps.authenticate.outputs.deviceCode }}
|
||||
|
@ -45,6 +47,11 @@ jobs:
|
|||
githubRunner: ${{ steps.ReadSettings.outputs.GitHubRunnerJson }}
|
||||
githubRunnerShell: ${{ steps.ReadSettings.outputs.GitHubRunnerShell }}
|
||||
steps:
|
||||
- name: Dump Workflow Information
|
||||
uses: microsoft/AL-Go-Actions/DumpWorkflowInfo@main
|
||||
with:
|
||||
shell: powershell
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
|
@ -91,12 +98,12 @@ jobs:
|
|||
}
|
||||
|
||||
CreateDevelopmentEnvironment:
|
||||
needs: [ Initialization ]
|
||||
runs-on: ${{ fromJson(needs.Initialization.outputs.githubRunner) }}
|
||||
defaults:
|
||||
run:
|
||||
shell: ${{ needs.Initialization.outputs.githubRunnerShell }}
|
||||
name: Create Development Environment
|
||||
needs: [ Initialization ]
|
||||
env:
|
||||
deviceCode: ${{ needs.Initialization.outputs.deviceCode }}
|
||||
steps:
|
||||
|
|
|
@ -21,20 +21,21 @@ on:
|
|||
required: true
|
||||
default: '50000..99999'
|
||||
sampleCode:
|
||||
description: Include Sample code (Y/N)
|
||||
required: false
|
||||
default: 'Y'
|
||||
sampleSuite:
|
||||
description: Include Sample BCPT Suite (Y/N)
|
||||
required: false
|
||||
default: 'Y'
|
||||
directCommit:
|
||||
description: Direct COMMIT (Y/N)
|
||||
required: false
|
||||
default: 'N'
|
||||
useGhTokenWorkflow:
|
||||
description: Use GhTokenWorkflow for Pull Request/COMMIT
|
||||
description: Include Sample code?
|
||||
type: boolean
|
||||
default: true
|
||||
sampleSuite:
|
||||
description: Include Sample BCPT Suite?
|
||||
type: boolean
|
||||
default: true
|
||||
directCommit:
|
||||
description: Direct Commit?
|
||||
type: boolean
|
||||
default: false
|
||||
useGhTokenWorkflow:
|
||||
description: Use GhTokenWorkflow for PR/Commit?
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
@ -50,8 +51,14 @@ env:
|
|||
|
||||
jobs:
|
||||
CreatePerformanceTestApp:
|
||||
needs: [ ]
|
||||
runs-on: [ windows-latest ]
|
||||
steps:
|
||||
- name: Dump Workflow Information
|
||||
uses: microsoft/AL-Go-Actions/DumpWorkflowInfo@main
|
||||
with:
|
||||
shell: powershell
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
|
|
|
@ -16,28 +16,29 @@ on:
|
|||
required: true
|
||||
default: ''
|
||||
prerelease:
|
||||
description: Prerelease (Y/N)
|
||||
required: false
|
||||
default: 'N'
|
||||
description: Prerelease?
|
||||
type: boolean
|
||||
default: false
|
||||
draft:
|
||||
description: Draft (Y/N)
|
||||
required: false
|
||||
default: 'N'
|
||||
description: Draft?
|
||||
type: boolean
|
||||
default: false
|
||||
createReleaseBranch:
|
||||
description: Create Release Branch (Y/N)
|
||||
required: false
|
||||
default: 'N'
|
||||
description: Create Release Branch?
|
||||
type: boolean
|
||||
default: false
|
||||
updateVersionNumber:
|
||||
description: New Version Number in main branch. Use Major.Minor for absolute change, use +Major.Minor for incremental change.
|
||||
required: false
|
||||
default: ''
|
||||
directCommit:
|
||||
description: Direct COMMIT (Y/N)
|
||||
required: false
|
||||
default: 'N'
|
||||
useGhTokenWorkflow:
|
||||
description: Use GhTokenWorkflow for Pull Request/COMMIT
|
||||
description: Direct Commit?
|
||||
type: boolean
|
||||
default: false
|
||||
useGhTokenWorkflow:
|
||||
description: Use GhTokenWorkflow for PR/Commit?
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
@ -56,6 +57,7 @@ env:
|
|||
|
||||
jobs:
|
||||
CreateRelease:
|
||||
needs: [ ]
|
||||
runs-on: [ windows-latest ]
|
||||
outputs:
|
||||
telemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}
|
||||
|
@ -64,6 +66,11 @@ jobs:
|
|||
commitish: ${{ steps.analyzeartifacts.outputs.commitish }}
|
||||
releaseBranch: ${{ steps.createreleasenotes.outputs.releaseBranch }}
|
||||
steps:
|
||||
- name: Dump Workflow Information
|
||||
uses: microsoft/AL-Go-Actions/DumpWorkflowInfo@main
|
||||
with:
|
||||
shell: powershell
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
|
@ -91,8 +98,8 @@ jobs:
|
|||
uses: microsoft/AL-Go-Actions/CheckForUpdates@main
|
||||
with:
|
||||
shell: powershell
|
||||
parentTelemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}
|
||||
templateUrl: ${{ env.templateUrl }}
|
||||
downloadLatest: true
|
||||
|
||||
- name: Analyze Artifacts
|
||||
id: analyzeartifacts
|
||||
|
@ -195,8 +202,8 @@ jobs:
|
|||
tag_name: '${{ github.event.inputs.tag }}',
|
||||
name: '${{ github.event.inputs.name }}',
|
||||
body: bodyMD.replaceAll('\\n','\n').replaceAll('%0A','\n').replaceAll('%0D','\n').replaceAll('%25','%'),
|
||||
draft: ${{ github.event.inputs.draft=='Y' }},
|
||||
prerelease: ${{ github.event.inputs.prerelease=='Y' }},
|
||||
draft: ${{ github.event.inputs.draft=='true' }},
|
||||
prerelease: ${{ github.event.inputs.prerelease=='true' }},
|
||||
make_latest: 'legacy',
|
||||
target_commitish: '${{ steps.analyzeartifacts.outputs.commitish }}'
|
||||
});
|
||||
|
@ -206,8 +213,8 @@ jobs:
|
|||
core.setOutput('releaseId', releaseId);
|
||||
|
||||
UploadArtifacts:
|
||||
runs-on: [ windows-latest ]
|
||||
needs: [ CreateRelease ]
|
||||
runs-on: [ windows-latest ]
|
||||
strategy:
|
||||
matrix: ${{ fromJson(needs.CreateRelease.outputs.artifacts) }}
|
||||
fail-fast: true
|
||||
|
@ -285,9 +292,9 @@ jobs:
|
|||
atypes: 'Apps,TestApps,Dependencies'
|
||||
|
||||
CreateReleaseBranch:
|
||||
if: ${{ github.event.inputs.createReleaseBranch=='Y' }}
|
||||
runs-on: [ windows-latest ]
|
||||
needs: [ CreateRelease, UploadArtifacts ]
|
||||
if: ${{ github.event.inputs.createReleaseBranch=='true' }}
|
||||
runs-on: [ windows-latest ]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
@ -304,9 +311,9 @@ jobs:
|
|||
git push origin ${{ needs.CreateRelease.outputs.releaseBranch }}
|
||||
|
||||
UpdateVersionNumber:
|
||||
needs: [ CreateRelease, UploadArtifacts ]
|
||||
if: ${{ github.event.inputs.updateVersionNumber!='' }}
|
||||
runs-on: [ windows-latest ]
|
||||
needs: [ CreateRelease, UploadArtifacts ]
|
||||
steps:
|
||||
- name: Read settings
|
||||
uses: microsoft/AL-Go-Actions/ReadSettings@main
|
||||
|
@ -332,9 +339,9 @@ jobs:
|
|||
directCommit: ${{ github.event.inputs.directCommit }}
|
||||
|
||||
PostProcess:
|
||||
needs: [ CreateRelease, UploadArtifacts, CreateReleaseBranch, UpdateVersionNumber ]
|
||||
if: always()
|
||||
runs-on: [ windows-latest ]
|
||||
needs: [ CreateRelease, UploadArtifacts, CreateReleaseBranch, UpdateVersionNumber ]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
|
|
@ -21,16 +21,17 @@ on:
|
|||
required: true
|
||||
default: '50000..99999'
|
||||
sampleCode:
|
||||
description: Include Sample code (Y/N)
|
||||
required: false
|
||||
default: 'Y'
|
||||
directCommit:
|
||||
description: Direct COMMIT (Y/N)
|
||||
required: false
|
||||
default: 'N'
|
||||
useGhTokenWorkflow:
|
||||
description: Use GhTokenWorkflow for Pull Request/COMMIT
|
||||
description: Include Sample code?
|
||||
type: boolean
|
||||
default: true
|
||||
directCommit:
|
||||
description: Direct Commit?
|
||||
type: boolean
|
||||
default: false
|
||||
useGhTokenWorkflow:
|
||||
description: Use GhTokenWorkflow for PR/Commit?
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
@ -46,8 +47,14 @@ env:
|
|||
|
||||
jobs:
|
||||
CreateTestApp:
|
||||
needs: [ ]
|
||||
runs-on: [ windows-latest ]
|
||||
steps:
|
||||
- name: Dump Workflow Information
|
||||
uses: microsoft/AL-Go-Actions/DumpWorkflowInfo@main
|
||||
with:
|
||||
shell: powershell
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ env:
|
|||
|
||||
jobs:
|
||||
Initialization:
|
||||
needs: [ ]
|
||||
runs-on: [ windows-latest ]
|
||||
outputs:
|
||||
telemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}
|
||||
|
@ -27,6 +28,11 @@ jobs:
|
|||
buildOrderJson: ${{ steps.determineProjectsToBuild.outputs.BuildOrderJson }}
|
||||
workflowDepth: ${{ steps.DetermineWorkflowDepth.outputs.WorkflowDepth }}
|
||||
steps:
|
||||
- name: Dump Workflow Information
|
||||
uses: microsoft/AL-Go-Actions/DumpWorkflowInfo@main
|
||||
with:
|
||||
shell: powershell
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
|
@ -80,9 +86,9 @@ jobs:
|
|||
artifactsNameSuffix: 'Current'
|
||||
|
||||
PostProcess:
|
||||
needs: [ Initialization, Build ]
|
||||
if: always()
|
||||
runs-on: [ windows-latest ]
|
||||
needs: [ Initialization, Build ]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
|
|
@ -5,20 +5,21 @@ run-name: "Increment Version Number in [${{ github.ref_name }}]"
|
|||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
project:
|
||||
description: Project name if the repository is setup for multiple projects (* for all projects)
|
||||
projects:
|
||||
description: Comma-separated list of project name patterns if the repository is setup for multiple projects (default is * for all projects)
|
||||
required: false
|
||||
default: '*'
|
||||
versionNumber:
|
||||
description: Updated Version Number. Use Major.Minor for absolute change, use +Major.Minor for incremental change.
|
||||
required: true
|
||||
directCommit:
|
||||
description: Direct COMMIT (Y/N)
|
||||
required: false
|
||||
default: 'N'
|
||||
useGhTokenWorkflow:
|
||||
description: Use GhTokenWorkflow for Pull Request/COMMIT
|
||||
description: Direct Commit?
|
||||
type: boolean
|
||||
default: false
|
||||
useGhTokenWorkflow:
|
||||
description: Use GhTokenWorkflow for PR/Commit?
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
@ -34,8 +35,14 @@ env:
|
|||
|
||||
jobs:
|
||||
IncrementVersionNumber:
|
||||
needs: [ ]
|
||||
runs-on: [ windows-latest ]
|
||||
steps:
|
||||
- name: Dump Workflow Information
|
||||
uses: microsoft/AL-Go-Actions/DumpWorkflowInfo@main
|
||||
with:
|
||||
shell: powershell
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
|
@ -66,7 +73,7 @@ jobs:
|
|||
shell: powershell
|
||||
token: ${{ steps.ReadSecrets.outputs.TokenForPush }}
|
||||
parentTelemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}
|
||||
project: ${{ github.event.inputs.project }}
|
||||
projects: ${{ github.event.inputs.projects }}
|
||||
versionNumber: ${{ github.event.inputs.versionNumber }}
|
||||
directCommit: ${{ github.event.inputs.directCommit }}
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ env:
|
|||
|
||||
jobs:
|
||||
Initialization:
|
||||
needs: [ ]
|
||||
runs-on: [ windows-latest ]
|
||||
outputs:
|
||||
telemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}
|
||||
|
@ -27,6 +28,11 @@ jobs:
|
|||
buildOrderJson: ${{ steps.determineProjectsToBuild.outputs.BuildOrderJson }}
|
||||
workflowDepth: ${{ steps.DetermineWorkflowDepth.outputs.WorkflowDepth }}
|
||||
steps:
|
||||
- name: Dump Workflow Information
|
||||
uses: microsoft/AL-Go-Actions/DumpWorkflowInfo@main
|
||||
with:
|
||||
shell: powershell
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
|
@ -80,9 +86,9 @@ jobs:
|
|||
artifactsNameSuffix: 'NextMajor'
|
||||
|
||||
PostProcess:
|
||||
needs: [ Initialization, Build ]
|
||||
if: always()
|
||||
runs-on: [ windows-latest ]
|
||||
needs: [ Initialization, Build ]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
|
|
@ -17,6 +17,7 @@ env:
|
|||
|
||||
jobs:
|
||||
Initialization:
|
||||
needs: [ ]
|
||||
runs-on: [ windows-latest ]
|
||||
outputs:
|
||||
telemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}
|
||||
|
@ -27,6 +28,11 @@ jobs:
|
|||
buildOrderJson: ${{ steps.determineProjectsToBuild.outputs.BuildOrderJson }}
|
||||
workflowDepth: ${{ steps.DetermineWorkflowDepth.outputs.WorkflowDepth }}
|
||||
steps:
|
||||
- name: Dump Workflow Information
|
||||
uses: microsoft/AL-Go-Actions/DumpWorkflowInfo@main
|
||||
with:
|
||||
shell: powershell
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
|
@ -80,9 +86,9 @@ jobs:
|
|||
artifactsNameSuffix: 'NextMinor'
|
||||
|
||||
PostProcess:
|
||||
needs: [ Initialization, Build ]
|
||||
if: always()
|
||||
runs-on: [ windows-latest ]
|
||||
needs: [ Initialization, Build ]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
|
|
@ -12,9 +12,9 @@ on:
|
|||
required: false
|
||||
default: '*'
|
||||
GoLive:
|
||||
description: Promote AppSource App to go live if it passes technical validation? (Y/N)
|
||||
required: false
|
||||
default: 'N'
|
||||
description: Promote AppSource App to go live if it passes technical validation?
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
@ -30,10 +30,16 @@ env:
|
|||
|
||||
jobs:
|
||||
Initialization:
|
||||
needs: [ ]
|
||||
runs-on: [ windows-latest ]
|
||||
outputs:
|
||||
telemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}
|
||||
steps:
|
||||
- name: Dump Workflow Information
|
||||
uses: microsoft/AL-Go-Actions/DumpWorkflowInfo@main
|
||||
with:
|
||||
shell: powershell
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
|
@ -79,9 +85,9 @@ jobs:
|
|||
goLive: ${{ github.event.inputs.goLive }}
|
||||
|
||||
PostProcess:
|
||||
needs: [ Initialization, Deliver ]
|
||||
if: always()
|
||||
runs-on: [ windows-latest ]
|
||||
needs: [ Initialization, Deliver ]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
|
|
@ -25,6 +25,7 @@ env:
|
|||
|
||||
jobs:
|
||||
Initialization:
|
||||
needs: [ ]
|
||||
runs-on: [ windows-latest ]
|
||||
outputs:
|
||||
telemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}
|
||||
|
@ -33,6 +34,11 @@ jobs:
|
|||
deploymentEnvironmentsJson: ${{ steps.DetermineDeploymentEnvironments.outputs.DeploymentEnvironmentsJson }}
|
||||
deviceCode: ${{ steps.Authenticate.outputs.deviceCode }}
|
||||
steps:
|
||||
- name: Dump Workflow Information
|
||||
uses: microsoft/AL-Go-Actions/DumpWorkflowInfo@main
|
||||
with:
|
||||
shell: powershell
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
|
@ -157,9 +163,9 @@ jobs:
|
|||
deploymentEnvironmentsJson: ${{ needs.Initialization.outputs.deploymentEnvironmentsJson }}
|
||||
|
||||
PostProcess:
|
||||
needs: [ Initialization, Deploy ]
|
||||
if: always()
|
||||
runs-on: [ windows-latest ]
|
||||
needs: [ Initialization, Deploy ]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
|
|
@ -42,6 +42,11 @@ jobs:
|
|||
buildOrderJson: ${{ steps.determineProjectsToBuild.outputs.BuildOrderJson }}
|
||||
workflowDepth: ${{ steps.DetermineWorkflowDepth.outputs.WorkflowDepth }}
|
||||
steps:
|
||||
- name: Dump Workflow Information
|
||||
uses: microsoft/AL-Go-Actions/DumpWorkflowInfo@main
|
||||
with:
|
||||
shell: powershell
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
|
@ -97,9 +102,9 @@ jobs:
|
|||
artifactsNameSuffix: 'PR${{ github.event.number }}'
|
||||
|
||||
StatusCheck:
|
||||
runs-on: [ windows-latest ]
|
||||
needs: [ Initialization, Build ]
|
||||
if: (!cancelled())
|
||||
runs-on: [ windows-latest ]
|
||||
name: Pull Request Status Check
|
||||
steps:
|
||||
- name: Pull Request Status Check
|
||||
|
|
|
@ -7,10 +7,14 @@ on:
|
|||
description: Template Repository URL (current is {TEMPLATEURL})
|
||||
required: false
|
||||
default: ''
|
||||
downloadLatest:
|
||||
description: Download latest from template repository
|
||||
type: boolean
|
||||
default: true
|
||||
directCommit:
|
||||
description: Direct COMMIT (Y/N)
|
||||
required: false
|
||||
default: 'N'
|
||||
description: Direct Commit?
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
@ -25,8 +29,14 @@ env:
|
|||
|
||||
jobs:
|
||||
UpdateALGoSystemFiles:
|
||||
needs: [ ]
|
||||
runs-on: [ windows-latest ]
|
||||
steps:
|
||||
- name: Dump Workflow Information
|
||||
uses: microsoft/AL-Go-Actions/DumpWorkflowInfo@main
|
||||
with:
|
||||
shell: powershell
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
|
@ -62,27 +72,31 @@ jobs:
|
|||
Add-Content -Encoding UTF8 -Path $env:GITHUB_ENV -Value "templateUrl=$templateUrl"
|
||||
}
|
||||
|
||||
- name: Calculate DirectCommit
|
||||
- name: Calculate Input
|
||||
env:
|
||||
directCommit: ${{ github.event.inputs.directCommit }}
|
||||
directCommit: '${{ github.event.inputs.directCommit }}'
|
||||
downloadLatest: ${{ github.event.inputs.downloadLatest }}
|
||||
eventName: ${{ github.event_name }}
|
||||
run: |
|
||||
$errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0
|
||||
$directCommit = $ENV:directCommit
|
||||
$downloadLatest = $ENV:downloadLatest
|
||||
Write-Host $ENV:eventName
|
||||
if ($ENV:eventName -eq 'schedule') {
|
||||
Write-Host "Running Update AL-Go System Files on a schedule. Setting DirectCommit = Y"
|
||||
$directCommit = 'Y'
|
||||
Write-Host "Running Update AL-Go System Files on a schedule. Setting DirectCommit and DownloadLatest to true"
|
||||
$directCommit = 'true'
|
||||
$downloadLatest = 'true'
|
||||
}
|
||||
Add-Content -Encoding UTF8 -Path $env:GITHUB_ENV -Value "DirectCommit=$directCommit"
|
||||
Add-Content -Encoding UTF8 -Path $env:GITHUB_ENV -Value "directCommit=$directCommit"
|
||||
Add-Content -Encoding UTF8 -Path $env:GITHUB_ENV -Value "downloadLatest=$downloadLatest"
|
||||
|
||||
- name: Update AL-Go system files
|
||||
uses: microsoft/AL-Go-Actions/CheckForUpdates@main
|
||||
with:
|
||||
shell: powershell
|
||||
parentTelemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}
|
||||
token: ${{ fromJson(steps.ReadSecrets.outputs.Secrets).ghTokenWorkflow }}
|
||||
Update: Y
|
||||
downloadLatest: ${{ env.downloadLatest }}
|
||||
update: 'Y'
|
||||
templateUrl: ${{ env.templateUrl }}
|
||||
directCommit: ${{ env.directCommit }}
|
||||
|
||||
|
|
|
@ -43,14 +43,12 @@ on:
|
|||
type: string
|
||||
publishThisBuildArtifacts:
|
||||
description: Flag indicating whether this build artifacts should be published
|
||||
required: false
|
||||
default: false
|
||||
type: boolean
|
||||
default: false
|
||||
publishArtifacts:
|
||||
description: Flag indicating whether the artifacts should be published
|
||||
required: false
|
||||
default: false
|
||||
type: boolean
|
||||
default: false
|
||||
artifactsNameSuffix:
|
||||
description: Suffix to add to the artifacts names
|
||||
required: false
|
||||
|
@ -58,14 +56,12 @@ on:
|
|||
type: string
|
||||
signArtifacts:
|
||||
description: Flag indicating whether the apps should be signed
|
||||
required: false
|
||||
default: false
|
||||
type: boolean
|
||||
default: false
|
||||
useArtifactCache:
|
||||
description: Flag determining whether to use the Artifacts Cache
|
||||
required: false
|
||||
default: false
|
||||
type: boolean
|
||||
default: false
|
||||
parentTelemetryScopeJson:
|
||||
description: Specifies the telemetry scope for the telemetry signal
|
||||
required: false
|
||||
|
@ -77,188 +73,191 @@ env:
|
|||
|
||||
jobs:
|
||||
BuildALGoProject:
|
||||
needs: [ ]
|
||||
runs-on: ${{ fromJson(inputs.runsOn) }}
|
||||
defaults:
|
||||
run:
|
||||
shell: ${{ inputs.shell }}
|
||||
name: ${{ inputs.projectName }} (${{ inputs.buildMode }})
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
ref: ${{ inputs.checkoutRef }}
|
||||
lfs: true
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
ref: ${{ inputs.checkoutRef }}
|
||||
lfs: true
|
||||
|
||||
- name: Read settings
|
||||
uses: microsoft/AL-Go-Actions/ReadSettings@main
|
||||
with:
|
||||
shell: ${{ inputs.shell }}
|
||||
project: ${{ inputs.project }}
|
||||
get: useCompilerFolder,keyVaultCodesignCertificateName,doNotSignApps,doNotRunTests,artifact,generateDependencyArtifact
|
||||
- name: Read settings
|
||||
uses: microsoft/AL-Go-Actions/ReadSettings@main
|
||||
with:
|
||||
shell: ${{ inputs.shell }}
|
||||
project: ${{ inputs.project }}
|
||||
get: useCompilerFolder,keyVaultCodesignCertificateName,doNotSignApps,doNotRunTests,artifact,generateDependencyArtifact
|
||||
|
||||
- name: Read secrets
|
||||
id: ReadSecrets
|
||||
if: github.event_name != 'pull_request'
|
||||
uses: microsoft/AL-Go-Actions/ReadSecrets@main
|
||||
with:
|
||||
shell: ${{ inputs.shell }}
|
||||
gitHubSecrets: ${{ toJson(secrets) }}
|
||||
getSecrets: '${{ inputs.secrets }},appDependencyProbingPathsSecrets'
|
||||
- name: Read secrets
|
||||
id: ReadSecrets
|
||||
if: github.event_name != 'pull_request'
|
||||
uses: microsoft/AL-Go-Actions/ReadSecrets@main
|
||||
with:
|
||||
shell: ${{ inputs.shell }}
|
||||
gitHubSecrets: ${{ toJson(secrets) }}
|
||||
getSecrets: '${{ inputs.secrets }},appDependencyProbingPathsSecrets'
|
||||
|
||||
- name: Determine ArtifactUrl
|
||||
uses: microsoft/AL-Go-Actions/DetermineArtifactUrl@main
|
||||
id: determineArtifactUrl
|
||||
with:
|
||||
shell: ${{ inputs.shell }}
|
||||
parentTelemetryScopeJson: ${{ inputs.parentTelemetryScopeJson }}
|
||||
project: ${{ inputs.project }}
|
||||
- name: Determine ArtifactUrl
|
||||
uses: microsoft/AL-Go-Actions/DetermineArtifactUrl@main
|
||||
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@v3
|
||||
with:
|
||||
path: .artifactcache
|
||||
key: ${{ env.artifactCacheKey }}
|
||||
- name: Cache Business Central Artifacts
|
||||
if: env.useCompilerFolder == 'True' && inputs.useArtifactCache && env.artifactCacheKey
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: .artifactcache
|
||||
key: ${{ env.artifactCacheKey }}
|
||||
|
||||
- name: Download Project Dependencies
|
||||
id: DownloadProjectDependencies
|
||||
uses: microsoft/AL-Go-Actions/DownloadProjectDependencies@main
|
||||
env:
|
||||
Secrets: '${{ steps.ReadSecrets.outputs.Secrets }}'
|
||||
with:
|
||||
shell: ${{ inputs.shell }}
|
||||
project: ${{ inputs.project }}
|
||||
buildMode: ${{ inputs.buildMode }}
|
||||
projectsDependenciesJson: ${{ inputs.projectDependenciesJson }}
|
||||
- name: Download Project Dependencies
|
||||
id: DownloadProjectDependencies
|
||||
uses: microsoft/AL-Go-Actions/DownloadProjectDependencies@main
|
||||
env:
|
||||
Secrets: '${{ steps.ReadSecrets.outputs.Secrets }}'
|
||||
with:
|
||||
shell: ${{ inputs.shell }}
|
||||
project: ${{ inputs.project }}
|
||||
buildMode: ${{ inputs.buildMode }}
|
||||
projectsDependenciesJson: ${{ inputs.projectDependenciesJson }}
|
||||
|
||||
- name: Run pipeline
|
||||
id: RunPipeline
|
||||
uses: microsoft/AL-Go-Actions/RunPipeline@main
|
||||
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 }}
|
||||
installAppsJson: ${{ steps.DownloadProjectDependencies.outputs.DownloadedApps }}
|
||||
installTestAppsJson: ${{ steps.DownloadProjectDependencies.outputs.DownloadedTestApps }}
|
||||
- name: Build
|
||||
uses: microsoft/AL-Go-Actions/RunPipeline@main
|
||||
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 }}
|
||||
installAppsJson: ${{ steps.DownloadProjectDependencies.outputs.DownloadedApps }}
|
||||
installTestAppsJson: ${{ steps.DownloadProjectDependencies.outputs.DownloadedTestApps }}
|
||||
|
||||
- name: Sign
|
||||
if: inputs.signArtifacts && env.doNotSignApps == 'False' && env.keyVaultCodesignCertificateName != ''
|
||||
id: sign
|
||||
uses: microsoft/AL-Go-Actions/Sign@main
|
||||
with:
|
||||
shell: ${{ needs.Initialization.outputs.githubRunnerShell }}
|
||||
azureCredentialsJson: ${{ secrets.AZURE_CREDENTIALS }}
|
||||
pathToFiles: '${{ inputs.project }}/.buildartifacts/Apps/*.app'
|
||||
parentTelemetryScopeJson: ${{ needs.Initialization.outputs.telemetryScopeJson }}
|
||||
- name: Sign
|
||||
if: inputs.signArtifacts && env.doNotSignApps == 'False' && env.keyVaultCodesignCertificateName != ''
|
||||
id: sign
|
||||
uses: microsoft/AL-Go-Actions/Sign@main
|
||||
with:
|
||||
shell: ${{ needs.Initialization.outputs.githubRunnerShell }}
|
||||
azureCredentialsJson: ${{ 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@main
|
||||
if: success() || failure()
|
||||
with:
|
||||
shell: ${{ inputs.shell }}
|
||||
project: ${{ inputs.project }}
|
||||
buildMode: ${{ inputs.buildMode }}
|
||||
suffix: ${{ inputs.artifactsNameSuffix }}
|
||||
- name: Calculate Artifact names
|
||||
id: calculateArtifactsNames
|
||||
uses: microsoft/AL-Go-Actions/CalculateArtifactNames@main
|
||||
if: success() || failure()
|
||||
with:
|
||||
shell: ${{ inputs.shell }}
|
||||
project: ${{ inputs.project }}
|
||||
buildMode: ${{ inputs.buildMode }}
|
||||
suffix: ${{ inputs.artifactsNameSuffix }}
|
||||
|
||||
- name: Upload thisbuild artifacts - apps
|
||||
if: inputs.publishThisBuildArtifacts
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{ steps.calculateArtifactsNames.outputs.ThisBuildAppsArtifactsName }}
|
||||
path: '${{ inputs.project }}/.buildartifacts/Apps/'
|
||||
if-no-files-found: ignore
|
||||
retention-days: 1
|
||||
- name: Upload thisbuild artifacts - apps
|
||||
if: inputs.publishThisBuildArtifacts
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{ steps.calculateArtifactsNames.outputs.ThisBuildAppsArtifactsName }}
|
||||
path: '${{ inputs.project }}/.buildartifacts/Apps/'
|
||||
if-no-files-found: ignore
|
||||
retention-days: 1
|
||||
|
||||
- name: Upload thisbuild artifacts - dependencies
|
||||
if: inputs.publishThisBuildArtifacts
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{ steps.calculateArtifactsNames.outputs.ThisBuildDependenciesArtifactsName }}
|
||||
path: '${{ inputs.project }}/.buildartifacts/Dependencies/'
|
||||
if-no-files-found: ignore
|
||||
retention-days: 1
|
||||
- name: Upload thisbuild artifacts - dependencies
|
||||
if: inputs.publishThisBuildArtifacts
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{ steps.calculateArtifactsNames.outputs.ThisBuildDependenciesArtifactsName }}
|
||||
path: '${{ inputs.project }}/.buildartifacts/Dependencies/'
|
||||
if-no-files-found: ignore
|
||||
retention-days: 1
|
||||
|
||||
- name: Upload thisbuild artifacts - test apps
|
||||
if: inputs.publishThisBuildArtifacts
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{ steps.calculateArtifactsNames.outputs.ThisBuildTestAppsArtifactsName }}
|
||||
path: '${{ inputs.project }}/.buildartifacts/TestApps/'
|
||||
if-no-files-found: ignore
|
||||
retention-days: 1
|
||||
- name: Upload thisbuild artifacts - test apps
|
||||
if: inputs.publishThisBuildArtifacts
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{ steps.calculateArtifactsNames.outputs.ThisBuildTestAppsArtifactsName }}
|
||||
path: '${{ inputs.project }}/.buildartifacts/TestApps/'
|
||||
if-no-files-found: ignore
|
||||
retention-days: 1
|
||||
|
||||
- name: Publish artifacts - apps
|
||||
uses: actions/upload-artifact@v3
|
||||
if: inputs.publishArtifacts
|
||||
with:
|
||||
name: ${{ steps.calculateArtifactsNames.outputs.AppsArtifactsName }}
|
||||
path: '${{ inputs.project }}/.buildartifacts/Apps/'
|
||||
if-no-files-found: ignore
|
||||
- name: Publish artifacts - apps
|
||||
uses: actions/upload-artifact@v3
|
||||
if: inputs.publishArtifacts
|
||||
with:
|
||||
name: ${{ steps.calculateArtifactsNames.outputs.AppsArtifactsName }}
|
||||
path: '${{ inputs.project }}/.buildartifacts/Apps/'
|
||||
if-no-files-found: ignore
|
||||
|
||||
- name: Publish artifacts - dependencies
|
||||
uses: actions/upload-artifact@v3
|
||||
if: inputs.publishArtifacts && env.generateDependencyArtifact == 'True'
|
||||
with:
|
||||
name: ${{ steps.calculateArtifactsNames.outputs.DependenciesArtifactsName }}
|
||||
path: '${{ inputs.project }}/.buildartifacts/Dependencies/'
|
||||
if-no-files-found: ignore
|
||||
- name: Publish artifacts - dependencies
|
||||
uses: actions/upload-artifact@v3
|
||||
if: inputs.publishArtifacts && env.generateDependencyArtifact == 'True'
|
||||
with:
|
||||
name: ${{ steps.calculateArtifactsNames.outputs.DependenciesArtifactsName }}
|
||||
path: '${{ inputs.project }}/.buildartifacts/Dependencies/'
|
||||
if-no-files-found: ignore
|
||||
|
||||
- name: Publish artifacts - test apps
|
||||
uses: actions/upload-artifact@v3
|
||||
if: inputs.publishArtifacts
|
||||
with:
|
||||
name: ${{ steps.calculateArtifactsNames.outputs.TestAppsArtifactsName }}
|
||||
path: '${{ inputs.project }}/.buildartifacts/TestApps/'
|
||||
if-no-files-found: ignore
|
||||
- name: Publish artifacts - test apps
|
||||
uses: actions/upload-artifact@v3
|
||||
if: inputs.publishArtifacts
|
||||
with:
|
||||
name: ${{ steps.calculateArtifactsNames.outputs.TestAppsArtifactsName }}
|
||||
path: '${{ inputs.project }}/.buildartifacts/TestApps/'
|
||||
if-no-files-found: ignore
|
||||
|
||||
- name: Publish artifacts - build output
|
||||
uses: actions/upload-artifact@v3
|
||||
if: (success() || failure()) && (hashFiles(format('{0}/BuildOutput.txt',inputs.project)) != '')
|
||||
with:
|
||||
name: ${{ steps.calculateArtifactsNames.outputs.BuildOutputArtifactsName }}
|
||||
path: '${{ inputs.project }}/BuildOutput.txt'
|
||||
if-no-files-found: ignore
|
||||
- name: Publish artifacts - build output
|
||||
uses: actions/upload-artifact@v3
|
||||
if: (success() || failure()) && (hashFiles(format('{0}/BuildOutput.txt',inputs.project)) != '')
|
||||
with:
|
||||
name: ${{ steps.calculateArtifactsNames.outputs.BuildOutputArtifactsName }}
|
||||
path: '${{ inputs.project }}/BuildOutput.txt'
|
||||
if-no-files-found: ignore
|
||||
|
||||
- name: Publish artifacts - container event log
|
||||
uses: actions/upload-artifact@v3
|
||||
if: (failure()) && (hashFiles(format('{0}/ContainerEventLog.evtx',inputs.project)) != '')
|
||||
with:
|
||||
name: ${{ steps.calculateArtifactsNames.outputs.ContainerEventLogArtifactsName }}
|
||||
path: '${{ inputs.project }}/ContainerEventLog.evtx'
|
||||
if-no-files-found: ignore
|
||||
- name: Publish artifacts - container event log
|
||||
uses: actions/upload-artifact@v3
|
||||
if: (failure()) && (hashFiles(format('{0}/ContainerEventLog.evtx',inputs.project)) != '')
|
||||
with:
|
||||
name: ${{ steps.calculateArtifactsNames.outputs.ContainerEventLogArtifactsName }}
|
||||
path: '${{ inputs.project }}/ContainerEventLog.evtx'
|
||||
if-no-files-found: ignore
|
||||
|
||||
- name: Publish artifacts - test results
|
||||
uses: actions/upload-artifact@v3
|
||||
if: (success() || failure()) && (hashFiles(format('{0}/TestResults.xml',inputs.project)) != '')
|
||||
with:
|
||||
name: ${{ steps.calculateArtifactsNames.outputs.TestResultsArtifactsName }}
|
||||
path: '${{ inputs.project }}/TestResults.xml'
|
||||
if-no-files-found: ignore
|
||||
- name: Publish artifacts - test results
|
||||
uses: actions/upload-artifact@v3
|
||||
if: (success() || failure()) && (hashFiles(format('{0}/TestResults.xml',inputs.project)) != '')
|
||||
with:
|
||||
name: ${{ steps.calculateArtifactsNames.outputs.TestResultsArtifactsName }}
|
||||
path: '${{ inputs.project }}/TestResults.xml'
|
||||
if-no-files-found: ignore
|
||||
|
||||
- name: Publish artifacts - bcpt test results
|
||||
uses: actions/upload-artifact@v3
|
||||
if: (success() || failure()) && (hashFiles(format('{0}/bcptTestResults.json',inputs.project)) != '')
|
||||
with:
|
||||
name: ${{ steps.calculateArtifactsNames.outputs.BcptTestResultsArtifactsName }}
|
||||
path: '${{ inputs.project }}/bcptTestResults.json'
|
||||
if-no-files-found: ignore
|
||||
- name: Publish artifacts - bcpt test results
|
||||
uses: actions/upload-artifact@v3
|
||||
if: (success() || failure()) && (hashFiles(format('{0}/bcptTestResults.json',inputs.project)) != '')
|
||||
with:
|
||||
name: ${{ steps.calculateArtifactsNames.outputs.BcptTestResultsArtifactsName }}
|
||||
path: '${{ inputs.project }}/bcptTestResults.json'
|
||||
if-no-files-found: ignore
|
||||
|
||||
- name: Analyze Test Results
|
||||
id: analyzeTestResults
|
||||
if: (success() || failure()) && env.doNotRunTests == 'False'
|
||||
uses: microsoft/AL-Go-Actions/AnalyzeTests@main
|
||||
with:
|
||||
shell: ${{ inputs.shell }}
|
||||
parentTelemetryScopeJson: ${{ inputs.parentTelemetryScopeJson }}
|
||||
project: ${{ inputs.project }}
|
||||
- name: Analyze Test Results
|
||||
id: analyzeTestResults
|
||||
if: (success() || failure()) && env.doNotRunTests == 'False'
|
||||
uses: microsoft/AL-Go-Actions/AnalyzeTests@main
|
||||
with:
|
||||
shell: ${{ inputs.shell }}
|
||||
parentTelemetryScopeJson: ${{ inputs.parentTelemetryScopeJson }}
|
||||
project: ${{ inputs.project }}
|
||||
|
||||
- name: Cleanup
|
||||
if: always()
|
||||
uses: microsoft/AL-Go-Actions/PipelineCleanup@main
|
||||
with:
|
||||
shell: ${{ inputs.shell }}
|
||||
parentTelemetryScopeJson: ${{ inputs.parentTelemetryScopeJson }}
|
||||
project: ${{ inputs.project }}
|
||||
- name: Cleanup
|
||||
if: always()
|
||||
uses: microsoft/AL-Go-Actions/PipelineCleanup@main
|
||||
with:
|
||||
shell: ${{ inputs.shell }}
|
||||
parentTelemetryScopeJson: ${{ inputs.parentTelemetryScopeJson }}
|
||||
project: ${{ inputs.project }}
|
||||
|
|
|
@ -13,12 +13,13 @@ on:
|
|||
description: Direct Download Url of .app or .zip file
|
||||
required: true
|
||||
directCommit:
|
||||
description: Direct COMMIT (Y/N)
|
||||
required: false
|
||||
default: 'N'
|
||||
useGhTokenWorkflow:
|
||||
description: Use GhTokenWorkflow for Pull Request/COMMIT
|
||||
description: Direct Commit?
|
||||
type: boolean
|
||||
default: false
|
||||
useGhTokenWorkflow:
|
||||
description: Use GhTokenWorkflow for PR/Commit?
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
@ -34,8 +35,14 @@ env:
|
|||
|
||||
jobs:
|
||||
AddExistingAppOrTestApp:
|
||||
needs: [ ]
|
||||
runs-on: [ windows-latest ]
|
||||
steps:
|
||||
- name: Dump Workflow Information
|
||||
uses: microsoft/AL-Go-Actions/DumpWorkflowInfo@main
|
||||
with:
|
||||
shell: powershell
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@ env:
|
|||
|
||||
jobs:
|
||||
Initialization:
|
||||
needs: [ ]
|
||||
runs-on: [ windows-latest ]
|
||||
outputs:
|
||||
telemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}
|
||||
|
@ -38,6 +39,11 @@ jobs:
|
|||
buildOrderJson: ${{ steps.determineProjectsToBuild.outputs.BuildOrderJson }}
|
||||
workflowDepth: ${{ steps.DetermineWorkflowDepth.outputs.WorkflowDepth }}
|
||||
steps:
|
||||
- name: Dump Workflow Information
|
||||
uses: microsoft/AL-Go-Actions/DumpWorkflowInfo@main
|
||||
with:
|
||||
shell: powershell
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
|
@ -75,7 +81,7 @@ jobs:
|
|||
with:
|
||||
shell: powershell
|
||||
projectsJson: '${{ steps.determineProjectsToBuild.outputs.ProjectsJson }}'
|
||||
checkContextSecrets: 'N'
|
||||
checkContextSecrets: 'false'
|
||||
|
||||
- name: Read secrets
|
||||
id: ReadSecrets
|
||||
|
@ -93,7 +99,7 @@ jobs:
|
|||
with:
|
||||
shell: powershell
|
||||
projectsJson: '${{ steps.determineProjectsToBuild.outputs.ProjectsJson }}'
|
||||
checkContextSecrets: 'Y'
|
||||
checkContextSecrets: 'true'
|
||||
|
||||
- name: Determine Deployment Environments
|
||||
id: DetermineDeploymentEnvironments
|
||||
|
@ -106,8 +112,8 @@ jobs:
|
|||
type: 'CD'
|
||||
|
||||
CheckForUpdates:
|
||||
runs-on: [ windows-latest ]
|
||||
needs: [ Initialization ]
|
||||
runs-on: [ windows-latest ]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
@ -122,8 +128,8 @@ jobs:
|
|||
uses: microsoft/AL-Go-Actions/CheckForUpdates@main
|
||||
with:
|
||||
shell: powershell
|
||||
parentTelemetryScopeJson: ${{ needs.Initialization.outputs.telemetryScopeJson }}
|
||||
templateUrl: ${{ env.templateUrl }}
|
||||
downloadLatest: true
|
||||
|
||||
Build:
|
||||
needs: [ Initialization ]
|
||||
|
@ -242,9 +248,9 @@ jobs:
|
|||
artifacts: '.artifacts'
|
||||
|
||||
PostProcess:
|
||||
needs: [ Initialization, Build, Deploy, Deliver ]
|
||||
if: (!cancelled())
|
||||
runs-on: [ windows-latest ]
|
||||
needs: [ Initialization, Build, Deploy, Deliver ]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
|
|
@ -19,16 +19,17 @@ on:
|
|||
description: ID range (from..to)
|
||||
required: true
|
||||
sampleCode:
|
||||
description: Include Sample code (Y/N)
|
||||
required: false
|
||||
default: 'Y'
|
||||
directCommit:
|
||||
description: Direct COMMIT (Y/N)
|
||||
required: false
|
||||
default: "N"
|
||||
useGhTokenWorkflow:
|
||||
description: Use GhTokenWorkflow for Pull Request/COMMIT
|
||||
description: Include Sample code?
|
||||
type: boolean
|
||||
default: true
|
||||
directCommit:
|
||||
description: Direct Commit?
|
||||
type: boolean
|
||||
default: false
|
||||
useGhTokenWorkflow:
|
||||
description: Use GhTokenWorkflow for PR/Commit?
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
@ -44,8 +45,14 @@ env:
|
|||
|
||||
jobs:
|
||||
CreateApp:
|
||||
needs: [ ]
|
||||
runs-on: [ windows-latest ]
|
||||
steps:
|
||||
- name: Dump Workflow Information
|
||||
uses: microsoft/AL-Go-Actions/DumpWorkflowInfo@main
|
||||
with:
|
||||
shell: powershell
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
|
|
|
@ -13,16 +13,17 @@ on:
|
|||
description: Name of the online environment
|
||||
required: true
|
||||
reUseExistingEnvironment:
|
||||
description: Reuse environment if it exists
|
||||
required: false
|
||||
default: 'N'
|
||||
directCommit:
|
||||
description: Direct COMMIT (Y/N)
|
||||
required: false
|
||||
default: 'N'
|
||||
useGhTokenWorkflow:
|
||||
description: Use GhTokenWorkflow for Pull Request/COMMIT
|
||||
description: Reuse environment if it exists?
|
||||
type: boolean
|
||||
default: false
|
||||
directCommit:
|
||||
description: Direct Commit?
|
||||
type: boolean
|
||||
default: false
|
||||
useGhTokenWorkflow:
|
||||
description: Use GhTokenWorkflow for PR/Commit?
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
@ -38,6 +39,7 @@ env:
|
|||
|
||||
jobs:
|
||||
Initialization:
|
||||
needs: [ ]
|
||||
runs-on: [ windows-latest ]
|
||||
outputs:
|
||||
deviceCode: ${{ steps.authenticate.outputs.deviceCode }}
|
||||
|
@ -45,6 +47,11 @@ jobs:
|
|||
githubRunner: ${{ steps.ReadSettings.outputs.GitHubRunnerJson }}
|
||||
githubRunnerShell: ${{ steps.ReadSettings.outputs.GitHubRunnerShell }}
|
||||
steps:
|
||||
- name: Dump Workflow Information
|
||||
uses: microsoft/AL-Go-Actions/DumpWorkflowInfo@main
|
||||
with:
|
||||
shell: powershell
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
|
@ -91,12 +98,12 @@ jobs:
|
|||
}
|
||||
|
||||
CreateDevelopmentEnvironment:
|
||||
needs: [ Initialization ]
|
||||
runs-on: ${{ fromJson(needs.Initialization.outputs.githubRunner) }}
|
||||
defaults:
|
||||
run:
|
||||
shell: ${{ needs.Initialization.outputs.githubRunnerShell }}
|
||||
name: Create Development Environment
|
||||
needs: [ Initialization ]
|
||||
env:
|
||||
deviceCode: ${{ needs.Initialization.outputs.deviceCode }}
|
||||
steps:
|
||||
|
|
|
@ -21,20 +21,21 @@ on:
|
|||
required: true
|
||||
default: '50000..99999'
|
||||
sampleCode:
|
||||
description: Include Sample code (Y/N)
|
||||
required: false
|
||||
default: 'Y'
|
||||
sampleSuite:
|
||||
description: Include Sample BCPT Suite (Y/N)
|
||||
required: false
|
||||
default: 'Y'
|
||||
directCommit:
|
||||
description: Direct COMMIT (Y/N)
|
||||
required: false
|
||||
default: 'N'
|
||||
useGhTokenWorkflow:
|
||||
description: Use GhTokenWorkflow for Pull Request/COMMIT
|
||||
description: Include Sample code?
|
||||
type: boolean
|
||||
default: true
|
||||
sampleSuite:
|
||||
description: Include Sample BCPT Suite?
|
||||
type: boolean
|
||||
default: true
|
||||
directCommit:
|
||||
description: Direct Commit?
|
||||
type: boolean
|
||||
default: false
|
||||
useGhTokenWorkflow:
|
||||
description: Use GhTokenWorkflow for PR/Commit?
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
@ -50,8 +51,14 @@ env:
|
|||
|
||||
jobs:
|
||||
CreatePerformanceTestApp:
|
||||
needs: [ ]
|
||||
runs-on: [ windows-latest ]
|
||||
steps:
|
||||
- name: Dump Workflow Information
|
||||
uses: microsoft/AL-Go-Actions/DumpWorkflowInfo@main
|
||||
with:
|
||||
shell: powershell
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
|
|
|
@ -16,28 +16,29 @@ on:
|
|||
required: true
|
||||
default: ''
|
||||
prerelease:
|
||||
description: Prerelease (Y/N)
|
||||
required: false
|
||||
default: 'N'
|
||||
description: Prerelease?
|
||||
type: boolean
|
||||
default: false
|
||||
draft:
|
||||
description: Draft (Y/N)
|
||||
required: false
|
||||
default: 'N'
|
||||
description: Draft?
|
||||
type: boolean
|
||||
default: false
|
||||
createReleaseBranch:
|
||||
description: Create Release Branch (Y/N)
|
||||
required: false
|
||||
default: 'N'
|
||||
description: Create Release Branch?
|
||||
type: boolean
|
||||
default: false
|
||||
updateVersionNumber:
|
||||
description: New Version Number in main branch. Use Major.Minor for absolute change, use +Major.Minor for incremental change.
|
||||
required: false
|
||||
default: ''
|
||||
directCommit:
|
||||
description: Direct COMMIT (Y/N)
|
||||
required: false
|
||||
default: 'N'
|
||||
useGhTokenWorkflow:
|
||||
description: Use GhTokenWorkflow for Pull Request/COMMIT
|
||||
description: Direct Commit?
|
||||
type: boolean
|
||||
default: false
|
||||
useGhTokenWorkflow:
|
||||
description: Use GhTokenWorkflow for PR/Commit?
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
@ -56,6 +57,7 @@ env:
|
|||
|
||||
jobs:
|
||||
CreateRelease:
|
||||
needs: [ ]
|
||||
runs-on: [ windows-latest ]
|
||||
outputs:
|
||||
telemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}
|
||||
|
@ -64,6 +66,11 @@ jobs:
|
|||
commitish: ${{ steps.analyzeartifacts.outputs.commitish }}
|
||||
releaseBranch: ${{ steps.createreleasenotes.outputs.releaseBranch }}
|
||||
steps:
|
||||
- name: Dump Workflow Information
|
||||
uses: microsoft/AL-Go-Actions/DumpWorkflowInfo@main
|
||||
with:
|
||||
shell: powershell
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
|
@ -91,8 +98,8 @@ jobs:
|
|||
uses: microsoft/AL-Go-Actions/CheckForUpdates@main
|
||||
with:
|
||||
shell: powershell
|
||||
parentTelemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}
|
||||
templateUrl: ${{ env.templateUrl }}
|
||||
downloadLatest: true
|
||||
|
||||
- name: Analyze Artifacts
|
||||
id: analyzeartifacts
|
||||
|
@ -195,8 +202,8 @@ jobs:
|
|||
tag_name: '${{ github.event.inputs.tag }}',
|
||||
name: '${{ github.event.inputs.name }}',
|
||||
body: bodyMD.replaceAll('\\n','\n').replaceAll('%0A','\n').replaceAll('%0D','\n').replaceAll('%25','%'),
|
||||
draft: ${{ github.event.inputs.draft=='Y' }},
|
||||
prerelease: ${{ github.event.inputs.prerelease=='Y' }},
|
||||
draft: ${{ github.event.inputs.draft=='true' }},
|
||||
prerelease: ${{ github.event.inputs.prerelease=='true' }},
|
||||
make_latest: 'legacy',
|
||||
target_commitish: '${{ steps.analyzeartifacts.outputs.commitish }}'
|
||||
});
|
||||
|
@ -206,8 +213,8 @@ jobs:
|
|||
core.setOutput('releaseId', releaseId);
|
||||
|
||||
UploadArtifacts:
|
||||
runs-on: [ windows-latest ]
|
||||
needs: [ CreateRelease ]
|
||||
runs-on: [ windows-latest ]
|
||||
strategy:
|
||||
matrix: ${{ fromJson(needs.CreateRelease.outputs.artifacts) }}
|
||||
fail-fast: true
|
||||
|
@ -285,9 +292,9 @@ jobs:
|
|||
atypes: 'Apps,TestApps,Dependencies'
|
||||
|
||||
CreateReleaseBranch:
|
||||
if: ${{ github.event.inputs.createReleaseBranch=='Y' }}
|
||||
runs-on: [ windows-latest ]
|
||||
needs: [ CreateRelease, UploadArtifacts ]
|
||||
if: ${{ github.event.inputs.createReleaseBranch=='true' }}
|
||||
runs-on: [ windows-latest ]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
@ -304,9 +311,9 @@ jobs:
|
|||
git push origin ${{ needs.CreateRelease.outputs.releaseBranch }}
|
||||
|
||||
UpdateVersionNumber:
|
||||
needs: [ CreateRelease, UploadArtifacts ]
|
||||
if: ${{ github.event.inputs.updateVersionNumber!='' }}
|
||||
runs-on: [ windows-latest ]
|
||||
needs: [ CreateRelease, UploadArtifacts ]
|
||||
steps:
|
||||
- name: Read settings
|
||||
uses: microsoft/AL-Go-Actions/ReadSettings@main
|
||||
|
@ -332,9 +339,9 @@ jobs:
|
|||
directCommit: ${{ github.event.inputs.directCommit }}
|
||||
|
||||
PostProcess:
|
||||
needs: [ CreateRelease, UploadArtifacts, CreateReleaseBranch, UpdateVersionNumber ]
|
||||
if: always()
|
||||
runs-on: [ windows-latest ]
|
||||
needs: [ CreateRelease, UploadArtifacts, CreateReleaseBranch, UpdateVersionNumber ]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
|
|
@ -21,16 +21,17 @@ on:
|
|||
required: true
|
||||
default: '50000..99999'
|
||||
sampleCode:
|
||||
description: Include Sample code (Y/N)
|
||||
required: false
|
||||
default: 'Y'
|
||||
directCommit:
|
||||
description: Direct COMMIT (Y/N)
|
||||
required: false
|
||||
default: 'N'
|
||||
useGhTokenWorkflow:
|
||||
description: Use GhTokenWorkflow for Pull Request/COMMIT
|
||||
description: Include Sample code?
|
||||
type: boolean
|
||||
default: true
|
||||
directCommit:
|
||||
description: Direct Commit?
|
||||
type: boolean
|
||||
default: false
|
||||
useGhTokenWorkflow:
|
||||
description: Use GhTokenWorkflow for PR/Commit?
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
@ -46,8 +47,14 @@ env:
|
|||
|
||||
jobs:
|
||||
CreateTestApp:
|
||||
needs: [ ]
|
||||
runs-on: [ windows-latest ]
|
||||
steps:
|
||||
- name: Dump Workflow Information
|
||||
uses: microsoft/AL-Go-Actions/DumpWorkflowInfo@main
|
||||
with:
|
||||
shell: powershell
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ env:
|
|||
|
||||
jobs:
|
||||
Initialization:
|
||||
needs: [ ]
|
||||
runs-on: [ windows-latest ]
|
||||
outputs:
|
||||
telemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}
|
||||
|
@ -27,6 +28,11 @@ jobs:
|
|||
buildOrderJson: ${{ steps.determineProjectsToBuild.outputs.BuildOrderJson }}
|
||||
workflowDepth: ${{ steps.DetermineWorkflowDepth.outputs.WorkflowDepth }}
|
||||
steps:
|
||||
- name: Dump Workflow Information
|
||||
uses: microsoft/AL-Go-Actions/DumpWorkflowInfo@main
|
||||
with:
|
||||
shell: powershell
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
|
@ -80,9 +86,9 @@ jobs:
|
|||
artifactsNameSuffix: 'Current'
|
||||
|
||||
PostProcess:
|
||||
needs: [ Initialization, Build ]
|
||||
if: always()
|
||||
runs-on: [ windows-latest ]
|
||||
needs: [ Initialization, Build ]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
|
|
@ -5,20 +5,21 @@ run-name: "Increment Version Number in [${{ github.ref_name }}]"
|
|||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
project:
|
||||
description: Project name if the repository is setup for multiple projects (* for all projects)
|
||||
projects:
|
||||
description: Comma-separated list of project name patterns if the repository is setup for multiple projects (default is * for all projects)
|
||||
required: false
|
||||
default: '*'
|
||||
versionNumber:
|
||||
description: Updated Version Number. Use Major.Minor for absolute change, use +Major.Minor for incremental change.
|
||||
required: true
|
||||
directCommit:
|
||||
description: Direct COMMIT (Y/N)
|
||||
required: false
|
||||
default: 'N'
|
||||
useGhTokenWorkflow:
|
||||
description: Use GhTokenWorkflow for Pull Request/COMMIT
|
||||
description: Direct Commit?
|
||||
type: boolean
|
||||
default: false
|
||||
useGhTokenWorkflow:
|
||||
description: Use GhTokenWorkflow for PR/Commit?
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
@ -34,8 +35,14 @@ env:
|
|||
|
||||
jobs:
|
||||
IncrementVersionNumber:
|
||||
needs: [ ]
|
||||
runs-on: [ windows-latest ]
|
||||
steps:
|
||||
- name: Dump Workflow Information
|
||||
uses: microsoft/AL-Go-Actions/DumpWorkflowInfo@main
|
||||
with:
|
||||
shell: powershell
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
|
@ -66,7 +73,7 @@ jobs:
|
|||
shell: powershell
|
||||
token: ${{ steps.ReadSecrets.outputs.TokenForPush }}
|
||||
parentTelemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}
|
||||
project: ${{ github.event.inputs.project }}
|
||||
projects: ${{ github.event.inputs.projects }}
|
||||
versionNumber: ${{ github.event.inputs.versionNumber }}
|
||||
directCommit: ${{ github.event.inputs.directCommit }}
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ env:
|
|||
|
||||
jobs:
|
||||
Initialization:
|
||||
needs: [ ]
|
||||
runs-on: [ windows-latest ]
|
||||
outputs:
|
||||
telemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}
|
||||
|
@ -27,6 +28,11 @@ jobs:
|
|||
buildOrderJson: ${{ steps.determineProjectsToBuild.outputs.BuildOrderJson }}
|
||||
workflowDepth: ${{ steps.DetermineWorkflowDepth.outputs.WorkflowDepth }}
|
||||
steps:
|
||||
- name: Dump Workflow Information
|
||||
uses: microsoft/AL-Go-Actions/DumpWorkflowInfo@main
|
||||
with:
|
||||
shell: powershell
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
|
@ -80,9 +86,9 @@ jobs:
|
|||
artifactsNameSuffix: 'NextMajor'
|
||||
|
||||
PostProcess:
|
||||
needs: [ Initialization, Build ]
|
||||
if: always()
|
||||
runs-on: [ windows-latest ]
|
||||
needs: [ Initialization, Build ]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
|
|
@ -17,6 +17,7 @@ env:
|
|||
|
||||
jobs:
|
||||
Initialization:
|
||||
needs: [ ]
|
||||
runs-on: [ windows-latest ]
|
||||
outputs:
|
||||
telemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}
|
||||
|
@ -27,6 +28,11 @@ jobs:
|
|||
buildOrderJson: ${{ steps.determineProjectsToBuild.outputs.BuildOrderJson }}
|
||||
workflowDepth: ${{ steps.DetermineWorkflowDepth.outputs.WorkflowDepth }}
|
||||
steps:
|
||||
- name: Dump Workflow Information
|
||||
uses: microsoft/AL-Go-Actions/DumpWorkflowInfo@main
|
||||
with:
|
||||
shell: powershell
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
|
@ -80,9 +86,9 @@ jobs:
|
|||
artifactsNameSuffix: 'NextMinor'
|
||||
|
||||
PostProcess:
|
||||
needs: [ Initialization, Build ]
|
||||
if: always()
|
||||
runs-on: [ windows-latest ]
|
||||
needs: [ Initialization, Build ]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
|
|
@ -25,6 +25,7 @@ env:
|
|||
|
||||
jobs:
|
||||
Initialization:
|
||||
needs: [ ]
|
||||
runs-on: [ windows-latest ]
|
||||
outputs:
|
||||
telemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}
|
||||
|
@ -33,6 +34,11 @@ jobs:
|
|||
deploymentEnvironmentsJson: ${{ steps.DetermineDeploymentEnvironments.outputs.DeploymentEnvironmentsJson }}
|
||||
deviceCode: ${{ steps.Authenticate.outputs.deviceCode }}
|
||||
steps:
|
||||
- name: Dump Workflow Information
|
||||
uses: microsoft/AL-Go-Actions/DumpWorkflowInfo@main
|
||||
with:
|
||||
shell: powershell
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
|
@ -157,9 +163,9 @@ jobs:
|
|||
deploymentEnvironmentsJson: ${{ needs.Initialization.outputs.deploymentEnvironmentsJson }}
|
||||
|
||||
PostProcess:
|
||||
needs: [ Initialization, Deploy ]
|
||||
if: always()
|
||||
runs-on: [ windows-latest ]
|
||||
needs: [ Initialization, Deploy ]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
|
|
@ -42,6 +42,11 @@ jobs:
|
|||
buildOrderJson: ${{ steps.determineProjectsToBuild.outputs.BuildOrderJson }}
|
||||
workflowDepth: ${{ steps.DetermineWorkflowDepth.outputs.WorkflowDepth }}
|
||||
steps:
|
||||
- name: Dump Workflow Information
|
||||
uses: microsoft/AL-Go-Actions/DumpWorkflowInfo@main
|
||||
with:
|
||||
shell: powershell
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
|
@ -97,9 +102,9 @@ jobs:
|
|||
artifactsNameSuffix: 'PR${{ github.event.number }}'
|
||||
|
||||
StatusCheck:
|
||||
runs-on: [ windows-latest ]
|
||||
needs: [ Initialization, Build ]
|
||||
if: (!cancelled())
|
||||
runs-on: [ windows-latest ]
|
||||
name: Pull Request Status Check
|
||||
steps:
|
||||
- name: Pull Request Status Check
|
||||
|
|
|
@ -7,10 +7,14 @@ on:
|
|||
description: Template Repository URL (current is {TEMPLATEURL})
|
||||
required: false
|
||||
default: ''
|
||||
downloadLatest:
|
||||
description: Download latest from template repository
|
||||
type: boolean
|
||||
default: true
|
||||
directCommit:
|
||||
description: Direct COMMIT (Y/N)
|
||||
required: false
|
||||
default: 'N'
|
||||
description: Direct Commit?
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
@ -25,8 +29,14 @@ env:
|
|||
|
||||
jobs:
|
||||
UpdateALGoSystemFiles:
|
||||
needs: [ ]
|
||||
runs-on: [ windows-latest ]
|
||||
steps:
|
||||
- name: Dump Workflow Information
|
||||
uses: microsoft/AL-Go-Actions/DumpWorkflowInfo@main
|
||||
with:
|
||||
shell: powershell
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
|
@ -62,27 +72,31 @@ jobs:
|
|||
Add-Content -Encoding UTF8 -Path $env:GITHUB_ENV -Value "templateUrl=$templateUrl"
|
||||
}
|
||||
|
||||
- name: Calculate DirectCommit
|
||||
- name: Calculate Input
|
||||
env:
|
||||
directCommit: ${{ github.event.inputs.directCommit }}
|
||||
directCommit: '${{ github.event.inputs.directCommit }}'
|
||||
downloadLatest: ${{ github.event.inputs.downloadLatest }}
|
||||
eventName: ${{ github.event_name }}
|
||||
run: |
|
||||
$errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0
|
||||
$directCommit = $ENV:directCommit
|
||||
$downloadLatest = $ENV:downloadLatest
|
||||
Write-Host $ENV:eventName
|
||||
if ($ENV:eventName -eq 'schedule') {
|
||||
Write-Host "Running Update AL-Go System Files on a schedule. Setting DirectCommit = Y"
|
||||
$directCommit = 'Y'
|
||||
Write-Host "Running Update AL-Go System Files on a schedule. Setting DirectCommit and DownloadLatest to true"
|
||||
$directCommit = 'true'
|
||||
$downloadLatest = 'true'
|
||||
}
|
||||
Add-Content -Encoding UTF8 -Path $env:GITHUB_ENV -Value "DirectCommit=$directCommit"
|
||||
Add-Content -Encoding UTF8 -Path $env:GITHUB_ENV -Value "directCommit=$directCommit"
|
||||
Add-Content -Encoding UTF8 -Path $env:GITHUB_ENV -Value "downloadLatest=$downloadLatest"
|
||||
|
||||
- name: Update AL-Go system files
|
||||
uses: microsoft/AL-Go-Actions/CheckForUpdates@main
|
||||
with:
|
||||
shell: powershell
|
||||
parentTelemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}
|
||||
token: ${{ fromJson(steps.ReadSecrets.outputs.Secrets).ghTokenWorkflow }}
|
||||
Update: Y
|
||||
downloadLatest: ${{ env.downloadLatest }}
|
||||
update: 'Y'
|
||||
templateUrl: ${{ env.templateUrl }}
|
||||
directCommit: ${{ env.directCommit }}
|
||||
|
||||
|
|
|
@ -43,14 +43,12 @@ on:
|
|||
type: string
|
||||
publishThisBuildArtifacts:
|
||||
description: Flag indicating whether this build artifacts should be published
|
||||
required: false
|
||||
default: false
|
||||
type: boolean
|
||||
default: false
|
||||
publishArtifacts:
|
||||
description: Flag indicating whether the artifacts should be published
|
||||
required: false
|
||||
default: false
|
||||
type: boolean
|
||||
default: false
|
||||
artifactsNameSuffix:
|
||||
description: Suffix to add to the artifacts names
|
||||
required: false
|
||||
|
@ -58,14 +56,12 @@ on:
|
|||
type: string
|
||||
signArtifacts:
|
||||
description: Flag indicating whether the apps should be signed
|
||||
required: false
|
||||
default: false
|
||||
type: boolean
|
||||
default: false
|
||||
useArtifactCache:
|
||||
description: Flag determining whether to use the Artifacts Cache
|
||||
required: false
|
||||
default: false
|
||||
type: boolean
|
||||
default: false
|
||||
parentTelemetryScopeJson:
|
||||
description: Specifies the telemetry scope for the telemetry signal
|
||||
required: false
|
||||
|
@ -77,188 +73,191 @@ env:
|
|||
|
||||
jobs:
|
||||
BuildALGoProject:
|
||||
needs: [ ]
|
||||
runs-on: ${{ fromJson(inputs.runsOn) }}
|
||||
defaults:
|
||||
run:
|
||||
shell: ${{ inputs.shell }}
|
||||
name: ${{ inputs.projectName }} (${{ inputs.buildMode }})
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
ref: ${{ inputs.checkoutRef }}
|
||||
lfs: true
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
ref: ${{ inputs.checkoutRef }}
|
||||
lfs: true
|
||||
|
||||
- name: Read settings
|
||||
uses: microsoft/AL-Go-Actions/ReadSettings@main
|
||||
with:
|
||||
shell: ${{ inputs.shell }}
|
||||
project: ${{ inputs.project }}
|
||||
get: useCompilerFolder,keyVaultCodesignCertificateName,doNotSignApps,doNotRunTests,artifact,generateDependencyArtifact
|
||||
- name: Read settings
|
||||
uses: microsoft/AL-Go-Actions/ReadSettings@main
|
||||
with:
|
||||
shell: ${{ inputs.shell }}
|
||||
project: ${{ inputs.project }}
|
||||
get: useCompilerFolder,keyVaultCodesignCertificateName,doNotSignApps,doNotRunTests,artifact,generateDependencyArtifact
|
||||
|
||||
- name: Read secrets
|
||||
id: ReadSecrets
|
||||
if: github.event_name != 'pull_request'
|
||||
uses: microsoft/AL-Go-Actions/ReadSecrets@main
|
||||
with:
|
||||
shell: ${{ inputs.shell }}
|
||||
gitHubSecrets: ${{ toJson(secrets) }}
|
||||
getSecrets: '${{ inputs.secrets }},appDependencyProbingPathsSecrets'
|
||||
- name: Read secrets
|
||||
id: ReadSecrets
|
||||
if: github.event_name != 'pull_request'
|
||||
uses: microsoft/AL-Go-Actions/ReadSecrets@main
|
||||
with:
|
||||
shell: ${{ inputs.shell }}
|
||||
gitHubSecrets: ${{ toJson(secrets) }}
|
||||
getSecrets: '${{ inputs.secrets }},appDependencyProbingPathsSecrets'
|
||||
|
||||
- name: Determine ArtifactUrl
|
||||
uses: microsoft/AL-Go-Actions/DetermineArtifactUrl@main
|
||||
id: determineArtifactUrl
|
||||
with:
|
||||
shell: ${{ inputs.shell }}
|
||||
parentTelemetryScopeJson: ${{ inputs.parentTelemetryScopeJson }}
|
||||
project: ${{ inputs.project }}
|
||||
- name: Determine ArtifactUrl
|
||||
uses: microsoft/AL-Go-Actions/DetermineArtifactUrl@main
|
||||
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@v3
|
||||
with:
|
||||
path: .artifactcache
|
||||
key: ${{ env.artifactCacheKey }}
|
||||
- name: Cache Business Central Artifacts
|
||||
if: env.useCompilerFolder == 'True' && inputs.useArtifactCache && env.artifactCacheKey
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: .artifactcache
|
||||
key: ${{ env.artifactCacheKey }}
|
||||
|
||||
- name: Download Project Dependencies
|
||||
id: DownloadProjectDependencies
|
||||
uses: microsoft/AL-Go-Actions/DownloadProjectDependencies@main
|
||||
env:
|
||||
Secrets: '${{ steps.ReadSecrets.outputs.Secrets }}'
|
||||
with:
|
||||
shell: ${{ inputs.shell }}
|
||||
project: ${{ inputs.project }}
|
||||
buildMode: ${{ inputs.buildMode }}
|
||||
projectsDependenciesJson: ${{ inputs.projectDependenciesJson }}
|
||||
- name: Download Project Dependencies
|
||||
id: DownloadProjectDependencies
|
||||
uses: microsoft/AL-Go-Actions/DownloadProjectDependencies@main
|
||||
env:
|
||||
Secrets: '${{ steps.ReadSecrets.outputs.Secrets }}'
|
||||
with:
|
||||
shell: ${{ inputs.shell }}
|
||||
project: ${{ inputs.project }}
|
||||
buildMode: ${{ inputs.buildMode }}
|
||||
projectsDependenciesJson: ${{ inputs.projectDependenciesJson }}
|
||||
|
||||
- name: Run pipeline
|
||||
id: RunPipeline
|
||||
uses: microsoft/AL-Go-Actions/RunPipeline@main
|
||||
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 }}
|
||||
installAppsJson: ${{ steps.DownloadProjectDependencies.outputs.DownloadedApps }}
|
||||
installTestAppsJson: ${{ steps.DownloadProjectDependencies.outputs.DownloadedTestApps }}
|
||||
- name: Build
|
||||
uses: microsoft/AL-Go-Actions/RunPipeline@main
|
||||
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 }}
|
||||
installAppsJson: ${{ steps.DownloadProjectDependencies.outputs.DownloadedApps }}
|
||||
installTestAppsJson: ${{ steps.DownloadProjectDependencies.outputs.DownloadedTestApps }}
|
||||
|
||||
- name: Sign
|
||||
if: inputs.signArtifacts && env.doNotSignApps == 'False' && env.keyVaultCodesignCertificateName != ''
|
||||
id: sign
|
||||
uses: microsoft/AL-Go-Actions/Sign@main
|
||||
with:
|
||||
shell: ${{ needs.Initialization.outputs.githubRunnerShell }}
|
||||
azureCredentialsJson: ${{ secrets.AZURE_CREDENTIALS }}
|
||||
pathToFiles: '${{ inputs.project }}/.buildartifacts/Apps/*.app'
|
||||
parentTelemetryScopeJson: ${{ needs.Initialization.outputs.telemetryScopeJson }}
|
||||
- name: Sign
|
||||
if: inputs.signArtifacts && env.doNotSignApps == 'False' && env.keyVaultCodesignCertificateName != ''
|
||||
id: sign
|
||||
uses: microsoft/AL-Go-Actions/Sign@main
|
||||
with:
|
||||
shell: ${{ needs.Initialization.outputs.githubRunnerShell }}
|
||||
azureCredentialsJson: ${{ 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@main
|
||||
if: success() || failure()
|
||||
with:
|
||||
shell: ${{ inputs.shell }}
|
||||
project: ${{ inputs.project }}
|
||||
buildMode: ${{ inputs.buildMode }}
|
||||
suffix: ${{ inputs.artifactsNameSuffix }}
|
||||
- name: Calculate Artifact names
|
||||
id: calculateArtifactsNames
|
||||
uses: microsoft/AL-Go-Actions/CalculateArtifactNames@main
|
||||
if: success() || failure()
|
||||
with:
|
||||
shell: ${{ inputs.shell }}
|
||||
project: ${{ inputs.project }}
|
||||
buildMode: ${{ inputs.buildMode }}
|
||||
suffix: ${{ inputs.artifactsNameSuffix }}
|
||||
|
||||
- name: Upload thisbuild artifacts - apps
|
||||
if: inputs.publishThisBuildArtifacts
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{ steps.calculateArtifactsNames.outputs.ThisBuildAppsArtifactsName }}
|
||||
path: '${{ inputs.project }}/.buildartifacts/Apps/'
|
||||
if-no-files-found: ignore
|
||||
retention-days: 1
|
||||
- name: Upload thisbuild artifacts - apps
|
||||
if: inputs.publishThisBuildArtifacts
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{ steps.calculateArtifactsNames.outputs.ThisBuildAppsArtifactsName }}
|
||||
path: '${{ inputs.project }}/.buildartifacts/Apps/'
|
||||
if-no-files-found: ignore
|
||||
retention-days: 1
|
||||
|
||||
- name: Upload thisbuild artifacts - dependencies
|
||||
if: inputs.publishThisBuildArtifacts
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{ steps.calculateArtifactsNames.outputs.ThisBuildDependenciesArtifactsName }}
|
||||
path: '${{ inputs.project }}/.buildartifacts/Dependencies/'
|
||||
if-no-files-found: ignore
|
||||
retention-days: 1
|
||||
- name: Upload thisbuild artifacts - dependencies
|
||||
if: inputs.publishThisBuildArtifacts
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{ steps.calculateArtifactsNames.outputs.ThisBuildDependenciesArtifactsName }}
|
||||
path: '${{ inputs.project }}/.buildartifacts/Dependencies/'
|
||||
if-no-files-found: ignore
|
||||
retention-days: 1
|
||||
|
||||
- name: Upload thisbuild artifacts - test apps
|
||||
if: inputs.publishThisBuildArtifacts
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{ steps.calculateArtifactsNames.outputs.ThisBuildTestAppsArtifactsName }}
|
||||
path: '${{ inputs.project }}/.buildartifacts/TestApps/'
|
||||
if-no-files-found: ignore
|
||||
retention-days: 1
|
||||
- name: Upload thisbuild artifacts - test apps
|
||||
if: inputs.publishThisBuildArtifacts
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{ steps.calculateArtifactsNames.outputs.ThisBuildTestAppsArtifactsName }}
|
||||
path: '${{ inputs.project }}/.buildartifacts/TestApps/'
|
||||
if-no-files-found: ignore
|
||||
retention-days: 1
|
||||
|
||||
- name: Publish artifacts - apps
|
||||
uses: actions/upload-artifact@v3
|
||||
if: inputs.publishArtifacts
|
||||
with:
|
||||
name: ${{ steps.calculateArtifactsNames.outputs.AppsArtifactsName }}
|
||||
path: '${{ inputs.project }}/.buildartifacts/Apps/'
|
||||
if-no-files-found: ignore
|
||||
- name: Publish artifacts - apps
|
||||
uses: actions/upload-artifact@v3
|
||||
if: inputs.publishArtifacts
|
||||
with:
|
||||
name: ${{ steps.calculateArtifactsNames.outputs.AppsArtifactsName }}
|
||||
path: '${{ inputs.project }}/.buildartifacts/Apps/'
|
||||
if-no-files-found: ignore
|
||||
|
||||
- name: Publish artifacts - dependencies
|
||||
uses: actions/upload-artifact@v3
|
||||
if: inputs.publishArtifacts && env.generateDependencyArtifact == 'True'
|
||||
with:
|
||||
name: ${{ steps.calculateArtifactsNames.outputs.DependenciesArtifactsName }}
|
||||
path: '${{ inputs.project }}/.buildartifacts/Dependencies/'
|
||||
if-no-files-found: ignore
|
||||
- name: Publish artifacts - dependencies
|
||||
uses: actions/upload-artifact@v3
|
||||
if: inputs.publishArtifacts && env.generateDependencyArtifact == 'True'
|
||||
with:
|
||||
name: ${{ steps.calculateArtifactsNames.outputs.DependenciesArtifactsName }}
|
||||
path: '${{ inputs.project }}/.buildartifacts/Dependencies/'
|
||||
if-no-files-found: ignore
|
||||
|
||||
- name: Publish artifacts - test apps
|
||||
uses: actions/upload-artifact@v3
|
||||
if: inputs.publishArtifacts
|
||||
with:
|
||||
name: ${{ steps.calculateArtifactsNames.outputs.TestAppsArtifactsName }}
|
||||
path: '${{ inputs.project }}/.buildartifacts/TestApps/'
|
||||
if-no-files-found: ignore
|
||||
- name: Publish artifacts - test apps
|
||||
uses: actions/upload-artifact@v3
|
||||
if: inputs.publishArtifacts
|
||||
with:
|
||||
name: ${{ steps.calculateArtifactsNames.outputs.TestAppsArtifactsName }}
|
||||
path: '${{ inputs.project }}/.buildartifacts/TestApps/'
|
||||
if-no-files-found: ignore
|
||||
|
||||
- name: Publish artifacts - build output
|
||||
uses: actions/upload-artifact@v3
|
||||
if: (success() || failure()) && (hashFiles(format('{0}/BuildOutput.txt',inputs.project)) != '')
|
||||
with:
|
||||
name: ${{ steps.calculateArtifactsNames.outputs.BuildOutputArtifactsName }}
|
||||
path: '${{ inputs.project }}/BuildOutput.txt'
|
||||
if-no-files-found: ignore
|
||||
- name: Publish artifacts - build output
|
||||
uses: actions/upload-artifact@v3
|
||||
if: (success() || failure()) && (hashFiles(format('{0}/BuildOutput.txt',inputs.project)) != '')
|
||||
with:
|
||||
name: ${{ steps.calculateArtifactsNames.outputs.BuildOutputArtifactsName }}
|
||||
path: '${{ inputs.project }}/BuildOutput.txt'
|
||||
if-no-files-found: ignore
|
||||
|
||||
- name: Publish artifacts - container event log
|
||||
uses: actions/upload-artifact@v3
|
||||
if: (failure()) && (hashFiles(format('{0}/ContainerEventLog.evtx',inputs.project)) != '')
|
||||
with:
|
||||
name: ${{ steps.calculateArtifactsNames.outputs.ContainerEventLogArtifactsName }}
|
||||
path: '${{ inputs.project }}/ContainerEventLog.evtx'
|
||||
if-no-files-found: ignore
|
||||
- name: Publish artifacts - container event log
|
||||
uses: actions/upload-artifact@v3
|
||||
if: (failure()) && (hashFiles(format('{0}/ContainerEventLog.evtx',inputs.project)) != '')
|
||||
with:
|
||||
name: ${{ steps.calculateArtifactsNames.outputs.ContainerEventLogArtifactsName }}
|
||||
path: '${{ inputs.project }}/ContainerEventLog.evtx'
|
||||
if-no-files-found: ignore
|
||||
|
||||
- name: Publish artifacts - test results
|
||||
uses: actions/upload-artifact@v3
|
||||
if: (success() || failure()) && (hashFiles(format('{0}/TestResults.xml',inputs.project)) != '')
|
||||
with:
|
||||
name: ${{ steps.calculateArtifactsNames.outputs.TestResultsArtifactsName }}
|
||||
path: '${{ inputs.project }}/TestResults.xml'
|
||||
if-no-files-found: ignore
|
||||
- name: Publish artifacts - test results
|
||||
uses: actions/upload-artifact@v3
|
||||
if: (success() || failure()) && (hashFiles(format('{0}/TestResults.xml',inputs.project)) != '')
|
||||
with:
|
||||
name: ${{ steps.calculateArtifactsNames.outputs.TestResultsArtifactsName }}
|
||||
path: '${{ inputs.project }}/TestResults.xml'
|
||||
if-no-files-found: ignore
|
||||
|
||||
- name: Publish artifacts - bcpt test results
|
||||
uses: actions/upload-artifact@v3
|
||||
if: (success() || failure()) && (hashFiles(format('{0}/bcptTestResults.json',inputs.project)) != '')
|
||||
with:
|
||||
name: ${{ steps.calculateArtifactsNames.outputs.BcptTestResultsArtifactsName }}
|
||||
path: '${{ inputs.project }}/bcptTestResults.json'
|
||||
if-no-files-found: ignore
|
||||
- name: Publish artifacts - bcpt test results
|
||||
uses: actions/upload-artifact@v3
|
||||
if: (success() || failure()) && (hashFiles(format('{0}/bcptTestResults.json',inputs.project)) != '')
|
||||
with:
|
||||
name: ${{ steps.calculateArtifactsNames.outputs.BcptTestResultsArtifactsName }}
|
||||
path: '${{ inputs.project }}/bcptTestResults.json'
|
||||
if-no-files-found: ignore
|
||||
|
||||
- name: Analyze Test Results
|
||||
id: analyzeTestResults
|
||||
if: (success() || failure()) && env.doNotRunTests == 'False'
|
||||
uses: microsoft/AL-Go-Actions/AnalyzeTests@main
|
||||
with:
|
||||
shell: ${{ inputs.shell }}
|
||||
parentTelemetryScopeJson: ${{ inputs.parentTelemetryScopeJson }}
|
||||
project: ${{ inputs.project }}
|
||||
- name: Analyze Test Results
|
||||
id: analyzeTestResults
|
||||
if: (success() || failure()) && env.doNotRunTests == 'False'
|
||||
uses: microsoft/AL-Go-Actions/AnalyzeTests@main
|
||||
with:
|
||||
shell: ${{ inputs.shell }}
|
||||
parentTelemetryScopeJson: ${{ inputs.parentTelemetryScopeJson }}
|
||||
project: ${{ inputs.project }}
|
||||
|
||||
- name: Cleanup
|
||||
if: always()
|
||||
uses: microsoft/AL-Go-Actions/PipelineCleanup@main
|
||||
with:
|
||||
shell: ${{ inputs.shell }}
|
||||
parentTelemetryScopeJson: ${{ inputs.parentTelemetryScopeJson }}
|
||||
project: ${{ inputs.project }}
|
||||
- name: Cleanup
|
||||
if: always()
|
||||
uses: microsoft/AL-Go-Actions/PipelineCleanup@main
|
||||
with:
|
||||
shell: ${{ inputs.shell }}
|
||||
parentTelemetryScopeJson: ${{ inputs.parentTelemetryScopeJson }}
|
||||
project: ${{ inputs.project }}
|
||||
|
|
|
@ -33,7 +33,7 @@ Describe "DetermineDeliveryTargets Action Test" {
|
|||
}
|
||||
$outputs = [ordered]@{
|
||||
"DeliveryTargetsJson" = "An array of Delivery Targets in compressed JSON format"
|
||||
"ContextSecrets" = "A comma seperated list of Context Secret names used"
|
||||
"ContextSecrets" = "A comma-separated list of Context Secret names used"
|
||||
}
|
||||
YamlTest -scriptRoot $scriptRoot -actionName $actionName -actionScript $actionScript -permissions $permissions -outputs $outputs
|
||||
}
|
||||
|
|
|
@ -107,9 +107,9 @@ function YamlTest {
|
|||
}
|
||||
}
|
||||
elseif ($type -eq "System.Boolean") {
|
||||
$parameterString += " -$($name) (`$ENV:_$($name) -eq 'Y')"
|
||||
$parameterString += " -$($name) (`$ENV:_$($name) -eq 'true')"
|
||||
if (!$required) {
|
||||
$yaml.AppendLine(" default: 'N'") | Out-Null
|
||||
$yaml.AppendLine(" default: 'false'") | Out-Null
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -18,8 +18,8 @@ Enter the following values in the form:
|
|||
| Name | `app1` |
|
||||
| Publisher | `<your publisher name>` |
|
||||
| ID Range (from..to) | `55000..55100` |
|
||||
| Include Sample Code | `Y` |
|
||||
| Direct COMMIT | `N` |
|
||||
| Include Sample Code | `yes` |
|
||||
| Direct Commit | `no` |
|
||||
|
||||
| ![image](https://user-images.githubusercontent.com/10775043/231540732-4a1ef920-abe2-4611-a2b0-9ac9a8310e3b.png) |
|
||||
|-|
|
||||
|
|
|
@ -30,8 +30,8 @@ Now select **Actions** and locate the **Create a new test app** action and click
|
|||
| Name | `app1.test` |
|
||||
| Publisher | `<your publisher name>` |
|
||||
| ID Range (from..to) | `70000..99999` |
|
||||
| Include Sample Code | `Y` |
|
||||
| Direct COMMIT | `N` |
|
||||
| Include Sample Code | `yes` |
|
||||
| Direct Commit | `no` |
|
||||
|
||||
| ![image](https://user-images.githubusercontent.com/10775043/232327235-bd4350f7-d05f-423b-a69b-0b0c226180b3.png) |
|
||||
|-|
|
||||
|
|
|
@ -8,7 +8,7 @@ So, let's setup a single-project common repository like this. Navigate to https:
|
|||
| ![image](https://user-images.githubusercontent.com/10775043/232203510-095f1f0d-e407-413d-9e17-7a3e3e43b821.png) |
|
||||
|-|
|
||||
|
||||
Run Update **AL-Go System Files** with **microsoft/AL-Go-PTE@preview** as the template URL and **Y** in Direct COMMIT.
|
||||
Run Update **AL-Go System Files** with **microsoft/AL-Go-PTE@preview** as the template URL and **Y** in Direct Commit.
|
||||
|
||||
When upgrade is done, create 2 apps within the repository using the **Create a new app** workflow called **Common** and **Licensing**, using the following parameters:
|
||||
|
||||
|
@ -18,8 +18,8 @@ When upgrade is done, create 2 apps within the repository using the **Create a n
|
|||
| Name | `Common` |
|
||||
| Publisher | `<your publisher name>` |
|
||||
| ID Range (from..to) | `60000..60099` |
|
||||
| Include Sample Code | `N` |
|
||||
| Direct COMMIT | `Y` |
|
||||
| Include Sample Code | `no` |
|
||||
| Direct Commit | `yes` |
|
||||
|
||||
and
|
||||
|
||||
|
@ -29,8 +29,8 @@ and
|
|||
| Name | `Licensing` |
|
||||
| Publisher | `<your publisher name>` |
|
||||
| ID Range (from..to) | `60100..60199` |
|
||||
| Include Sample Code | `N` |
|
||||
| Direct COMMIT | `Y` |
|
||||
| Include Sample Code | `no` |
|
||||
| Direct Commit | `yes` |
|
||||
|
||||
Leaving out the sample code in order to avoid name clashes.
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ So, let's setup a multi-project repository like this. Navigate to **https://aka.
|
|||
|
||||
Like when we ran GetStarted, we want to use the preview version of AL-Go for GitHub. Select **Actions**, select the **Update AL-Go System Files** workflow and click **Run workflow**.
|
||||
|
||||
Specify **microsoft/AL-Go-PTE@preview** as template repository, **Y** in Direct COMMIT and click **Run workflow**. You don't have to wait for the CI/CD workflow to complete. You can locate the **Create a new app** workflow in the list of workflows and run it with the following parameters:
|
||||
Specify **microsoft/AL-Go-PTE@preview** as template repository, **Y** in Direct Commit and click **Run workflow**. You don't have to wait for the CI/CD workflow to complete. You can locate the **Create a new app** workflow in the list of workflows and run it with the following parameters:
|
||||
|
||||
| Name | Value |
|
||||
| :-- | :-- |
|
||||
|
@ -35,8 +35,8 @@ Specify **microsoft/AL-Go-PTE@preview** as template repository, **Y** in Direct
|
|||
| Name | `mysolution.us` |
|
||||
| Publisher | `<your publisher name>` |
|
||||
| ID Range (from..to) | `50000..50100` |
|
||||
| Include Sample Code | `Y` |
|
||||
| Direct COMMIT | `N` |
|
||||
| Include Sample Code | `yes` |
|
||||
| Direct Commit | `no` |
|
||||
|
||||
| ![image](https://user-images.githubusercontent.com/10775043/231755134-303a59b3-f616-4d08-b46d-47810e459a1b.png) |
|
||||
|-|
|
||||
|
@ -60,8 +60,8 @@ You don't have to wait for the **CI/CD workflow** to complete, just go ahead and
|
|||
| Name | `mysolution.dk` |
|
||||
| Publisher | `<your publisher name>` |
|
||||
| ID Range (from..to) | `51000..51100` |
|
||||
| Include Sample Code | `Y` |
|
||||
| Direct COMMIT | `N` |
|
||||
| Include Sample Code | `yes` |
|
||||
| Direct Commit | `no` |
|
||||
|
||||
and run the same workflow again with these parameters:
|
||||
|
||||
|
@ -71,8 +71,8 @@ and run the same workflow again with these parameters:
|
|||
| Name | `mysolution.w1` |
|
||||
| Publisher | `<your publisher name>` |
|
||||
| ID Range (from..to) | `52000..52100` |
|
||||
| Include Sample Code | `Y` |
|
||||
| Direct COMMIT | `N` |
|
||||
| Include Sample Code | `yes` |
|
||||
| Direct Commit | `no` |
|
||||
|
||||
When the **New App (mysolution.dk)** and **New App (mysolution.w1)** pull requests are created, **merge the pull request** and **delete** the temporary branch.
|
||||
|
||||
|
|
|
@ -17,11 +17,11 @@ Select **Actions**, select the **Create Release** workflow and click **Run workf
|
|||
| App version | `latest` |
|
||||
| Name of this release | `v1.0` |
|
||||
| Tag of this release | `1.0.4` |
|
||||
| Prerelease | `N` |
|
||||
| Draft | `N` |
|
||||
| Create Release Branch | `Y` |
|
||||
| Prerelease | `no` |
|
||||
| Draft | `no` |
|
||||
| Create Release Branch | `yes` |
|
||||
| New Version Number | `+1.0` |
|
||||
| Direct COMMIT | `N` |
|
||||
| Direct Commit | `no` |
|
||||
|
||||
After completion of the **Create release** workflow, you can select **Code** and see that you have 1 releases:
|
||||
![image](https://user-images.githubusercontent.com/10775043/231591177-d2a85451-a717-4f87-a2ae-55e26c19a17f.png)
|
||||
|
|
|
@ -39,7 +39,7 @@ Scroll back up, locate the **Re-run all jobs** button and click it. Wait for the
|
|||
|
||||
Now revision became **1** as we had another attempt at building the app.
|
||||
|
||||
Next, let's create another app in the same repo. **app2** with ID range **56000..56100** and enter **Y** in **Direct COMMIT**.
|
||||
Next, let's create another app in the same repo. **app2** with ID range **56000..56100** and enter **Y** in **Direct Commit**.
|
||||
|
||||
| ![image](https://user-images.githubusercontent.com/10775043/231561391-7350981e-e20d-49a1-9479-4271a7e6ddd8.png) |
|
||||
|-|
|
||||
|
|
|
@ -84,7 +84,8 @@ if ($multiProject) {
|
|||
$project1Folder = 'P1\'
|
||||
$project2Param = @{ "project" = "P2" }
|
||||
$project2Folder = 'P2\'
|
||||
$allProjectsParam = @{ "project" = "*" }
|
||||
$p2ProjectsParam = @{ "projects" = "P2" }
|
||||
$allProjectsParam = @{ "projects" = "*" }
|
||||
$projectSettingsFiles = @("P1\.AL-Go\settings.json", "P2\.AL-Go\settings.json")
|
||||
}
|
||||
else {
|
||||
|
@ -92,6 +93,7 @@ else {
|
|||
$project1Folder = ""
|
||||
$project2Param = @{}
|
||||
$project2Folder = ""
|
||||
$p2ProjectsParam = @{}
|
||||
$allProjectsParam = @{}
|
||||
$projectSettingsFiles = @(".AL-Go\settings.json")
|
||||
}
|
||||
|
@ -193,7 +195,7 @@ if ($adminCenterApiToken -and -not $multiProject) {
|
|||
}
|
||||
|
||||
# Increment version number on one project
|
||||
RunIncrementVersionNumber @project2Param -versionNumber 2.0 -wait -branch $branch | Out-Null
|
||||
RunIncrementVersionNumber @p2ProjectsParam -versionNumber 2.0 -wait -branch $branch | Out-Null
|
||||
$runs++
|
||||
$run = MergePRandPull -branch $branch -wait
|
||||
$runs++
|
||||
|
@ -216,7 +218,7 @@ Remove-Item -Path ".github\workflows\AddExistingAppOrTestApp.yaml" -Force
|
|||
CommitAndPush -commitMessage "Version strategy change"
|
||||
$runs++
|
||||
|
||||
# Increment version number on all project (and on all apps)
|
||||
# Increment version number on all projects (and on all apps)
|
||||
RunIncrementVersionNumber @allProjectsParam -versionNumber 3.0 -directCommit -wait -branch $branch | Out-Null
|
||||
$runs++
|
||||
Pull -branch $branch
|
||||
|
|
|
@ -14,7 +14,12 @@
|
|||
$runs = gh run list --limit 1000 --repo $repository --json $returnFields | ConvertFrom-Json | Where-Object { $_.workflowName -ne "workflow_run" }
|
||||
}
|
||||
$runs | Out-Host
|
||||
$runs.Count
|
||||
if ($runs) {
|
||||
return $runs.Count
|
||||
}
|
||||
else {
|
||||
return 0
|
||||
}
|
||||
}
|
||||
|
||||
function TestNumberOfRuns {
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
$parameters = @{
|
||||
"project" = $project
|
||||
"url" = $url
|
||||
"directCommit" = @("Y","N")[!$directCommit]
|
||||
"directCommit" = @("true","false")[!$directCommit]
|
||||
}
|
||||
RunWorkflow -name $workflowName -parameters $parameters -wait:$wait -branch $branch -repository $repository
|
||||
}
|
|
@ -16,7 +16,7 @@
|
|||
"name" = $name
|
||||
"publisher" = $publisher
|
||||
"idrange" = $idrange
|
||||
"directCommit" = @("Y","N")[!$directCommit]
|
||||
"directCommit" = @("true","false")[!$directCommit]
|
||||
}
|
||||
RunWorkflow -name $workflowName -parameters $parameters -wait:$wait -branch $branch -repository $repository
|
||||
}
|
|
@ -11,8 +11,8 @@
|
|||
$workflowName = 'Create Online Dev. Environment'
|
||||
$parameters = @{
|
||||
"environmentName" = $environmentName
|
||||
"reUseExistingEnvironment" = @("Y","N")[!$reUseExistingEnvironment]
|
||||
"directCommit" = @("Y","N")[!$directCommit]
|
||||
"reUseExistingEnvironment" = @("true","false")[!$reUseExistingEnvironment]
|
||||
"directCommit" = @("true","false")[!$directCommit]
|
||||
}
|
||||
RunWorkflow -name $workflowName -parameters $parameters -wait:$wait -branch $branch -repository $repository
|
||||
}
|
|
@ -18,11 +18,11 @@
|
|||
"appVersion" = $appVersion
|
||||
"name" = $name
|
||||
"tag" = $tag
|
||||
"prerelease" = @("Y","N")[!$prerelease]
|
||||
"draft" = @("Y","N")[!$draft]
|
||||
"createReleaseBranch" = @("Y","N")[!$createReleaseBranch]
|
||||
"prerelease" = @("true","false")[!$prerelease]
|
||||
"draft" = @("true","false")[!$draft]
|
||||
"createReleaseBranch" = @("true","false")[!$createReleaseBranch]
|
||||
"updateVersionNumber" = $updateVersionNumber
|
||||
"directCommit" = @("Y","N")[!$directCommit]
|
||||
"directCommit" = @("true","false")[!$directCommit]
|
||||
}
|
||||
RunWorkflow -name $workflowName -parameters $parameters -wait:$wait -branch $branch -repository $repository
|
||||
}
|
|
@ -16,7 +16,7 @@
|
|||
"name" = $name
|
||||
"publisher" = $publisher
|
||||
"idrange" = $idrange
|
||||
"directCommit" = @("Y","N")[!$directCommit]
|
||||
"directCommit" = @("true","false")[!$directCommit]
|
||||
}
|
||||
RunWorkflow -name $workflowName -parameters $parameters -wait:$wait -branch $branch -repository $repository
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
function RunIncrementVersionNumber {
|
||||
Param(
|
||||
[string] $project,
|
||||
[string] $projects,
|
||||
[string] $versionNumber,
|
||||
[switch] $directCommit,
|
||||
[switch] $wait,
|
||||
|
@ -10,9 +10,9 @@
|
|||
|
||||
$workflowName = 'Increment Version Number'
|
||||
$parameters = @{
|
||||
"project" = $project
|
||||
"projects" = $projects
|
||||
"versionNumber" = $versionNumber
|
||||
"directCommit" = @("Y","N")[!$directCommit]
|
||||
"directCommit" = @("true","false")[!$directCommit]
|
||||
}
|
||||
RunWorkflow -name $workflowName -parameters $parameters -wait:$wait -branch $branch -repository $repository
|
||||
}
|
|
@ -14,7 +14,7 @@
|
|||
$workflowName = 'Update AL-Go System Files'
|
||||
$parameters = @{
|
||||
"templateUrl" = $templateUrl.Split('|')[0]
|
||||
"directCommit" = @("Y","N")[!$directCommit]
|
||||
"directCommit" = @("true","false")[!$directCommit]
|
||||
}
|
||||
RunWorkflow -name $workflowName -parameters $parameters -wait:$wait -branch $branch -repository $repository
|
||||
}
|
||||
|
|
|
@ -84,7 +84,7 @@ $run = RunCICD -repository $repository -branch $branch -wait
|
|||
Test-ArtifactsFromRun -runid $run.id -folder 'artifacts' -expectedArtifacts @{"Apps"=1} -repoVersion '1.0' -appVersion '1.0'
|
||||
|
||||
# Check that no previous release was found
|
||||
Test-LogContainsFromRun -runid $run.id -jobName 'Build . (Default) . (Default)' -stepName 'Run pipeline' -expectedText 'No previous release found'
|
||||
Test-LogContainsFromRun -runid $run.id -jobName 'Build . (Default) . (Default)' -stepName 'Build' -expectedText 'No previous release found'
|
||||
|
||||
# Release version 1.0
|
||||
$tag1 = '1.0.0'
|
||||
|
@ -101,7 +101,7 @@ $run = RunCICD -repository $repository -branch $branch -wait
|
|||
Test-ArtifactsFromRun -runid $run.id -folder 'artifacts' -expectedArtifacts @{"Apps"=1} -repoVersion '2.0' -appVersion '2.0'
|
||||
|
||||
# Check that $tag1 was used as previous release
|
||||
Test-LogContainsFromRun -runid $run.id -jobName 'Build . (Default) . (Default)' -stepName 'Run pipeline' -expectedText "Using $ver1 (tag $tag1) as previous release"
|
||||
Test-LogContainsFromRun -runid $run.id -jobName 'Build . (Default) . (Default)' -stepName 'Build' -expectedText "Using $ver1 (tag $tag1) as previous release"
|
||||
|
||||
# Release version 2.0
|
||||
$tag2 = '2.0.0'
|
||||
|
@ -124,7 +124,7 @@ WaitWorkflow -runid $run.id -repository $repository -noDelay
|
|||
Test-ArtifactsFromRun -runid $run.id -folder 'artifacts' -expectedArtifacts @{"Apps"=1} -repoVersion '2.1' -appVersion '2.1'
|
||||
|
||||
# Check that $tag2 was used as previous release
|
||||
Test-LogContainsFromRun -runid $run.id -jobName 'Build . (Default) . (Default)' -stepName 'Run pipeline' -expectedText "Using $ver2 (tag $tag2) as previous release"
|
||||
Test-LogContainsFromRun -runid $run.id -jobName 'Build . (Default) . (Default)' -stepName 'Build' -expectedText "Using $ver2 (tag $tag2) as previous release"
|
||||
|
||||
Test-ArtifactsFromRun -runid $runRelease1.id -folder 'artifacts1' -expectedArtifacts @{"Apps"=1} -repoVersion '1.0' -appVersion '1.0'
|
||||
$noOfReleaseArtifacts = @(get-childitem -path 'artifacts1' -filter '*-release_1.0-Apps-1.0.*').count
|
||||
|
@ -133,7 +133,7 @@ if ($noOfReleaseArtifacts -ne 1) {
|
|||
}
|
||||
|
||||
# Check that $tag1 was used as previous release for builds in release branch 1.0
|
||||
Test-LogContainsFromRun -runid $runRelease1.id -jobName 'Build . (Default) . (Default)' -stepName 'Run pipeline' -expectedText "Using $ver1 (tag $tag1) as previous release"
|
||||
Test-LogContainsFromRun -runid $runRelease1.id -jobName 'Build . (Default) . (Default)' -stepName 'Build' -expectedText "Using $ver1 (tag $tag1) as previous release"
|
||||
|
||||
Test-ArtifactsFromRun -runid $runRelease2.id -folder 'artifacts2' -expectedArtifacts @{"Apps"=1} -repoVersion '2.0' -appVersion '2.0'
|
||||
$noOfReleaseArtifacts = @(get-childitem -path 'artifacts2' -filter '*-release_2.0-Apps-2.0.*').count
|
||||
|
@ -142,7 +142,7 @@ if ($noOfReleaseArtifacts -ne 1) {
|
|||
}
|
||||
|
||||
# Check that $tag2 was used as previous release for builds in release branch 2.0
|
||||
Test-LogContainsFromRun -runid $runRelease2.id -jobName 'Build . (Default) . (Default)' -stepName 'Run pipeline' -expectedText "Using $ver2 (tag $tag2) as previous release"
|
||||
Test-LogContainsFromRun -runid $runRelease2.id -jobName 'Build . (Default) . (Default)' -stepName 'Build' -expectedText "Using $ver2 (tag $tag2) as previous release"
|
||||
|
||||
# Release hotfix from version 1.0
|
||||
$hotTag1 = "1.0.$($runRelease1.run_number)"
|
||||
|
@ -168,7 +168,7 @@ if ($noOfReleaseArtifacts -ne 1) {
|
|||
}
|
||||
|
||||
# Check that $hotTag1 was used as previous release for builds in release branch 1.0
|
||||
Test-LogContainsFromRun -runid $runRelease1.id -jobName 'Build . (Default) . (Default)' -stepName 'Run pipeline' -expectedText "Using $hotVer1 (tag $hotTag1) as previous release"
|
||||
Test-LogContainsFromRun -runid $runRelease1.id -jobName 'Build . (Default) . (Default)' -stepName 'Build' -expectedText "Using $hotVer1 (tag $hotTag1) as previous release"
|
||||
|
||||
Set-Location $prevLocation
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче