-
-
Notifications
You must be signed in to change notification settings - Fork 555
150 lines (127 loc) · 5.63 KB
/
apbx.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
name: Create and Validate Atlas Playbook
on:
push:
paths:
- "src/**"
env:
SXSC_REPO: "https://github.com/Atlas-OS/sxsc"
jobs:
package-build:
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
token: ${{ secrets.RUNNER_SECRET }}
- name: Get changed files
id: changed-files
uses: tj-actions/[email protected]
with:
files_yaml: |
sxsc:
- 'src/sxsc/*.yaml'
- name: Copy modified .yamls
run: |
$sxsc = '.\src\sxsc'
$configs = '..\configs'
mkdir $configs | Out-Null
if ('${{ steps.changed-files.outputs.sxsc_any_changed }}' -eq 'true') {
$changedFiles = '${{ steps.changed-files.outputs.sxsc_all_changed_files }}' -split ' '
} elseif (Test-Path "$sxsc\regenAllConfigs") {
Write-Output "Regenerating all configs..."
Remove-Item -Path "$sxsc\regenAllConfigs" -Force
Remove-Item -Path ".\src\playbook\Executables\AtlasModules\Packages\*.cab" -Force -Recurse
$changedFiles = Get-ChildItem $sxsc -Filter *.yaml
} else {
Write-Output "Not building any packages, no sxsc config changes detected."
"runSxsc=false" >> $env:GITHUB_ENV
exit
}
"runSxsc=true" >> $env:GITHUB_ENV
foreach ($file in $changedFiles) {
Write-Output "Copying: $file"
Copy-Item $file $configs -Force
}
- name: Clone the sxsc repository
run: |
git clone --depth=1 ${{ env.SXSC_REPO }}
Copy-Item -Path "configs" -Destination ".\sxsc\configs" -Recurse -Force
working-directory: ..
if: env.runSxsc == 'true'
- name: Build CAB
run: |
Write-Output "Installing dependencies..."
pip install -r requirements.txt | Out-Null
$atlasSrcPath = '..\Atlas\src\'
$packagePath = "$atlasSrcPath\playbook\Executables\AtlasModules\Packages"
mkdir $packagePath -EA 0 | Out-Null
Get-ChildItem "configs" -Filter *.yaml | ForEach-Object {
Write-Output "`n`nProcessing $($_.Name)`n------------------------------------------------------"
Copy-Item -Path $_.FullName -Destination "cfg.yaml" -Force | Out-Null
$folderDir = ".\$atlasSrcPath\sxsc\$($_.Name -replace '-Arm','')"
if (Test-Path $folderDir -PathType Container) {
Write-Output "Copying $($_.Name)'s files..."
Copy-Item -Path "$folderDir\*" -Destination '.\' -Recurse -Force | Out-Null
}
Write-Output "Generating package files..."
python sxsc.py
if ($LASTEXITCODE -ne 0) { exit 1 }
Write-Output "Building package..."
.\build.bat
Write-Output "Copying package to AtlasModules..."
Get-ChildItem -File -Recurse -Filter *.cab | ForEach-Object {
Copy-Item -Path $_.FullName -Destination $packagePath -Force
}
Write-Output "Cleaning up..."
.\clean.bat
}
working-directory: ..\sxsc
if: env.runSxsc == 'true'
- name: Commit and push changes
run: |
git config --local user.email "[email protected]"
git config --local user.name "atlasos-admin"
git add -A
git commit -m "feat: auto-update CAB packages ($($env:GITHUB_SHA.Substring(0, 8)))"
git push
working-directory: src\playbook\Executables\AtlasModules\Packages
if: env.runSxsc == 'true'
build:
needs: package-build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
- name: Validate YAML files
run: 'yamllint -d "{extends: relaxed, rules: {empty-lines: disable, line-length: disable, new-line-at-end-of-file: disable, trailing-spaces: disable}}" src/playbook/.'
- name: Configure playbook
id: config-playbook
if: ${{ !startsWith(github.ref, 'refs/heads/na-') }}
run: |
cd src/playbook
echo "Making playbook display as unverified (remove ProductCode) so that it is not marked as malicious..."
sed -i '/<ProductCode>/d' playbook.conf
echo "Change description of playbook..."
sed -i 's|<Description>.*<\/Description>|<Description>Experimental testing version of the Atlas Playbook, built with GitHub Actions from commit ${{ github.sha }}. Be aware of these builds being potentially unstable and buggy!</Description>|g' playbook.conf
cd Configuration
echo "Enabling AME Wizard Live Log..."
sed -i '7s/ #//' custom.yml
- name: Create playbook (ZIP/APBX password is malte)
if: ${{ steps.config-playbook.outcome != 'skipped' }}
run: |
cd src/playbook
echo "Making a renamed password protected (malte) ZIP of playbook files..."
zip -r -P malte "Atlas Playbook ${GITHUB_SHA::8}.apbx" . -x "local-build.cmd"
echo "Move the .abpx playbook into the 'Release ZIP' to be released as an artifact with the additional files..."
mv "Atlas Playbook ${GITHUB_SHA::8}.apbx" "../release-zip"
- name: Upload artifact
uses: actions/upload-artifact@v4
if: ${{ steps.config-playbook.outcome != 'skipped' }}
with:
name: Atlas Playbook
path: |
src/release-zip/*
if-no-files-found: error