-
Notifications
You must be signed in to change notification settings - Fork 0
/
Release.ps1
90 lines (71 loc) · 3.39 KB
/
Release.ps1
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
###################
# forgottenspiral #
###################
# Ensure that you have set up the folder paths correctly and have 7z/git installed in your system/user path.
# Set up workspace folders before proceeding.
$workspace_folder = "$env:USERPROFILE\Documents\STALKER-PROJECTS\COP-PROJECT"
$release_folder = "$workspace_folder\COP_RELEASE"
$project_folder = "$workspace_folder\COP-MAIN-PROJECT"
# Navigate to the release folder.
Set-Location $release_folder
# Define the version for the release.
$patch_version = "v0.3"
# Begin release process.
Write-Host "====================" -ForegroundColor Green
Write-Host "Starting..." -ForegroundColor Green
Write-Host "====================" -ForegroundColor Green
# Define the destination folder for all the final files.
$final_folder = "Mini-addon_InGameSubs_$patch_version-for_PRP_v1.2"
# Create the folder for the files if it doesn't exist already.
If (Test-Path -Path "$final_folder") {
Write-host "$final_folder already exists." -ForegroundColor Green
}
Else {
New-Item "$final_folder" -ItemType Directory -Force
Write-host "$final_folder created successfully." -ForegroundColor Green
}
Write-Host "====================" -ForegroundColor Green
# Check if releasing is enabled.
$enable_release = "yes"
If ($enable_release -eq "yes") {
Write-Host "Releasing is enabled." -ForegroundColor Green
Write-Host "====================" -ForegroundColor Green
# Clone the project folder to a temporary location.
git clone $project_folder "$final_folder-temporal"
# Remove unnecessary files from the temporary folder.
Remove-Item -Path "$final_folder-temporal\.git" -Recurse -Force
Remove-Item -Path "$final_folder-temporal\.gitignore" -Recurse -Force
Remove-Item -Path "$final_folder-temporal\.gitattributes" -Recurse -Force
Remove-Item -Path "$final_folder-temporal\CHANGELOG.md" -Recurse -Force
Remove-Item -Path "$final_folder-temporal\README.md" -Recurse -Force
Remove-Item -Path "$final_folder-temporal\Release.ps1" -Recurse -Force
# Copy the files from the temporary folder to the final one.
Copy-Item -Path "$final_folder-temporal\*" -Destination $final_folder -Recurse -Force
# Remove the temporary folder.
Remove-Item -Path "$final_folder-temporal" -Recurse -Force
# Delete unnecessary or debug files manually.
# Copy the Instructions and Additional Notes file.
Copy-Item "$release_folder\Instructions_and_Additional_Notes.txt" -Destination "$final_folder\Instructions_and_Additional_Notes_$patch_version.txt" -Force
Write-Host "====================" -ForegroundColor Green
# Copy the Readme and Changelog file.
Copy-Item "$release_folder\Readme_and_Changelog.txt" -Destination "$final_folder\Readme_and_Changelog_$patch_version.txt" -Force
Write-Host "====================" -ForegroundColor Green
}
Else {
Write-Host "Releasing is disabled." -ForegroundColor Yellow
Write-Host "====================" -ForegroundColor Yellow
}
# Compress the final folder with 7z if it doesn't already exist.
If (!(Test-Path -Path "$final_folder.7z")) {
7z.exe a "$final_folder.7z" "$final_folder\"
Write-Host "Compressed the final folder successfully." -ForegroundColor Green
Write-Host "====================" -ForegroundColor Green
}
Else {
Write-Host "Compressed file is uncreated." -ForegroundColor Yellow
Write-Host "====================" -ForegroundColor Yellow
}
Write-Host "Complete." -ForegroundColor Green
Write-Host "====================" -ForegroundColor Green
Pause
Exit