Update AL-Go System Files #53
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: ' Update AL-Go System Files' | |
on: | |
workflow_dispatch: | |
inputs: | |
templateUrl: | |
description: Template Repository URL (current is https://github.com/aholstrup1/AL-Go@main) | |
required: false | |
default: '' | |
directCommit: | |
description: Direct COMMIT (Y/N) | |
required: false | |
default: 'N' | |
permissions: | |
contents: read | |
defaults: | |
run: | |
shell: powershell | |
env: | |
ALGoOrgSettings: ${{ vars.ALGoOrgSettings }} | |
ALGoRepoSettings: ${{ vars.ALGoRepoSettings }} | |
jobs: | |
UpdateALGoSystemFiles: | |
runs-on: [ windows-latest ] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Initialize the workflow | |
id: init | |
uses: aholstrup1/AL-Go/Actions/WorkflowInitialize@main | |
with: | |
shell: powershell | |
eventId: "DO0098" | |
- name: Read settings | |
uses: aholstrup1/AL-Go/Actions/ReadSettings@main | |
with: | |
shell: powershell | |
parentTelemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }} | |
get: keyVaultName,ghTokenWorkflowSecretName,templateUrl | |
- name: Read secrets | |
uses: aholstrup1/AL-Go/Actions/ReadSecrets@main | |
env: | |
secrets: ${{ toJson(secrets) }} | |
with: | |
shell: powershell | |
parentTelemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }} | |
settingsJson: ${{ env.Settings }} | |
secrets: 'ghTokenWorkflow=${{ env.GHTOKENWORKFLOWSECRETNAME }}' | |
- name: Override templateUrl | |
env: | |
templateUrl: ${{ github.event.inputs.templateUrl }} | |
run: | | |
$ErrorActionPreference = "STOP" | |
Set-StrictMode -version 2.0 | |
$templateUrl = $ENV:templateUrl | |
if ($templateUrl) { | |
Write-Host "Using Template Url: $templateUrl" | |
Add-Content -Path $env:GITHUB_ENV -Value "templateUrl=$templateUrl" | |
} | |
- name: Calculate DirectCommit | |
env: | |
directCommit: ${{ github.event.inputs.directCommit }} | |
eventName: ${{ github.event_name }} | |
run: | | |
$ErrorActionPreference = "STOP" | |
Set-StrictMode -version 2.0 | |
$directCommit = $ENV:directCommit | |
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' | |
} | |
Add-Content -Path $env:GITHUB_ENV -Value "DirectCommit=$directCommit" | |
- name: Update AL-Go system files | |
uses: aholstrup1/AL-Go/Actions/CheckForUpdates@main | |
with: | |
shell: powershell | |
parentTelemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }} | |
token: ${{ env.ghTokenWorkflow }} | |
Update: Y | |
templateUrl: ${{ env.templateUrl }} | |
directCommit: ${{ env.directCommit }} | |
- name: Finalize the workflow | |
if: always() | |
uses: aholstrup1/AL-Go/Actions/WorkflowPostProcess@main | |
with: | |
shell: powershell | |
eventId: "DO0098" | |
telemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }} |