-
Notifications
You must be signed in to change notification settings - Fork 386
Created Windows Installer + Nightly Builds #357
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: Publish Nightly Release | ||
|
||
on: | ||
schedule: | ||
- cron: '0 0 * * *' # This runs the workflow nightly at midnight UTC | ||
workflow_dispatch: # Allows manual triggering of the workflow | ||
|
||
jobs: | ||
build: | ||
runs-on: windows-latest | ||
|
||
steps: | ||
- name: Get current date | ||
id: date | ||
run: echo "::set-output name=date::$(date +'%Y-%m-%d')" | ||
|
||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Run PowerShell script | ||
shell: pwsh | ||
run: ./nightly_build.ps1 | ||
|
||
- name: Create Release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: nightly-tag-${{ steps.date.outputs.date }} | ||
release_name: nightly-release-${{ steps.date.outputs.date }} | ||
draft: false | ||
prerelease: true | ||
|
||
- name: Upload Release Asset | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: .\StableSwarmUI-Installer.exe | ||
asset_name: StableSwarmUI-Installer.exe | ||
asset_content_type: application/octet-stream |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
# NSIS script to create an installer. command: makensis.exe /LAUNCH .\installer_script.nsi | ||
|
||
# Include Modern UI | ||
!include "MUI2.nsh" | ||
|
||
# Compression method, '/SOLID lzma' takes least space | ||
# setCompressor /SOLID lzma | ||
|
||
!define MUI_ICON "src\wwwroot\favicon.ico" | ||
!define MUI_UNICON "src\wwwroot\favicon.ico" | ||
!define UNINSTALLER "uninstaller.exe" | ||
!define REG_UNINSTALL "Software\Microsoft\Windows\CurrentVersion\Uninstall\StableSwarmUI" | ||
|
||
# Define variables | ||
Name "StableSwarmUI" | ||
OutFile "StableSwarmUI-Installer.exe" | ||
# Var FilePath | ||
|
||
# Default installation directory | ||
InstallDir "$PROFILE\StableSwarmUI" | ||
|
||
# Request application privileges for Windows Vista and later | ||
RequestExecutionLevel admin | ||
|
||
# Pages | ||
!insertmacro MUI_PAGE_WELCOME | ||
!insertmacro MUI_PAGE_LICENSE "LICENSE.txt" | ||
!insertmacro MUI_PAGE_COMPONENTS | ||
!insertmacro MUI_PAGE_DIRECTORY | ||
!insertmacro MUI_PAGE_INSTFILES | ||
!insertmacro MUI_PAGE_FINISH | ||
|
||
!insertmacro MUI_UNPAGE_WELCOME | ||
!insertmacro MUI_UNPAGE_CONFIRM | ||
!insertmacro MUI_UNPAGE_INSTFILES | ||
!insertmacro MUI_UNPAGE_FINISH | ||
|
||
!insertmacro MUI_LANGUAGE "English" # The first language is the default language | ||
|
||
# Sections | ||
Section "StableSwarmUI (required)" | ||
SetOutPath "$INSTDIR" | ||
# Add files to be installed | ||
File /r /x *.bat /x *.sh /x *.ps1 /x StableSwarmUI-Installer.exe /x DOCKERFILE /x .dockerignore \ | ||
/x docker-compose.yml /x colab /x .github /x .git /x bin ${__FILEDIR__}\*.* | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You're just... installing the Swarm files to a path? So still a raw source file install, but minus the scripts and files essential to actually run it There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I figured since the source files are packaged into an exe now they would not need the other scripts. In the powershell script the source code is built so they could show up as an application since I thought the batch file would be less familiar for a normal consumer. I can leave the mac and linux bash files but I thought it wouldn't be too helpful on a windows installer. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But it's still including eg It also appears to not be excluding eg There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, I seemed to overlooked that. I'll remove the .cs files and have it exclude the mentioned directories but still create empty folders for the models and similar folders. I thought the script to make the installer would only be ran by the remote repository for the newest build but I suppose it doesn't hurt to make it foolproof if ran on a computer with a model loaded. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Swarm's code autogenerates all needed folders already you don't need to worry about creating them. |
||
|
||
# Register with Windows Installer (Control Panel Add/Remove Programs) | ||
|
||
WriteRegStr HKLM64 "${REG_UNINSTALL}" "DisplayName" "StableSwarmUI" | ||
# sets the uninstall string | ||
WriteRegStr HKLM64 "${REG_UNINSTALL}" "UninstallString" "$\"$INSTDIR\${UNINSTALLER}$\"" | ||
WriteRegStr HKLM64 "${REG_UNINSTALL}" "InstallLocation" "$INSTDIR" | ||
WriteRegStr HKLM64 "${REG_UNINSTALL}" "DisplayIcon" "$INSTDIR\src\wwwroot\favicon.ico" | ||
# Name of the publisher in add or remove programs in control panel TODO: change to proper name | ||
WriteRegStr HKLM64 "${REG_UNINSTALL}" "Publisher" "Nirmal Senthilkumar" | ||
# Link to the github TODO: change to new github | ||
WriteRegStr HKLM64 "${REG_UNINSTALL}" "HelpLink" "https://github.com/nirmie/StableSwarmUI-EXE" | ||
# version | ||
WriteRegStr HKLM64 "${REG_UNINSTALL}" "DisplayVersion" "1.0.0" | ||
|
||
WriteUninstaller "$INSTDIR\${UNINSTALLER}" | ||
SectionEnd | ||
|
||
# Create Start Menu shortcut | ||
Section "Start Menu Shortcut" | ||
CreateDirectory "$SMPROGRAMS\StableSwarmUI" | ||
CreateShortCut "$SMPROGRAMS\StableSwarmUI\StableSwarmUI.lnk" "$INSTDIR\StableSwarmUI.exe" "" "" 0 | ||
SectionEnd | ||
|
||
# Uninstaller | ||
Section "Uninstall" | ||
# Delete the installed files | ||
Delete "$INSTDIR\*.*" | ||
# Remove uninstaller | ||
Delete "$INSTDIR\${UNINSTALLER}" | ||
# Remove Start Menu shortcut | ||
Delete "$SMPROGRAMS\StableSwarmUI\StableSwarmUI.lnk" | ||
# Remove installation directory | ||
RMDir /r "$INSTDIR\" | ||
# Remove Start Menu directory if it's empty | ||
RMDir "$SMPROGRAMS\StableSwarmUI" | ||
# Remove registry keys | ||
DeleteRegKey HKLM64 "${REG_UNINSTALL}" | ||
SectionEnd |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# Ensure correct local path. | ||
Set-Location -Path $PSScriptRoot | ||
|
||
# Microsoft borked the dotnet installer/path handler, so force x64 to be read first | ||
$env:PATH = "C:\Program Files\dotnet;$env:PATH" | ||
|
||
if (!(Test-Path .git)) { | ||
Write-Host "" | ||
Write-Host "WARNING: YOU DID NOT CLONE FROM GIT. THIS WILL BREAK SOME SYSTEMS. PLEASE INSTALL PER THE README." | ||
Write-Host "" | ||
} else { | ||
$CUR_HEAD = git rev-parse HEAD | ||
if (!(Test-Path src\bin\last_build)) { | ||
$BUILT_HEAD = 0 | ||
} else { | ||
$BUILT_HEAD = Get-Content src\bin\last_build | ||
} | ||
if ($CUR_HEAD -ne $BUILT_HEAD) { | ||
Write-Host "" | ||
Write-Host "WARNING: You did a git pull without building. Will now build for you..." | ||
Write-Host "" | ||
if (Test-Path .\src\bin\live_release_backup) { | ||
Remove-Item -Path .\src\bin\live_release_backup -Recurse -Force | ||
} | ||
if (Test-Path .\src\bin\live_release_backup) { | ||
Move-Item -Path .\src\bin\live_release -Destination .\src\bin\live_release_backup | ||
} | ||
} | ||
} | ||
|
||
# Build the program if it isn't already built | ||
if (!(Test-Path src\bin\live_release\StableSwarmUI.dll)) { | ||
# For some reason Microsoft's nonsense is missing the official nuget source? So forcibly add that to be safe. | ||
dotnet nuget add source https://api.nuget.org/v3/index.json --name "NuGet official package source" | ||
|
||
dotnet publish src/StableSwarmUI.csproj -c Release -r win-x64 -o .\ -p:PublishSingleFile=true --self-contained true | ||
|
||
$CUR_HEAD2 = git rev-parse HEAD | ||
if (Test-Path src/bin/last_build) { | ||
$CUR_HEAD2 | Out-File -FilePath src/bin/last_build | ||
} | ||
} | ||
|
||
# Default env configuration, gets overwritten by the C# code's settings handler | ||
$env:ASPNETCORE_ENVIRONMENT = "Production" | ||
$env:ASPNETCORE_URLS = "http://*:7801" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the majority of this script looks like... you converted the launch-windows.bat file to powershell? (there's already a powershell launch script available...) and doesn't actually make sense to be included with the installer |
||
|
||
makensis.exe installer_script.nsi | ||
|
||
if ($LASTEXITCODE -ne 0) { | ||
Read-Host -Prompt "Press Enter to continue..." | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Creating a new release nightly would quickly spam the releases page - it would probably make more sense for it to just edit the file into the latest release rather than making a whole new release every time
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I was thinking about that, I will change it so it edits the same release.