Files
controlmymonitormanagement/.gitea/workflows/release.yaml
Dave Friedel 401d717adf
All checks were successful
Build and Release / build (push) Successful in 8h0m10s
Add debug output and create installer dir before ISCC
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-04 09:57:48 -05:00

96 lines
3.7 KiB
YAML

name: Build and Release
on:
push:
tags:
- 'v*'
jobs:
build:
runs-on: windows
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '9.0.x'
- name: Restore dependencies
run: dotnet restore
- name: Build Release
run: dotnet build --configuration Release --no-restore
- 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: List build output
shell: cmd
run: |
echo "Current directory:"
cd
echo "DellMonitorControl contents:"
dir DellMonitorControl
echo "DellMonitorControl\bin contents:"
dir DellMonitorControl\bin
echo "DellMonitorControl\bin\Release contents:"
dir DellMonitorControl\bin\Release
echo "DellMonitorControl\bin\Release\net9.0-windows contents:"
dir DellMonitorControl\bin\Release\net9.0-windows
- name: Build Installer
shell: powershell
run: |
Write-Host "Current directory: $(Get-Location)"
Write-Host "Creating installer output directory..."
New-Item -ItemType Directory -Force -Path "DellMonitorControl\installer"
Write-Host "Running Inno Setup..."
& "C:\Program Files (x86)\Inno Setup 6\ISCC.exe" /O"DellMonitorControl\installer" "DellMonitorControl\MonitorControl.iss"
Write-Host "Listing installer directory:"
Get-ChildItem "DellMonitorControl\installer"
- name: Create Release
shell: powershell
env:
GITEA_TOKEN: ${{ secrets.RELEASE_TOKEN }}
run: |
$tag = "${{ gitea.ref_name }}"
$version = $tag.TrimStart("v")
$repo = "misc/ControlMyMonitorManagement"
$baseUrl = "https://git.marketally.com/api/v1"
Write-Host "Creating release for tag: $tag"
# Check if release already exists
try {
$existing = Invoke-RestMethod -Uri "$baseUrl/repos/$repo/releases/tags/$tag" -Headers @{"Authorization"="token $env:GITEA_TOKEN"} -ErrorAction Stop
$releaseId = $existing.id
Write-Host "Release already exists with ID: $releaseId"
} catch {
# Create new release
$body = @{
tag_name = $tag
name = "Monitor Control $tag"
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
$releaseId = $release.id
Write-Host "Release created with ID: $releaseId"
}
# 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 "Installer uploaded successfully"