forked from freddydk/spchars
-
Notifications
You must be signed in to change notification settings - Fork 0
98 lines (86 loc) · 3.25 KB
/
UpdateGitHubGoSystemFiles.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
name: ' Update AL-Go System Files'
on:
workflow_dispatch:
inputs:
templateUrl:
description: Template Repository URL (current is https://github.com/mazhelez/AL-Go@output-encoding)
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: mazhelez/AL-Go/Actions/WorkflowInitialize@output-encoding
with:
shell: powershell
eventId: "DO0098"
- name: Read settings
uses: mazhelez/AL-Go/Actions/ReadSettings@output-encoding
with:
shell: powershell
parentTelemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}
get: keyVaultName,ghTokenWorkflowSecretName,templateUrl
- name: Read secrets
uses: mazhelez/AL-Go/Actions/ReadSecrets@output-encoding
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"; $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 DirectCommit
env:
directCommit: ${{ github.event.inputs.directCommit }}
eventName: ${{ github.event_name }}
run: |
$errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; 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 -Encoding UTF8 -Path $env:GITHUB_ENV -Value "DirectCommit=$directCommit"
- name: Update AL-Go system files
uses: mazhelez/AL-Go/Actions/CheckForUpdates@output-encoding
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: mazhelez/AL-Go/Actions/WorkflowPostProcess@output-encoding
with:
shell: powershell
eventId: "DO0098"
telemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}