Skip to content

Commit

Permalink
Add version info stub in releases to make quick reference for users w…
Browse files Browse the repository at this point in the history
…hen, for example, submitting bugs
  • Loading branch information
hozuki committed Aug 14, 2020
1 parent 21c2eec commit ce4215b
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 26 deletions.
1 change: 1 addition & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ build_script:
- cmd: msbuild ./src/MLTDTools.sln /p:Configuration=Release /verbosity:minimal /p:nowarn="1574,1591"
after_build:
- cmd: marked ./README.md -o ./README.html
- ps: .\scripts\write_version_info.ps1
- ps: .\scripts\pack_artifacts.ps1 -ZipName miritore.zip
test: false
deploy:
Expand Down
78 changes: 52 additions & 26 deletions scripts/pack_artifacts.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -20,41 +20,67 @@ function Test-TagRelease()
return $r
}

[String]$configuration = $env:CONFIGURATION
[String]$basePath = $env:APPVEYOR_BUILD_FOLDER

$subPaths = @(
[String]::Format("src/AcbPack/bin/{0}", $configuration),
[String]::Format("src/HcaDec/bin/{0}", $configuration),
[String]::Format("src/MillionDance/bin/x86/{0}", $configuration), # temporarily pinned to x86 because of AssetStudioUtilities
[String]::Format("src/MillionDanceView/bin/x86/{0}", $configuration), # temporarily pinned to x86 because of AssetStudioUtilities
[String]::Format("src/MiriTore.Common/bin/{0}", $configuration),
[String]::Format("src/MiriTore.Logging/bin/{0}", $configuration),
[String]::Format("src/MltdInfoViewer/bin/{0}", $configuration),
[String]::Format("src/ExtractAcb/bin/{0}", $configuration),
[String]::Format("src/TDFacial/bin/{0}", $configuration), # remember to include facial_expr.json
[String]::Format("src/ManifestTools/bin/{0}", $configuration),
[String]::Empty
);

foreach ($subPath in $subPaths)
function Add-ProgramFiles()
{
if ( [String]::IsNullOrEmpty($subPath))
[String]$configuration = $env:CONFIGURATION
[String]$basePath = $env:APPVEYOR_BUILD_FOLDER

[String[]]$subPaths = @(
[String]::Format("src/AcbPack/bin/{0}", $configuration),
[String]::Format("src/HcaDec/bin/{0}", $configuration),
[String]::Format("src/MillionDance/bin/x86/{0}", $configuration), # temporarily pinned to x86 because of AssetStudioUtilities
[String]::Format("src/MillionDanceView/bin/x86/{0}", $configuration), # temporarily pinned to x86 because of AssetStudioUtilities
[String]::Format("src/MiriTore.Common/bin/{0}", $configuration),
[String]::Format("src/MiriTore.Logging/bin/{0}", $configuration),
[String]::Format("src/MltdInfoViewer/bin/{0}", $configuration),
[String]::Format("src/ExtractAcb/bin/{0}", $configuration),
[String]::Format("src/TDFacial/bin/{0}", $configuration), # remember to include facial_expr.json
[String]::Format("src/ManifestTools/bin/{0}", $configuration),
[String]::Empty
);

foreach ($subPath in $subPaths)
{
continue
if ( [String]::IsNullOrEmpty($subPath))
{
continue;
}

[String]$fullDirPath = [System.IO.Path]::Combine($basePath, $subPath);
[String]$xmlFilesPattern = [System.IO.Path]::Combine($fullDirPath, "*.xml")

Remove-Item $xmlFilesPattern

[String]$allFilesPattern = [System.IO.Path]::Combine($fullDirPath, "*")

& 7z a $zipName -r $allFilesPattern
}
}

[String]$fullDirPath = [System.IO.Path]::Combine($basePath, $subPath);
[String]$xmlFilesPattern = [System.IO.Path]::Combine($fullDirPath, "*.xml")
function Add-MiscFiles()
{
[String]$buildDir = $env:APPVEYOR_BUILD_FOLDER;
[String[]]$subPaths = @(
"./README.html",
"./version.txt",
[String]::Empty
);

Remove-Item $xmlFilesPattern
foreach ($subPath in $subPaths)
{
if ( [String]::IsNullOrEmpty($subPath))
{
continue;
}

[String]$allFilesPattern = [System.IO.Path]::Combine($fullDirPath, "*")
[String]$fullPath = [System.IO.Path]::Combine($buildDir, $subPath);

& 7z a $zipName -r $allFilesPattern
& 7z a miritore.zip $fullPath
}
}

& 7z a miritore.zip "${env:APPVEYOR_BUILD_FOLDER}\README.html"
Add-ProgramFiles
Add-MiscFiles

[Boolean]$isTagRelease = Test-TagRelease
[String]$tagRelComp = if ($isTagRelease)
Expand Down
7 changes: 7 additions & 0 deletions scripts/write_version_info.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
param(
[String]$FilePath = "version.txt"
)

[String]$versionText = "${env:APPVEYOR_BUILD_VERSION}${env:RELEASE_SUFFIX}";

[System.IO.File]::WriteAllText($FilePath, $versionText, [System.Text.Encoding]::UTF8);
1 change: 1 addition & 0 deletions src/MLTDTools.sln
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "scripts", "scripts", "{A378
..\scripts\install.ps1 = ..\scripts\install.ps1
..\scripts\nuget_restore.ps1 = ..\scripts\nuget_restore.ps1
..\scripts\pack_artifacts.ps1 = ..\scripts\pack_artifacts.ps1
..\scripts\write_version_info.ps1 = ..\scripts\write_version_info.ps1
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AssetStudio", "..\thirdparty\AssetStudio\AssetStudio\AssetStudio.csproj", "{7662F8C2-7BFD-442E-A948-A43B4F7EB06E}"
Expand Down

0 comments on commit ce4215b

Please sign in to comment.