-
Notifications
You must be signed in to change notification settings - Fork 354
178 lines (161 loc) · 6.29 KB
/
UpdateGitHubGoSystemFiles.yaml
File metadata and controls
178 lines (161 loc) · 6.29 KB
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
name: ' Update AL-Go System Files'
on:
workflow_dispatch:
inputs:
templateUrl:
description: Template Repository URL (current is https://github.com/microsoft/AL-Go-PTE@preview)
required: false
default: ''
downloadLatest:
description: Download latest from template repository
type: boolean
default: true
directCommit:
description: Direct Commit?
type: boolean
default: false
includeBranches:
description: Specify a comma-separated list of branches to update. Wildcards are supported. The AL-Go settings will be read for every branch. Leave empty to update the current branch only.
required: false
default: ''
workflow_call:
inputs:
templateUrl:
description: Template Repository URL (current is https://github.com/microsoft/AL-Go-PTE@preview)
type: string
required: false
default: ''
downloadLatest:
description: Download latest from template repository
type: boolean
default: true
directCommit:
description: Direct Commit?
type: boolean
default: false
includeBranches:
description: Specify a comma-separated list of branches to update. Wildcards are supported. The AL-Go settings will be read for every branch. Leave empty to update the current branch only.
type: string
required: false
default: ''
schedule:
- cron: '25 12 * * 3'
permissions:
actions: read
contents: read
id-token: write
defaults:
run:
shell: powershell
env:
ALGoOrgSettings: ${{ vars.ALGoOrgSettings }}
ALGoRepoSettings: ${{ vars.ALGoRepoSettings }}
jobs:
Initialize:
runs-on: windows-latest
name: Initialize
outputs:
UpdateBranches: ${{ steps.GetBranches.outputs.Result }}
TemplateUrl: ${{ steps.DetermineTemplateUrl.outputs.TemplateUrl }}
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Read settings
id: ReadSettings
uses: microsoft/AL-Go/Actions/ReadSettings@646025c59ea7bbf9259bafa0f159900c21b1f285
with:
shell: powershell
get: templateUrl
- name: Get Workflow Multi-Run Branches
id: GetBranches
uses: microsoft/AL-Go/Actions/GetWorkflowMultiRunBranches@646025c59ea7bbf9259bafa0f159900c21b1f285
with:
shell: powershell
includeBranches: ${{ github.event.inputs.includeBranches }}
- name: Determine Template URL
id: DetermineTemplateUrl
env:
TemplateUrlAsInput: '${{ github.event.inputs.templateUrl }}'
run: |
$templateUrl = $env:templateUrl # Available from ReadSettings step
if ($ENV:TemplateUrlAsInput) {
# Use the input value if it is provided
$templateUrl = $ENV:TemplateUrlAsInput
}
Write-Host "Using template URL: $templateUrl"
Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "TemplateUrl=$templateUrl"
UpdateALGoSystemFiles:
name: "[${{ matrix.branch }}] Update AL-Go System Files"
environment: Official-Build
needs: [ Initialize ]
runs-on: windows-latest
strategy:
matrix:
branch: ${{ fromJson(needs.Initialize.outputs.UpdateBranches).branches }}
fail-fast: false
steps:
- name: Dump Workflow Information
uses: microsoft/AL-Go/Actions/DumpWorkflowInfo@646025c59ea7bbf9259bafa0f159900c21b1f285
with:
shell: powershell
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
ref: ${{ matrix.branch }}
- name: Initialize the workflow
id: init
uses: microsoft/AL-Go/Actions/WorkflowInitialize@646025c59ea7bbf9259bafa0f159900c21b1f285
with:
shell: powershell
- name: Read settings
uses: microsoft/AL-Go/Actions/ReadSettings@646025c59ea7bbf9259bafa0f159900c21b1f285
with:
shell: powershell
get: commitOptions
- name: Read secrets
id: ReadSecrets
uses: microsoft/AL-Go/Actions/ReadSecrets@646025c59ea7bbf9259bafa0f159900c21b1f285
with:
shell: powershell
gitHubSecrets: ${{ toJson(secrets) }}
getSecrets: 'ghTokenWorkflow'
- name: Calculate Commit Options
env:
directCommit: '${{ github.event.inputs.directCommit }}'
downloadLatest: '${{ github.event.inputs.downloadLatest }}'
run: |
$errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0
if('${{ github.event_name }}' -in 'workflow_dispatch', 'workflow_call') {
Write-Host "Using inputs from ${{ github.event_name }} event"
$directCommit = $env:directCommit
$downloadLatest = $env:downloadLatest
}
else {
Write-Host "Using inputs from commitOptions setting"
$commitOptions = $env:commitOptions | ConvertFrom-Json # Available from ReadSettings step
$directCommit=$(-not $commitOptions.createPullRequest)
$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: microsoft/AL-Go/Actions/CheckForUpdates@646025c59ea7bbf9259bafa0f159900c21b1f285
env:
GITHUB_TOKEN: ${{ github.token }}
with:
shell: powershell
token: ${{ fromJson(steps.ReadSecrets.outputs.Secrets).ghTokenWorkflow }}
downloadLatest: ${{ env.downloadLatest }}
update: 'Y'
templateUrl: ${{ needs.Initialize.outputs.TemplateUrl }}
directCommit: ${{ env.directCommit }}
updateBranch: ${{ matrix.branch }}
- name: Finalize the workflow
if: always()
uses: microsoft/AL-Go/Actions/WorkflowPostProcess@646025c59ea7bbf9259bafa0f159900c21b1f285
env:
GITHUB_TOKEN: ${{ github.token }}
with:
shell: powershell
telemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}
currentJobContext: ${{ toJson(job) }}