Skip to content

Commit

Permalink
Add gated program downloads to publish scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
mnadareski committed Dec 6, 2024
1 parent f1506b2 commit b4e0431
Show file tree
Hide file tree
Showing 3 changed files with 112 additions and 28 deletions.
1 change: 1 addition & 0 deletions CHANGELIST.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
- Remove unnecessary namespace prefixes
- Clean up original Drive tests
- Add debug flag to publish scripts
- Add gated program downloads to publish scripts

### 3.2.4 (2024-11-24)

Expand Down
42 changes: 42 additions & 0 deletions publish-nix.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# This batch file assumes the following:
# - .NET 9.0 (or newer) SDK is installed and in PATH
# - zip is installed and in PATH
# - wget is installed an in PATH
# - Git is installed and in PATH
# - The relevant commandline programs are already downloaded
# and put into their respective folders
Expand Down Expand Up @@ -203,6 +204,47 @@ fi

# Only create archives if requested
if [ $NO_ARCHIVE = false ]; then
# Download and extract, if needed
if [ $INCLUDE_PROGRAMS = true ]; then
echo "===== Downloading Required Programs ====="

# Aaru
# --- Skipped for now ---

# DiscImageCreator
wget https://github.com/user-attachments/files/17211434/DiscImageCreator_20241001.zip
unzip -u DiscImageCreator_20241001.zip

# Redumper
wget https://github.com/superg/redumper/releases/download/build_438/redumper-2024.11.03_build438-win64.zip
unzip redumper-2024.11.03_build438-win64.zip

