All checks were successful
Build and Release / build (push) Successful in 9h0m9s
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
91 lines
3.3 KiB
YAML
91 lines
3.3 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: |
|
|
Set-Location DellMonitorControl
|
|
& "C:\Program Files (x86)\Inno Setup 6\ISCC.exe" MonitorControl.iss
|
|
|
|
- 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"
|