Skip to content

Update AL-Go System Files #594

Update AL-Go System Files

Update AL-Go System Files #594

name: ' Update AL-Go System Files'
on:
workflow_dispatch:
inputs:
templateUrl:
description: Template Repository URL (current is https://github.com/freddydk/AL-Go@pagescript)
required: false
default: ''
downloadLatest:
description: Download latest from template repository
type: boolean
default: true
directCommit:
description: Direct Commit?
type: boolean
default: false
schedule:
- cron: '0 0 * * *'
permissions:
actions: read
contents: read
id-token: write
defaults:
run:
shell: pwsh
env:
ALGoOrgSettings: ${{ vars.ALGoOrgSettings }}
ALGoRepoSettings: ${{ vars.ALGoRepoSettings }}
jobs:
UpdateALGoSystemFiles:
name: 'Update AL-Go System Files'
needs: [ ]
runs-on: [ ubuntu-latest ]
steps:
- name: Dump Workflow Information
uses: freddydk/AL-Go/Actions/DumpWorkflowInfo@pagescript
with:
shell: pwsh
- name: Checkout
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
- name: Initialize the workflow
id: init
uses: freddydk/AL-Go/Actions/WorkflowInitialize@pagescript
with:
shell: pwsh
- name: Read settings
uses: freddydk/AL-Go/Actions/ReadSettings@pagescript
with:
shell: pwsh
get: templateUrl
- name: Read secrets
id: ReadSecrets
uses: freddydk/AL-Go/Actions/ReadSecrets@pagescript
with:
shell: pwsh
gitHubSecrets: ${{ toJson(secrets) }}
getSecrets: 'ghTokenWorkflow'
- name: Override templateUrl
env:
templateUrl: ${{ github.event.inputs.templateUrl }}
run: |
$errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0
$templateUrl = $ENV:templateUrl
if ($templateUrl) {
Write-Host "Using Template Url: $templateUrl"
Add-Content -Encoding UTF8 -Path $env:GITHUB_ENV -Value "templateUrl=$templateUrl"
}
- name: Calculate Input
env:
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 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 "downloadLatest=$downloadLatest"
- name: Update AL-Go system files
uses: freddydk/AL-Go/Actions/CheckForUpdates@pagescript
with:
shell: pwsh
token: ${{ fromJson(steps.ReadSecrets.outputs.Secrets).ghTokenWorkflow }}
downloadLatest: ${{ env.downloadLatest }}
update: 'Y'
templateUrl: ${{ env.templateUrl }}
directCommit: ${{ env.directCommit }}
- name: Finalize the workflow
if: always()
uses: freddydk/AL-Go/Actions/WorkflowPostProcess@pagescript
env:
GITHUB_TOKEN: ${{ github.token }}
with:
shell: pwsh
telemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}
currentJobContext: ${{ toJson(job) }}