diff --git a/.gitea/workflows/release.yaml b/.gitea/workflows/release.yaml index a692fc8..d5819f0 100644 --- a/.gitea/workflows/release.yaml +++ b/.gitea/workflows/release.yaml @@ -23,12 +23,17 @@ jobs: - name: Build Release run: dotnet build --configuration Release --no-restore - - name: Publish - run: dotnet publish DellMonitorControl/DellMonitorControl.csproj -c Release -o ./publish --self-contained false - - - name: Create ZIP archive - run: Compress-Archive -Path ./publish/* -DestinationPath ./MonitorControl-${{ gitea.ref_name }}.zip + - name: Update version in ISS shell: powershell + run: | + $version = "${{ gitea.ref_name }}".TrimStart("v") + $issPath = "DellMonitorControl/MonitorControl.iss" + (Get-Content $issPath) -replace '#define MyAppVersion ".*"', "#define MyAppVersion `"$version`"" | Set-Content $issPath + + - name: Build Installer + shell: cmd + run: | + "C:\Program Files (x86)\Inno Setup 6\ISCC.exe" DellMonitorControl\MonitorControl.iss - name: Create Release shell: powershell @@ -36,6 +41,7 @@ jobs: GITEA_TOKEN: ${{ secrets.RELEASE_TOKEN }} run: | $tag = "${{ gitea.ref_name }}" + $version = $tag.TrimStart("v") $repo = "misc/ControlMyMonitorManagement" $baseUrl = "https://git.marketally.com/api/v1" @@ -51,7 +57,7 @@ jobs: $body = @{ tag_name = $tag name = "Monitor Control $tag" - body = "## Monitor Control $tag`n`n### Installation`n1. Download the ZIP file`n2. Extract to a folder`n3. Run DellMonitorControl.exe`n`n### Requirements`n- Windows 10/11`n- .NET 9.0 Runtime" + body = "## Monitor Control $tag`n`n### Installation`nDownload and run the installer.`n`n### Features`n- System tray monitor control`n- Brightness/Contrast adjustment`n- Input source switching`n- Quick-switch toolbar`n`n### Requirements`n- Windows 10/11`n- .NET 9.0 Runtime" } | ConvertTo-Json $release = Invoke-RestMethod -Uri "$baseUrl/repos/$repo/releases" -Method Post -Headers @{"Authorization"="token $env:GITEA_TOKEN"; "Content-Type"="application/json"} -Body $body @@ -59,11 +65,11 @@ jobs: Write-Host "Release created with ID: $releaseId" } - # Upload asset using curl (more reliable for file uploads) - $filePath = "./MonitorControl-$tag.zip" - $fileName = "MonitorControl-$tag.zip" + # Upload installer + $filePath = "DellMonitorControl/installer/MonitorControl-Setup-$version.exe" + $fileName = "MonitorControl-Setup-$version.exe" Write-Host "Uploading $fileName..." curl.exe -X POST -H "Authorization: token $env:GITEA_TOKEN" -F "attachment=@$filePath" "$baseUrl/repos/$repo/releases/$releaseId/assets?name=$fileName" - Write-Host "Asset uploaded successfully" + Write-Host "Installer uploaded successfully" diff --git a/.gitignore b/.gitignore index 8f66922..e4dfaf2 100644 --- a/.gitignore +++ b/.gitignore @@ -365,5 +365,5 @@ FodyWeavers.xsd # Claude Code .claude/ -# Windows special files -nul \ No newline at end of file +# Inno Setup output +DellMonitorControl/installer/ diff --git a/DellMonitorControl/MonitorControl.iss b/DellMonitorControl/MonitorControl.iss new file mode 100644 index 0000000..384a7b6 --- /dev/null +++ b/DellMonitorControl/MonitorControl.iss @@ -0,0 +1,39 @@ +#define MyAppName "Monitor Control" +#define MyAppVersion "1.0.0" +#define MyAppPublisher "Dang" +#define MyAppExeName "DellMonitorControl.exe" + +[Setup] +AppId={{8F3E4A2B-1C5D-4E6F-9A8B-7C2D1E3F4A5B} +AppName={#MyAppName} +AppVersion={#MyAppVersion} +AppPublisher={#MyAppPublisher} +DefaultDirName={autopf}\{#MyAppName} +DefaultGroupName={#MyAppName} +AllowNoIcons=yes +OutputDir=installer +OutputBaseFilename=MonitorControl-Setup-{#MyAppVersion} +Compression=lzma +SolidCompression=yes +WizardStyle=modern +PrivilegesRequired=admin +UninstallDisplayIcon={app}\{#MyAppExeName} + +[Languages] +Name: "english"; MessagesFile: "compiler:Default.isl" + +[Tasks] +Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked +Name: "startupicon"; Description: "Start with Windows"; GroupDescription: "Startup:" + +[Files] +Source: "bin\Release\net9.0-windows\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs + +[Icons] +Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}" +Name: "{group}\Uninstall {#MyAppName}"; Filename: "{uninstallexe}" +Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon +Name: "{userstartup}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: startupicon + +[Run] +Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent