forked from microsoft/BCApps
-
Notifications
You must be signed in to change notification settings - Fork 1
154 lines (137 loc) · 5.28 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
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
name: ' Update AL-Go System Files'
on:
workflow_dispatch:
inputs:
templateUrl:
description: Template Repository URL (current is https://github.com/mazhelez/AL-Go@fail-update-al-go)
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: ''
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@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Read settings
id: ReadSettings
uses: mazhelez/AL-Go/Actions/ReadSettings@fail-update-al-go
with:
shell: powershell
get: templateUrl
- name: Get Workflow Multi-Run Branches
id: GetBranches
uses: mazhelez/AL-Go/Actions/GetWorkflowMultiRunBranches@fail-update-al-go
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: mazhelez/AL-Go/Actions/DumpWorkflowInfo@fail-update-al-go
with:
shell: powershell
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: ${{ matrix.branch }}
- name: Initialize the workflow
id: init
uses: mazhelez/AL-Go/Actions/WorkflowInitialize@fail-update-al-go
with:
shell: powershell
- name: Read settings
uses: mazhelez/AL-Go/Actions/ReadSettings@fail-update-al-go
with:
shell: powershell
get: commitOptions
- name: Read secrets
id: ReadSecrets
uses: mazhelez/AL-Go/Actions/ReadSecrets@fail-update-al-go
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 }}' -eq 'workflow_dispatch') {
Write-Host "Using inputs from workflow_dispatch 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: mazhelez/AL-Go/Actions/CheckForUpdates@fail-update-al-go
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: mazhelez/AL-Go/Actions/WorkflowPostProcess@fail-update-al-go
env:
GITHUB_TOKEN: ${{ github.token }}
with:
shell: powershell
telemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}
currentJobContext: ${{ toJson(job) }}