Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows installer #1773

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -193,3 +193,10 @@ stencil_annotator/
# For DocuChat
apps/language_models/langchain/user_path/
db_dir_UserData

# Windows Installer Caches and Builds
windows_installer/shark_studio-cache/
windows_installer/shark_studio-SetupFiles/
windows_installer/shark_updater-SetupFiles/
windows_installer/shark_studio.aip
windows_installer/shark_updater.aip
64 changes: 64 additions & 0 deletions windows_installer/build_installer.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
param (
# Advanced Installer path in the computer
[Parameter(Mandatory=$true)]
[string]$ai_path,
# Version of MSI build
[Parameter(Mandatory=$true)]
[string]$version,
# Flag to indicate beta version
[switch]$beta
)

# Useful constants
$project_path = "./windows_installer/shark_studio.aip"
$updater_path = "./windows_installer/shark_updater.aip"
$project_files_path = -join($(pwd),"\dist\studio_bundle")

# These variables are affected by beta flag
$update_info_url = "https://github.com/nod-ai/SHARK/releases/latest/download/shark_updater.txt"
$update_msi_url = "https://github.com/nod-ai/SHARK/releases/latest/download/shark_studio.msi"
$msi_path = ".\windows_installer\shark_studio-SetupFiles\shark_studio.msi"

if ($beta) {
$update_info_url = "https://github.com/nod-ai/SHARK/releases/download/latest-nightly/shark_updater_beta.txt"
$update_msi_url = "https://github.com/nod-ai/SHARK/releases/download/latest-nightly/shark_studio_beta.msi"
$msi_path = ".\windows_installer\shark_studio-SetupFiles\shark_studio_beta.msi"
}


# Assuming pyinstaller has already been run

# Configures AIP to latest version of ./dist/studio_bundle
Write-Host "removing old files and shortcuts"
&$ai_path /edit $project_path /DelShortcut -name "Shark Studio" -dir "SHORTCUTDIR"
&$ai_path /edit $project_path /DelFolder "APPDIR\studio_bundle"

Write-Host "adding new files and shortcuts"
&$ai_path /edit $project_path /AddFolder "APPDIR" $project_files_path
&$ai_path /edit $project_path /NewShortcut -name "Shark Studio" -target "APPDIR\studio_bundle\studio_bundle.exe" -dir "SHORTCUTDIR" -runasadmin -pin_to_taskbar

Write-Host "setting version to $version"
&$ai_path /edit $project_path /SetVersion $version

# Sets update url based on beta flag
&$ai_path /edit $project_path /SetUpdatesUrl $update_info_url

# Builds the msi
&$ai_path /rebuild $project_path

# Renames the msi if beta flag is on (TODO)
if ($beta) {
Rename-Item -Path "./windows_installer/shark_studio-SetupFiles/shark_studio.msi" -NewName "shark_studio_beta.msi"
}

# Resets to latest msi
&$ai_path /edit $updater_path /DeleteUpdate Update
&$ai_path /edit $updater_path /NewUpdate $msi_path -name Update -display_name "shark_update" -url $update_msi_url

# builds shark_updater.txt
&$ai_path /rebuild $updater_path

# Renames shark_updater.txt if beta flag is on
if ($beta) {
Rename-Item -Path "./windows_installer/shark_updater-SetupFiles/shark_updater.txt" -NewName "shark_updater_beta.txt"
}
Loading