-
-
Notifications
You must be signed in to change notification settings - Fork 583
323 lines (272 loc) · 15.7 KB
/
Sophia.yml
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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
name: Build
on:
push:
tags:
- '*.*.*'
- '*.*'
jobs:
patch:
runs-on: windows-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@master
- name: Signing all .ps1, .psm1, .psd1 files
run: |
. Scripts\Sign.ps1
- name: Dependencies
run: |
Write-Verbose -Message Dependencies -Verbose
# Download PolicyFileEditor
# https://github.com/dlwyatt/PolicyFileEditor
$Parameters = @{
Uri = "https://api.github.com/repos/dlwyatt/PolicyFileEditor/releases/latest"
UseBasicParsing = $true
}
$LatestPolicyFileEditorVersion = (Invoke-RestMethod @Parameters).tag_name
$Parameters = @{
Uri = "https://github.com/dlwyatt/PolicyFileEditor/archive/refs/tags/$LatestPolicyFileEditorVersion.zip"
OutFile = "$PSScriptRoot\$LatestPolicyFileEditorVersion.zip"
UseBasicParsing = $true
Verbose = $true
}
Invoke-WebRequest @Parameters
# Expand zip archive
$Parameters = @{
Path = "$PSScriptRoot\$LatestPolicyFileEditorVersion.zip"
DestinationPath = "$PSScriptRoot"
Force = $true
Verbose = $true
}
Expand-Archive @Parameters
$Path = @(
"$PSScriptRoot\PolicyFileEditor-$LatestPolicyFileEditorVersion\DscResources",
"$PSScriptRoot\PolicyFileEditor-$LatestPolicyFileEditorVersion\en-US",
"$PSScriptRoot\PolicyFileEditor-$LatestPolicyFileEditorVersion\build.psake.ps1",
"$PSScriptRoot\PolicyFileEditor-$LatestPolicyFileEditorVersion\LICENSE",
"$PSScriptRoot\PolicyFileEditor-$LatestPolicyFileEditorVersion\PolicyFileEditor.Tests.ps1",
"$PSScriptRoot\PolicyFileEditor-$LatestPolicyFileEditorVersion\README.md"
)
Remove-Item -Path $Path -Recurse -Force
Rename-Item -Path "$PSScriptRoot\PolicyFileEditor-$LatestPolicyFileEditorVersion" -NewName "$PSScriptRoot\PolicyFileEditor" -Force
# Download Microsoft.Windows.SDK.NET.dll & WinRT.Runtime.dll
$Parameters = @{
Uri = "https://www.nuget.org/api/v2/package/Microsoft.Windows.SDK.NET.Ref"
OutFile = "$PSScriptRoot\microsoft.windows.sdk.net.ref.nupkg"
UseBasicParsing = $true
}
Invoke-RestMethod @Parameters
# Rename archive to able to expand it
Rename-Item -Path "$PSScriptRoot\microsoft.windows.sdk.net.ref.nupkg" -NewName "$PSScriptRoot\microsoft.windows.sdk.net.ref.zip" -Force
# Extract Microsoft.Windows.SDK.NET.dll & WinRT.Runtime.dll from archive
Add-Type -Assembly System.IO.Compression.FileSystem
$ZIP = [IO.Compression.ZipFile]::OpenRead("$PSScriptRoot\microsoft.windows.sdk.net.ref.zip")
$Entries = $ZIP.Entries | Where-Object -FilterScript {($_.FullName -eq "lib/Microsoft.Windows.SDK.NET.dll") -or ($_.FullName -eq "lib/WinRT.Runtime.dll")}
$Entries | ForEach-Object -Process {[IO.Compression.ZipFileExtensions]::ExtractToFile($_, "$PSScriptRoot\$($_.Name)", $true)}
$ZIP.Dispose()
- name: Sophia Script for Windows 10
run: |
# https://github.com/farag2/Sophia-Script-for-Windows/blob/master/sophia_script_versions.json
$Parameters = @{
Uri = "https://raw.githubusercontent.com/farag2/Sophia-Script-for-Windows/master/sophia_script_versions.json"
}
$LatestRelease = (Invoke-RestMethod @Parameters).Sophia_Script_Windows_10_PowerShell_5_1
Write-Verbose -Message "Sophia.Script.for.Windows.10.v$LatestRelease.zip" -Verbose
New-Item -Path "Sophia Script for Windows 10 v$LatestRelease\bin" -ItemType Directory -Force
$Parameters = @{
Path = @("$PSScriptRoot\PolicyFileEditor")
Destination = "Sophia Script for Windows 10 v$LatestRelease\bin"
Recurse = $true
Force = $true
}
Copy-Item @Parameters
Get-ChildItem -Path "Sophia Script\Sophia Script for Windows 10" -Force | Copy-Item -Destination "Sophia Script for Windows 10 v$LatestRelease" -Recurse -Force
$Parameters = @{
Path = "Sophia Script for Windows 10 v$LatestRelease"
DestinationPath = "Sophia.Script.for.Windows.10.v$LatestRelease.zip"
CompressionLevel = "Fastest"
Force = $true
}
Compress-Archive @Parameters
# Calculate hash
Get-Item -Path "Sophia.Script.for.Windows.10.v$LatestRelease.zip" -Force | ForEach-Object -Process {
"$($_.Name) $((Get-FileHash -LiteralPath $_.FullName -Algorithm SHA256).Hash)"
} | Add-Content -Path SHA256SUM -Encoding Default -Force
- name: Sophia Script for Windows 10 PowerShell 7
run: |
# https://github.com/farag2/Sophia-Script-for-Windows/blob/master/sophia_script_versions.json
$Parameters = @{
Uri = "https://raw.githubusercontent.com/farag2/Sophia-Script-for-Windows/master/sophia_script_versions.json"
}
$LatestRelease = (Invoke-RestMethod @Parameters).Sophia_Script_Windows_10_PowerShell_7
Write-Verbose -Message "Sophia.Script.for.Windows.10.PowerShell.7.v$LatestRelease.zip" -Verbose
New-Item -Path "Sophia Script for Windows 10 PowerShell 7 v$LatestRelease\bin" -ItemType Directory -Force
$Parameters = @{
Path = @("$PSScriptRoot\PolicyFileEditor", "$PSScriptRoot\WinRT.Runtime.dll", "$PSScriptRoot\Microsoft.Windows.SDK.NET.dll")
Destination = "Sophia Script for Windows 10 PowerShell 7 v$LatestRelease\bin"
Recurse = $true
Force = $true
}
Copy-Item @Parameters
Get-ChildItem -Path "Sophia Script\Sophia Script for Windows 10 PowerShell 7" -Force | Copy-Item -Destination "Sophia Script for Windows 10 PowerShell 7 v$LatestRelease" -Recurse -Force
$Parameters = @{
Path = "Sophia Script for Windows 10 PowerShell 7 v$LatestRelease"
DestinationPath = "Sophia.Script.for.Windows.10.PowerShell.7.v$LatestRelease.zip"
CompressionLevel = "Fastest"
Force = $true
}
Compress-Archive @Parameters
# Calculate hash
Get-Item -Path "Sophia.Script.for.Windows.10.PowerShell.7.v$LatestRelease.zip" -Force | ForEach-Object -Process {
"$($_.Name) $((Get-FileHash -LiteralPath $_.FullName -Algorithm SHA256).Hash)"
} | Add-Content -Path SHA256SUM -Encoding Default -Force
- name: Sophia Script for Windows 10 LTSC 2019
run: |
# https://github.com/farag2/Sophia-Script-for-Windows/blob/master/sophia_script_versions.json
$Parameters = @{
Uri = "https://raw.githubusercontent.com/farag2/Sophia-Script-for-Windows/master/sophia_script_versions.json"
}
$LatestRelease = (Invoke-RestMethod @Parameters).Sophia_Script_Windows_10_LTSC2019
Write-Verbose -Message "Sophia.Script.for.Windows.10.LTSC.2019.v$LatestRelease.zip" -Verbose
New-Item -Path "Sophia Script for Windows 10 LTSC 2019 v$LatestRelease\bin" -ItemType Directory -Force
$Parameters = @{
Path = @("$PSScriptRoot\PolicyFileEditor")
Destination = "Sophia Script for Windows 10 LTSC 2019 v$LatestRelease\bin"
Recurse = $true
Force = $true
}
Copy-Item @Parameters
Get-ChildItem -Path "Sophia Script\Sophia Script for Windows 10 LTSC 2019" -Force | Copy-Item -Destination "Sophia Script for Windows 10 LTSC 2019 v$LatestRelease" -Recurse -Force
$Parameters = @{
Path = "Sophia Script for Windows 10 LTSC 2019 v$LatestRelease"
DestinationPath = "Sophia.Script.for.Windows.10.LTSC.2019.v$LatestRelease.zip"
CompressionLevel = "Fastest"
Force = $true
}
Compress-Archive @Parameters
# Calculate hash
Get-Item -Path "Sophia.Script.for.Windows.10.LTSC.2019.v$LatestRelease.zip" -Force | ForEach-Object -Process {
"$($_.Name) $((Get-FileHash -LiteralPath $_.FullName -Algorithm SHA256).Hash)"
} | Add-Content -Path SHA256SUM -Encoding Default -Force
- name: Sophia Script for Windows 10 LTSC 2021
run: |
# https://github.com/farag2/Sophia-Script-for-Windows/blob/master/sophia_script_versions.json
$Parameters = @{
Uri = "https://raw.githubusercontent.com/farag2/Sophia-Script-for-Windows/master/sophia_script_versions.json"
}
$LatestRelease = (Invoke-RestMethod @Parameters).Sophia_Script_Windows_10_LTSC2021
Write-Verbose -Message "Sophia.Script.for.Windows.10.LTSC.2021.v$LatestRelease.zip" -Verbose
New-Item -Path "Sophia Script for Windows 10 LTSC 2021 v$LatestRelease\bin" -ItemType Directory -Force
$Parameters = @{
Path = @("$PSScriptRoot\PolicyFileEditor")
Destination = "Sophia Script for Windows 10 LTSC 2021 v$LatestRelease\bin"
Recurse = $true
Force = $true
}
Copy-Item @Parameters
Get-ChildItem -Path "Sophia Script\Sophia Script for Windows 10 LTSC 2021" -Force | Copy-Item -Destination "Sophia Script for Windows 10 LTSC 2021 v$LatestRelease" -Recurse -Force
$Parameters = @{
Path = "Sophia Script for Windows 10 LTSC 2021 v$LatestRelease"
DestinationPath = "Sophia.Script.for.Windows.10.LTSC.2021.v$LatestRelease.zip"
CompressionLevel = "Fastest"
Force = $true
}
Compress-Archive @Parameters
# Calculate hash
Get-Item -Path "Sophia.Script.for.Windows.10.LTSC.2021.v$LatestRelease.zip" -Force | ForEach-Object -Process {
"$($_.Name) $((Get-FileHash -LiteralPath $_.FullName -Algorithm SHA256).Hash)"
} | Add-Content -Path SHA256SUM -Encoding Default -Force
- name: Sophia Script for Windows 11
run: |
# https://github.com/farag2/Sophia-Script-for-Windows/blob/master/sophia_script_versions.json
$Parameters = @{
Uri = "https://raw.githubusercontent.com/farag2/Sophia-Script-for-Windows/master/sophia_script_versions.json"
}
$LatestRelease = (Invoke-RestMethod @Parameters).Sophia_Script_Windows_11_PowerShell_5_1
Write-Verbose -Message "Sophia.Script.for.Windows.11.v$LatestRelease.zip" -Verbose
New-Item -Path "Sophia Script for Windows 11 v$LatestRelease\bin" -ItemType Directory -Force
$Parameters = @{
Path = @("$PSScriptRoot\PolicyFileEditor")
Destination = "Sophia Script for Windows 11 v$LatestRelease\bin"
Recurse = $true
Force = $true
}
Copy-Item @Parameters
Get-ChildItem -Path "Sophia Script\Sophia Script for Windows 11" -Force | Copy-Item -Destination "Sophia Script for Windows 11 v$LatestRelease" -Recurse -Force
$Parameters = @{
Path = "Sophia Script for Windows 11 v$LatestRelease"
DestinationPath = "Sophia.Script.for.Windows.11.v$LatestRelease.zip"
CompressionLevel = "Fastest"
Force = $true
}
Compress-Archive @Parameters
# Calculate hash
Get-Item -Path "Sophia.Script.for.Windows.11.v$LatestRelease.zip" -Force | ForEach-Object -Process {
"$($_.Name) $((Get-FileHash -LiteralPath $_.FullName -Algorithm SHA256).Hash)"
} | Add-Content -Path SHA256SUM -Encoding Default -Force
- name: Sophia Script for Windows 11 PowerShell 7
run: |
# https://github.com/farag2/Sophia-Script-for-Windows/blob/master/sophia_script_versions.json
$Parameters = @{
Uri = "https://raw.githubusercontent.com/farag2/Sophia-Script-for-Windows/master/sophia_script_versions.json"
}
$LatestRelease = (Invoke-RestMethod @Parameters).Sophia_Script_Windows_11_PowerShell_7
Write-Verbose -Message "Sophia.Script.for.Windows.11.PowerShell.7.v$LatestRelease.zip" -Verbose
New-Item -Path "Sophia Script for Windows 11 PowerShell 7 v$LatestRelease\bin" -ItemType Directory -Force
$Parameters = @{
Path = @("$PSScriptRoot\PolicyFileEditor", "$PSScriptRoot\WinRT.Runtime.dll", "$PSScriptRoot\Microsoft.Windows.SDK.NET.dll")
Destination = "Sophia Script for Windows 11 PowerShell 7 v$LatestRelease\bin"
Recurse = $true
Force = $true
}
Copy-Item @Parameters
Get-ChildItem -Path "Sophia Script\Sophia Script for Windows 11 PowerShell 7" -Force | Copy-Item -Destination "Sophia Script for Windows 11 PowerShell 7 v$LatestRelease" -Recurse -Force
$Parameters = @{
Path = "Sophia Script for Windows 11 PowerShell 7 v$LatestRelease"
DestinationPath = "Sophia.Script.for.Windows.11.PowerShell.7.v$LatestRelease.zip"
CompressionLevel = "Fastest"
Force = $true
}
Compress-Archive @Parameters
# Calculate hash
Get-Item -Path "Sophia.Script.for.Windows.11.PowerShell.7.v$LatestRelease.zip" -Force | ForEach-Object -Process {
"$($_.Name) $((Get-FileHash -LiteralPath $_.FullName -Algorithm SHA256).Hash)"
} | Add-Content -Path SHA256SUM -Encoding Default -Force
- name: Sophia Script Wrapper
run: |
# https://github.com/farag2/Sophia-Script-for-Windows/blob/master/sophia_script_versions.json
$Parameters = @{
Uri = "https://raw.githubusercontent.com/farag2/Sophia-Script-for-Windows/master/sophia_script_versions.json"
}
$LatestRelease = (Invoke-RestMethod @Parameters).Sophia_Script_Wrapper
Write-Verbose -Message "Sophia.Script.Wrapper.v$LatestRelease.zip" -Verbose
New-Item -Path "Sophia Script Wrapper v$LatestRelease" -ItemType Directory -Force
Get-ChildItem -Path Wrapper -Exclude README.md -Force | Copy-Item -Destination "Sophia Script Wrapper v$LatestRelease" -Recurse -Force
$Parameters = @{
Path = "Sophia Script Wrapper v$LatestRelease"
DestinationPath = "Sophia.Script.Wrapper.v$LatestRelease.zip"
CompressionLevel = "Fastest"
Force = $true
}
Compress-Archive @Parameters
# Calculate hash
Get-Item -Path "Sophia.Script.Wrapper.v$LatestRelease.zip" -Force | ForEach-Object -Process {
"$($_.Name) $((Get-FileHash -LiteralPath $_.FullName -Algorithm SHA256).Hash)"
} | Add-Content -Path SHA256SUM -Encoding Default -Force
- name: Upload archives to release
uses: svenstaro/upload-release-action@master
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: Sophia*.zip
tag: ${{ github.ref }}
overwrite: true
file_glob: true
prerelease: true
- name: Upload archives to release
uses: svenstaro/upload-release-action@master
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: SHA256SUM
tag: ${{ github.ref }}
overwrite: true
file_glob: true
prerelease: true