-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathbuild-release.ps1
More file actions
79 lines (68 loc) · 2.06 KB
/
Copy pathbuild-release.ps1
File metadata and controls
79 lines (68 loc) · 2.06 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
#Requires -Version 5.1
<#
.SYNOPSIS
build-release.ps1 — M365 Assessment Toolkit
Packages the release files into a zip ready to attach to a GitHub release.
.USAGE
.\build-release.ps1
Output: C:\AssetTool\release\M365-Assessment-Toolkit-v<version>.zip
#>
$ErrorActionPreference = "Stop"
# Read version
$Version = (Get-Content "$PSScriptRoot\VERSION" -Raw).Trim()
$ZipName = "M365-Assessment-Toolkit-v$Version.zip"
$ReleaseDir = "$PSScriptRoot\release"
$ZipPath = "$ReleaseDir\$ZipName"
# Files and folders to include
$Include = @(
"backend.py",
"index.html",
"generate-report.js",
"package.json",
"sample-data.json",
"sample-report.docx",
"requirements.txt",
"install.ps1",
"update.ps1",
"uninstall.ps1",
"Setup-M365AssessmentToolkit.ps1",
"VERSION",
"CHANGELOG.md",
"README.md",
"SECURITY.md",
"CONTRIBUTING.md",
"LICENSE",
"scripts",
"remediation",
"Start-Tool.bat"
# Note: docs/ folder excluded — internal planning files only, not for end users
)
# Create release folder if it doesn't exist
if (-not (Test-Path $ReleaseDir)) {
New-Item -ItemType Directory -Path $ReleaseDir | Out-Null
}
# Remove existing zip if present
if (Test-Path $ZipPath) {
Remove-Item $ZipPath -Force
}
# Build a temp staging folder
$TempDir = "$env:TEMP\M365-Assessment-Toolkit-v$Version"
if (Test-Path $TempDir) { Remove-Item $TempDir -Recurse -Force }
New-Item -ItemType Directory -Path $TempDir | Out-Null
foreach ($item in $Include) {
$Source = "$PSScriptRoot\$item"
if (Test-Path $Source) {
Copy-Item $Source "$TempDir\$item" -Recurse
} else {
Write-Host " SKIP (not found): $item" -ForegroundColor Yellow
}
}
# Zip it
Compress-Archive -Path "$TempDir\*" -DestinationPath $ZipPath
# Clean up temp
Remove-Item $TempDir -Recurse -Force
Write-Host ""
Write-Host "Release zip built successfully:" -ForegroundColor Green
Write-Host " $ZipPath" -ForegroundColor Cyan
Write-Host ""
Write-Host "Next step: attach this file to the v$Version release on GitHub." -ForegroundColor Gray