mirror of
https://github.com/vleeuwenmenno/supplements.git
synced 2025-09-11 18:29:12 +02:00
feat: Add GitHub Actions workflows for building and releasing Android, iOS, Linux, and Windows applications
This commit is contained in:
206
.github/workflows/windows-build.yml
vendored
Normal file
206
.github/workflows/windows-build.yml
vendored
Normal file
@@ -0,0 +1,206 @@
|
||||
# .github/workflows/windows-build-github.yml
|
||||
name: Build Windows Release
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build Windows Release
|
||||
runs-on: windows-latest
|
||||
if: github.repository_owner == 'vleeuwenmenno' && contains(github.server_url, 'github.com')
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Flutter
|
||||
uses: subosito/flutter-action@v2
|
||||
with:
|
||||
channel: "stable"
|
||||
|
||||
- name: Enable Windows desktop support
|
||||
run: flutter config --enable-windows-desktop
|
||||
|
||||
- name: Install dependencies
|
||||
run: flutter pub get
|
||||
|
||||
- name: Build Windows release
|
||||
run: flutter build windows --release
|
||||
|
||||
- name: Extract version
|
||||
id: version
|
||||
shell: pwsh
|
||||
run: |
|
||||
$version = (Get-Content pubspec.yaml | Select-String "version:" | ForEach-Object { $_.ToString().Split(' ')[1] }).Split('+')[0]
|
||||
echo "APP_VERSION=$version" >> $env:GITHUB_ENV
|
||||
echo "Version extracted: $version"
|
||||
|
||||
- name: Create Windows installer directory structure
|
||||
shell: pwsh
|
||||
run: |
|
||||
# Create installer directory
|
||||
New-Item -ItemType Directory -Force -Path "installer"
|
||||
|
||||
# Copy the built app
|
||||
Copy-Item -Recurse "build\windows\x64\runner\Release\*" "installer\"
|
||||
|
||||
# Verify the executable exists
|
||||
if (Test-Path "installer\supplements.exe") {
|
||||
Write-Host "✓ supplements.exe found in installer directory"
|
||||
} else {
|
||||
Write-Host "✗ supplements.exe not found!"
|
||||
Get-ChildItem "installer" -Recurse
|
||||
exit 1
|
||||
}
|
||||
|
||||
- name: Create portable zip
|
||||
shell: pwsh
|
||||
run: |
|
||||
Compress-Archive -Path "installer\*" -DestinationPath "supplements_${{ env.APP_VERSION }}_windows_x64_portable.zip"
|
||||
|
||||
# Verify zip was created
|
||||
if (Test-Path "supplements_${{ env.APP_VERSION }}_windows_x64_portable.zip") {
|
||||
$size = (Get-Item "supplements_${{ env.APP_VERSION }}_windows_x64_portable.zip").Length / 1MB
|
||||
Write-Host "✓ Portable zip created successfully ($([math]::Round($size, 2)) MB)"
|
||||
} else {
|
||||
Write-Host "✗ Failed to create portable zip"
|
||||
exit 1
|
||||
}
|
||||
|
||||
- name: Create NSIS installer script
|
||||
shell: pwsh
|
||||
run: |
|
||||
$nsisScript = @"
|
||||
!define APP_NAME "supplements"
|
||||
!define APP_VERSION "${{ env.APP_VERSION }}"
|
||||
!define APP_PUBLISHER "vleeuwenmenno"
|
||||
!define APP_DESCRIPTION "A ComfyUI client with sync capabilities"
|
||||
!define APP_EXECUTABLE "supplements.exe"
|
||||
|
||||
!include "MUI2.nsh"
|
||||
|
||||
Name "`${APP_NAME} `${APP_VERSION}"
|
||||
OutFile "supplements_`${APP_VERSION}_windows_x64_installer.exe"
|
||||
InstallDir "`$PROGRAMFILES64\`${APP_NAME}"
|
||||
InstallDirRegKey HKLM "Software\`${APP_NAME}" "InstallDir"
|
||||
|
||||
RequestExecutionLevel admin
|
||||
|
||||
!define MUI_ABORTWARNING
|
||||
!define MUI_ICON "`${NSISDIR}\Contrib\Graphics\Icons\modern-install.ico"
|
||||
!define MUI_UNICON "`${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico"
|
||||
|
||||
!insertmacro MUI_PAGE_WELCOME
|
||||
!insertmacro MUI_PAGE_LICENSE "installer\LICENSE"
|
||||
!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"
|
||||
|
||||
Section "Install"
|
||||
SetOutPath "`$INSTDIR"
|
||||
File /r "installer\*"
|
||||
|
||||
WriteRegStr HKLM "Software\`${APP_NAME}" "InstallDir" "`$INSTDIR"
|
||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\`${APP_NAME}" "DisplayName" "`${APP_NAME}"
|
||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\`${APP_NAME}" "UninstallString" "`$INSTDIR\Uninstall.exe"
|
||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\`${APP_NAME}" "DisplayVersion" "`${APP_VERSION}"
|
||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\`${APP_NAME}" "Publisher" "`${APP_PUBLISHER}"
|
||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\`${APP_NAME}" "DisplayIcon" "`$INSTDIR\`${APP_EXECUTABLE}"
|
||||
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\`${APP_NAME}" "NoModify" 1
|
||||
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\`${APP_NAME}" "NoRepair" 1
|
||||
|
||||
CreateDirectory "`$SMPROGRAMS\`${APP_NAME}"
|
||||
CreateShortcut "`$SMPROGRAMS\`${APP_NAME}\`${APP_NAME}.lnk" "`$INSTDIR\`${APP_EXECUTABLE}"
|
||||
CreateShortcut "`$SMPROGRAMS\`${APP_NAME}\Uninstall.lnk" "`$INSTDIR\Uninstall.exe"
|
||||
CreateShortcut "`$DESKTOP\`${APP_NAME}.lnk" "`$INSTDIR\`${APP_EXECUTABLE}"
|
||||
|
||||
WriteUninstaller "`$INSTDIR\Uninstall.exe"
|
||||
SectionEnd
|
||||
|
||||
Section "Uninstall"
|
||||
Delete "`$INSTDIR\Uninstall.exe"
|
||||
RMDir /r "`$INSTDIR"
|
||||
RMDir /r "`$SMPROGRAMS\`${APP_NAME}"
|
||||
Delete "`$DESKTOP\`${APP_NAME}.lnk"
|
||||
|
||||
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\`${APP_NAME}"
|
||||
DeleteRegKey HKLM "Software\`${APP_NAME}"
|
||||
SectionEnd
|
||||
"@
|
||||
|
||||
$nsisScript | Out-File -FilePath "installer.nsi" -Encoding UTF8
|
||||
Write-Host "✓ NSIS script created"
|
||||
|
||||
- name: Create dummy LICENSE file
|
||||
shell: pwsh
|
||||
run: |
|
||||
$license = @"
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2025 vleeuwenmenno
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
"@
|
||||
|
||||
$license | Out-File -FilePath "installer\LICENSE" -Encoding UTF8
|
||||
Write-Host "✓ LICENSE file created"
|
||||
|
||||
- name: Build NSIS installer
|
||||
uses: joncloud/makensis-action@v4.1
|
||||
with:
|
||||
script-file: "installer.nsi"
|
||||
|
||||
- name: Verify installer creation
|
||||
shell: pwsh
|
||||
run: |
|
||||
# Verify installer was created
|
||||
if (Test-Path "supplements_${{ env.APP_VERSION }}_windows_x64_installer.exe") {
|
||||
$size = (Get-Item "supplements_${{ env.APP_VERSION }}_windows_x64_installer.exe").Length / 1MB
|
||||
Write-Host "✓ NSIS installer created successfully ($([math]::Round($size, 2)) MB)"
|
||||
} else {
|
||||
Write-Host "✗ Failed to create NSIS installer"
|
||||
Get-ChildItem . -Filter "*.exe" | ForEach-Object { Write-Host "Found: $($_.Name)" }
|
||||
exit 1
|
||||
}
|
||||
|
||||
- name: Debug release information
|
||||
run: |
|
||||
echo "Release tag: ${{ github.event.release.tag_name }}"
|
||||
echo "Release name: ${{ github.event.release.name }}"
|
||||
echo "Release URL: ${{ github.event.release.html_url }}"
|
||||
echo "App version: ${{ env.APP_VERSION }}"
|
||||
|
||||
- name: Upload Windows builds to GitHub Release
|
||||
shell: pwsh
|
||||
run: |
|
||||
gh release upload "${{ github.event.release.tag_name }}" "supplements_${{ env.APP_VERSION }}_windows_x64_portable.zip" --clobber
|
||||
gh release upload "${{ github.event.release.tag_name }}" "supplements_${{ env.APP_VERSION }}_windows_x64_installer.exe" --clobber
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
Reference in New Issue
Block a user