Skip to content

fix: resolve all CI build errors from .NET migration #3

fix: resolve all CI build errors from .NET migration

fix: resolve all CI build errors from .NET migration #3

Workflow file for this run

name: Build and Release
on:
push:
branches: [main]
tags: ['v*']
workflow_dispatch:
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
jobs:
build:
runs-on: windows-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Setup .NET 9
uses: actions/setup-dotnet@v4
with:
dotnet-version: '9.0.x'
- name: Publish
run: dotnet publish FlipsiColor/FlipsiColor.csproj -c Release -r win-x64 --self-contained true -o FlipsiColor/publish
- name: Download VC++ Redistributable
shell: pwsh
run: |
Invoke-WebRequest -Uri "https://aka.ms/vs/17/release/vc_redist.x64.exe" -OutFile FlipsiColor/publish/VC_redist.x64.exe
- name: Install Inno Setup
run: choco install innosetup -y
shell: pwsh
- name: Extract Version
id: version
run: |
$csproj = Get-Content FlipsiColor/FlipsiColor.csproj -Raw
if ($csproj -match '<Version>(.*?)</Version>') {
$version = $Matches[1]
} else {
$version = "0.2.0"
}
echo "version=$version" >> $env:GITHUB_OUTPUT
shell: pwsh
- name: Build Installer
run: |
$version = "${{ steps.version.outputs.version }}"
iscc installer/installer.iss /DAppVersion=$version /Oinstaller-output
shell: pwsh
- name: Delete old releases (keep max 4)
if: startsWith(github.ref, 'refs/tags/v')
continue-on-error: true
shell: pwsh
run: |
$headers = @{ Authorization = "token ${{ secrets.GITHUB_TOKEN }}" }
$releases = Invoke-RestMethod -Uri "https://api.github.com/repos/${{ github.repository }}/releases" -Headers $headers
$sorted = $releases | Sort-Object created_at -Descending
$toDelete = $sorted | Select-Object -Skip 4
foreach ($rel in $toDelete) {
Write-Host "Deleting old release: $($rel.tag_name)"
try {
Invoke-RestMethod -Uri "https://api.github.com/repos/${{ github.repository }}/releases/$($rel.id)" -Method Delete -Headers $headers | Out-Null
} catch { Write-Host "Warning: Could not delete release $($rel.tag_name): $($_.Exception.Message)" }
$ref = "refs/tags/$($rel.tag_name)"
try {
Invoke-RestMethod -Uri "https://api.github.com/repos/${{ github.repository }}/git/$ref" -Method Delete -Headers $headers | Out-Null
} catch { Write-Host "Warning: Could not delete tag ref $($rel.tag_name): $($_.Exception.Message)" }
}
- name: Create Release
if: startsWith(github.ref, 'refs/tags/v')
uses: softprops/action-gh-release@v2
with:
files: installer-output\FlipsiColor-*.exe
body: |
## FlipsiColor ${{ steps.version.outputs.version }}
KI-gestützte Bild- & Videofarbkorrektur für Windows.
### Download
- `FlipsiColor-${{ steps.version.outputs.version }}-setup.exe` (Installer)
### Systemanforderungen
- Windows 10 (19041+) oder neuer
- 8 GB RAM
- GPU empfohlen (DirectML)
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}