# Create directories and copy data
for FRAMEWORK in "${UI_FRAMEWORKS[@]}"; do
for RUNTIME in "${UI_RUNTIMES[@]}"; do
if [ $INCLUDE_DEBUG = true ]; then
mkdir -p MPF.UI/bin/Debug/${FRAMEWORK}/${RUNTIME}/publish/Programs/Creator
cp -rf Release_ANSI/* MPF.UI/bin/Debug/${FRAMEWORK}/${RUNTIME}/publish/Programs/Creator/

mkdir -p MPF.UI/bin/Debug/${FRAMEWORK}/${RUNTIME}/publish/Programs/Redumper
cp -rf redumper-2024.11.03_build438-win64/bin/redumper.exe MPF.UI/bin/Debug/${FRAMEWORK}/${RUNTIME}/publish/Programs/Redumper/
fi

mkdir -p MPF.UI/bin/Release/${FRAMEWORK}/${RUNTIME}/publish/Programs/Creator
cp -rf Release_ANSI/* MPF.UI/bin/Release/${FRAMEWORK}/${RUNTIME}/publish/Programs/Creator/

mkdir -p MPF.UI/bin/Release/${FRAMEWORK}/${RUNTIME}/publish/Programs/Redumper
cp -rf redumper-2024.11.03_build438-win64/bin/redumper.exe MPF.UI/bin/Release/${FRAMEWORK}/${RUNTIME}/publish/Programs/Redumper/
done
done

# Clean up the odownloaded files and directories
rm DiscImageCreator_20241001.zip
rm -r Release_ANSI
rm redumper-2024.11.03_build438-win64.zip
rm -r redumper-2024.11.03_build438-win64
fi

# Create UI archives
for FRAMEWORK in "${UI_FRAMEWORKS[@]}"; do
for RUNTIME in "${UI_RUNTIMES[@]}"; do
Expand Down
97 changes: 69 additions & 28 deletions publish-win.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ if (!$NO_BUILD.IsPresent) {
dotnet restore

# Create Nuget Packages
dotnet pack MPF.ExecutionContexts\MPF.ExecutionContexts.csproj --output $BUILD_FOLDER
dotnet pack MPF.Processors\MPF.Processors.csproj --output $BUILD_FOLDER
dotnet pack MPF.ExecutionContexts/MPF.ExecutionContexts.csproj --output $BUILD_FOLDER
dotnet pack MPF.Processors/MPF.Processors.csproj --output $BUILD_FOLDER

# Build UI
foreach ($FRAMEWORK in $UI_FRAMEWORKS) {
Expand All @@ -96,16 +96,16 @@ if (!$NO_BUILD.IsPresent) {
if ($SINGLE_FILE_CAPABLE -contains $FRAMEWORK) {
# Only include Debug if set
if ($INCLUDE_DEBUG.IsPresent) {
dotnet publish MPF.UI\MPF.UI.csproj -f $FRAMEWORK -r $RUNTIME -c Debug --self-contained true --version-suffix $COMMIT -p:PublishSingleFile=true
dotnet publish MPF.UI/MPF.UI.csproj -f $FRAMEWORK -r $RUNTIME -c Debug --self-contained true --version-suffix $COMMIT -p:PublishSingleFile=true
}
dotnet publish MPF.UI\MPF.UI.csproj -f $FRAMEWORK -r $RUNTIME -c Release --self-contained true --version-suffix $COMMIT -p:PublishSingleFile=true -p:DebugType=None -p:DebugSymbols=false
dotnet publish MPF.UI/MPF.UI.csproj -f $FRAMEWORK -r $RUNTIME -c Release --self-contained true --version-suffix $COMMIT -p:PublishSingleFile=true -p:DebugType=None -p:DebugSymbols=false
}
else {
# Only include Debug if set
if ($INCLUDE_DEBUG.IsPresent) {
dotnet publish MPF.UI\MPF.UI.csproj -f $FRAMEWORK -r $RUNTIME -c Debug --self-contained true --version-suffix $COMMIT
dotnet publish MPF.UI/MPF.UI.csproj -f $FRAMEWORK -r $RUNTIME -c Debug --self-contained true --version-suffix $COMMIT
}
dotnet publish MPF.UI\MPF.UI.csproj -f $FRAMEWORK -r $RUNTIME -c Release --self-contained true --version-suffix $COMMIT -p:DebugType=None -p:DebugSymbols=false
dotnet publish MPF.UI/MPF.UI.csproj -f $FRAMEWORK -r $RUNTIME -c Release --self-contained true --version-suffix $COMMIT -p:DebugType=None -p:DebugSymbols=false
}
}
}
Expand All @@ -132,16 +132,16 @@ if (!$NO_BUILD.IsPresent) {
if ($SINGLE_FILE_CAPABLE -contains $FRAMEWORK) {
# Only include Debug if set
if ($INCLUDE_DEBUG.IsPresent) {
dotnet publish MPF.CLI\MPF.CLI.csproj -f $FRAMEWORK -r $RUNTIME -c Debug --self-contained true --version-suffix $COMMIT -p:PublishSingleFile=true
dotnet publish MPF.CLI/MPF.CLI.csproj -f $FRAMEWORK -r $RUNTIME -c Debug --self-contained true --version-suffix $COMMIT -p:PublishSingleFile=true
}
dotnet publish MPF.CLI\MPF.CLI.csproj -f $FRAMEWORK -r $RUNTIME -c Release --self-contained true --version-suffix $COMMIT -p:PublishSingleFile=true -p:DebugType=None -p:DebugSymbols=false
dotnet publish MPF.CLI/MPF.CLI.csproj -f $FRAMEWORK -r $RUNTIME -c Release --self-contained true --version-suffix $COMMIT -p:PublishSingleFile=true -p:DebugType=None -p:DebugSymbols=false
}
else {
# Only include Debug if set
if ($INCLUDE_DEBUG.IsPresent) {
dotnet publish MPF.CLI\MPF.CLI.csproj -f $FRAMEWORK -r $RUNTIME -c Debug --self-contained true --version-suffix $COMMIT
dotnet publish MPF.CLI/MPF.CLI.csproj -f $FRAMEWORK -r $RUNTIME -c Debug --self-contained true --version-suffix $COMMIT
}
dotnet publish MPF.CLI\MPF.CLI.csproj -f $FRAMEWORK -r $RUNTIME -c Release --self-contained true --version-suffix $COMMIT -p:DebugType=None -p:DebugSymbols=false
dotnet publish MPF.CLI/MPF.CLI.csproj -f $FRAMEWORK -r $RUNTIME -c Release --self-contained true --version-suffix $COMMIT -p:DebugType=None -p:DebugSymbols=false
}
}
}
Expand All @@ -168,23 +168,64 @@ if (!$NO_BUILD.IsPresent) {
if ($SINGLE_FILE_CAPABLE -contains $FRAMEWORK) {
# Only include Debug if set
if ($INCLUDE_DEBUG.IsPresent) {
dotnet publish MPF.Check\MPF.Check.csproj -f $FRAMEWORK -r $RUNTIME -c Debug --self-contained true --version-suffix $COMMIT -p:PublishSingleFile=true
dotnet publish MPF.Check/MPF.Check.csproj -f $FRAMEWORK -r $RUNTIME -c Debug --self-contained true --version-suffix $COMMIT -p:PublishSingleFile=true
}
dotnet publish MPF.Check\MPF.Check.csproj -f $FRAMEWORK -r $RUNTIME -c Release --self-contained true --version-suffix $COMMIT -p:PublishSingleFile=true -p:DebugType=None -p:DebugSymbols=false
dotnet publish MPF.Check/MPF.Check.csproj -f $FRAMEWORK -r $RUNTIME -c Release --self-contained true --version-suffix $COMMIT -p:PublishSingleFile=true -p:DebugType=None -p:DebugSymbols=false
}
else {
# Only include Debug if set
if ($INCLUDE_DEBUG.IsPresent) {
dotnet publish MPF.Check\MPF.Check.csproj -f $FRAMEWORK -r $RUNTIME -c Debug --self-contained true --version-suffix $COMMIT
dotnet publish MPF.Check/MPF.Check.csproj -f $FRAMEWORK -r $RUNTIME -c Debug --self-contained true --version-suffix $COMMIT
}
dotnet publish MPF.Check\MPF.Check.csproj -f $FRAMEWORK -r $RUNTIME -c Release --self-contained true --version-suffix $COMMIT -p:DebugType=None -p:DebugSymbols=false
dotnet publish MPF.Check/MPF.Check.csproj -f $FRAMEWORK -r $RUNTIME -c Release --self-contained true --version-suffix $COMMIT -p:DebugType=None -p:DebugSymbols=false
}
}
}
}

# Only create archives if requested
if (!$NO_ARCHIVE.IsPresent) {
# Download and extract, if needed
if ($INCLUDE_PROGRAMS.IsPresent) {
Write-Host "===== Downloading Required Programs ====="

# Aaru
# --- Skipped for now ---

# DiscImageCreator
Invoke-WebRequest -Uri https://github.com/user-attachments/files/17211434/DiscImageCreator_20241001.zip -OutFile DiscImageCreator_20241001.zip
Expand-Archive -LiteralPath "DiscImageCreator_20241001.zip" -DestinationPath "$BUILD_FOLDER/Creator"

# Redumper
Invoke-WebRequest -Uri https://github.com/superg/redumper/releases/download/build_438/redumper-2024.11.03_build438-win64.zip -OutFile redumper-2024.11.03_build438-win64.zip
Expand-Archive -LiteralPath "redumper-2024.11.03_build438-win64.zip" -DestinationPath "$BUILD_FOLDER/Redumper"

# Create directories and copy data
foreach ($FRAMEWORK in $UI_FRAMEWORKS) {
foreach ($RUNTIME in $UI_RUNTIMES) {
if ($INCLUDE_DEBUG.IsPresent) {
New-Item -Name "MPF.UI/bin/Debug/${FRAMEWORK}/${RUNTIME}/publish/Programs/Creator" -Type Directory -ErrorAction SilentlyContinue
Copy-Item -Path "Creator/Release_ANSI/*" -Destination "MPF.UI/bin/Debug/${FRAMEWORK}/${RUNTIME}/publish/Programs/Creator/" -Recurse -Force

New-Item -Name "MPF.UI/bin/Debug/${FRAMEWORK}/${RUNTIME}/publish/Programs/Redumper" -Type Directory -ErrorAction SilentlyContinue
Copy-Item -Path "Redumper/redumper-2024.11.03_build438-win64/bin/redumper.exe" -Destination "MPF.UI/bin/Debug/${FRAMEWORK}/${RUNTIME}/publish/Programs/Redumper/" -Force
}

New-Item -Name "MPF.UI/bin/Release/${FRAMEWORK}/${RUNTIME}/publish/Programs/Creator" -Type Directory -ErrorAction SilentlyContinue
Copy-Item -Path "Creator/Release_ANSI/*" -Destination "MPF.UI/bin/Release/${FRAMEWORK}/${RUNTIME}/publish/Programs/Creator/" -Recurse -Force

New-Item -Name "MPF.UI/bin/Release/${FRAMEWORK}/${RUNTIME}/publish/Programs/Redumper" -Type Directory -ErrorAction SilentlyContinue
Copy-Item -Path "Redumper/redumper-2024.11.03_build438-win64/bin/redumper.exe" -Destination "MPF.UI/bin/Release/${FRAMEWORK}/${RUNTIME}/publish/Programs/Redumper/" -Force
}
}

# Clean up the odownloaded files and directories
Remove-Item -Path "DiscImageCreator_20241001.zip"
Remove-Item -Path "Creator" -Recurse
Remove-Item -Path "redumper-2024.11.03_build438-win64.zip"
Remove-Item -Path "Redumper" -Recurse
}

# Create UI archives
foreach ($FRAMEWORK in $UI_FRAMEWORKS) {
foreach ($RUNTIME in $UI_RUNTIMES) {
Expand All @@ -205,21 +246,21 @@ if (!$NO_ARCHIVE.IsPresent) {

# Only include Debug if set
if ($INCLUDE_DEBUG.IsPresent) {
Set-Location -Path $BUILD_FOLDER\MPF.UI\bin\Debug\${FRAMEWORK}\${RUNTIME}\publish\
Set-Location -Path $BUILD_FOLDER/MPF.UI/bin/Debug/${FRAMEWORK}/${RUNTIME}/publish/
if ($INCLUDE_PROGRAMS.IsPresent) {
7z a -tzip $BUILD_FOLDER\MPF.UI_${FRAMEWORK}_${RUNTIME}_debug.zip *
7z a -tzip $BUILD_FOLDER/MPF.UI_${FRAMEWORK}_${RUNTIME}_debug.zip *
}
else {
7z a -tzip -x!Programs\* $BUILD_FOLDER\MPF.UI_${FRAMEWORK}_${RUNTIME}_debug.zip *
7z a -tzip -x!Programs/* $BUILD_FOLDER/MPF.UI_${FRAMEWORK}_${RUNTIME}_debug.zip *
}
}

Set-Location -Path $BUILD_FOLDER\MPF.UI\bin\Release\${FRAMEWORK}\${RUNTIME}\publish\
Set-Location -Path $BUILD_FOLDER/MPF.UI/bin/Release/${FRAMEWORK}/${RUNTIME}/publish/
if ($INCLUDE_PROGRAMS.IsPresent) {
7z a -tzip $BUILD_FOLDER\MPF.UI_${FRAMEWORK}_${RUNTIME}_release.zip *
7z a -tzip $BUILD_FOLDER/MPF.UI_${FRAMEWORK}_${RUNTIME}_release.zip *
}
else {
7z a -tzip -x!Programs\* $BUILD_FOLDER\MPF.UI_${FRAMEWORK}_${RUNTIME}_release.zip *
7z a -tzip -x!Programs/* $BUILD_FOLDER/MPF.UI_${FRAMEWORK}_${RUNTIME}_release.zip *
}
}
}
Expand All @@ -244,11 +285,11 @@ if (!$NO_ARCHIVE.IsPresent) {

# Only include Debug if set
if ($INCLUDE_DEBUG.IsPresent) {
Set-Location -Path $BUILD_FOLDER\MPF.CLI\bin\Debug\${FRAMEWORK}\${RUNTIME}\publish\
7z a -tzip $BUILD_FOLDER\MPF.CLI_${FRAMEWORK}_${RUNTIME}_debug.zip *
Set-Location -Path $BUILD_FOLDER/MPF.CLI/bin/Debug/${FRAMEWORK}/${RUNTIME}/publish/
7z a -tzip $BUILD_FOLDER/MPF.CLI_${FRAMEWORK}_${RUNTIME}_debug.zip *
}
Set-Location -Path $BUILD_FOLDER\MPF.CLI\bin\Release\${FRAMEWORK}\${RUNTIME}\publish\
7z a -tzip $BUILD_FOLDER\MPF.CLI_${FRAMEWORK}_${RUNTIME}_release.zip *
Set-Location -Path $BUILD_FOLDER/MPF.CLI/bin/Release/${FRAMEWORK}/${RUNTIME}/publish/
7z a -tzip $BUILD_FOLDER/MPF.CLI_${FRAMEWORK}_${RUNTIME}_release.zip *
}
}

Expand All @@ -272,11 +313,11 @@ if (!$NO_ARCHIVE.IsPresent) {

# Only include Debug if set
if ($INCLUDE_DEBUG.IsPresent) {
Set-Location -Path $BUILD_FOLDER\MPF.Check\bin\Debug\${FRAMEWORK}\${RUNTIME}\publish\
7z a -tzip $BUILD_FOLDER\MPF.Check_${FRAMEWORK}_${RUNTIME}_debug.zip *
Set-Location -Path $BUILD_FOLDER/MPF.Check/bin/Debug/${FRAMEWORK}/${RUNTIME}/publish/
7z a -tzip $BUILD_FOLDER/MPF.Check_${FRAMEWORK}_${RUNTIME}_debug.zip *
}
Set-Location -Path $BUILD_FOLDER\MPF.Check\bin\Release\${FRAMEWORK}\${RUNTIME}\publish\
7z a -tzip $BUILD_FOLDER\MPF.Check_${FRAMEWORK}_${RUNTIME}_release.zip *
Set-Location -Path $BUILD_FOLDER/MPF.Check/bin/Release/${FRAMEWORK}/${RUNTIME}/publish/
7z a -tzip $BUILD_FOLDER/MPF.Check_${FRAMEWORK}_${RUNTIME}_release.zip *
}
}

Expand Down

0 comments on commit b4e0431

Please sign in to comment.