Skip to content

refactor: split wiki generator from CLI #36

refactor: split wiki generator from CLI

refactor: split wiki generator from CLI #36

Workflow file for this run

name: Build and Release
on:
push:
branches: [ "main" ]
tags:
- "v*"
paths-ignore:
- "README.md"
- "LICENSE"
- ".gitignore"
- "docs/**"
- "src/Wiki"
pull_request:
branches: [ "main" ]
paths-ignore:
- "README.md"
workflow_dispatch:
jobs:
build:
name: Build - ${{ matrix.name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: windows-latest
name: Windows
rid: win-x64
ext: .exe
- os: ubuntu-latest
name: Linux
rid: linux-x64
ext: ""
- os: macos-latest
name: MacOS
rid: osx-x64
ext: ""
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Setup .NET 9
uses: actions/setup-dotnet@v4
with:
dotnet-version: 9.0.x
- name: Cache NuGet packages
uses: actions/cache@v4
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj', '**/ReCap.Parser.sln') }}
restore-keys: |
${{ runner.os }}-nuget-
- name: Restore Dependencies
run: dotnet restore ReCap.Parser.sln
- name: Run Tests
run: dotnet test ReCap.Parser.sln --no-restore --verbosity normal
continue-on-error: true
- name: Publish CLI
run: >
dotnet publish src/CLI/ReCap.Parser.CLI.csproj
-c Release
-r ${{ matrix.rid }}
--self-contained true
-p:PublishSingleFile=true
-p:IncludeNativeLibrariesForSelfExtract=true
-p:IncludeAllContentForSelfExtract=true
-o ./publish-cli
- name: Publish Editor
run: >
dotnet publish src/Editor/ReCap.Parser.Editor.csproj
-c Release
-r ${{ matrix.rid }}
--self-contained true
-p:PublishSingleFile=true
-p:IncludeNativeLibrariesForSelfExtract=true
-p:IncludeAllContentForSelfExtract=true
-o ./publish-editor
- name: List published CLI files (Debug)
shell: pwsh
run: Get-ChildItem "./publish-cli" -Recurse | ForEach-Object { Write-Host "$($_.Length) bytes - $($_.FullName)" }
- name: List published Editor files (Debug)
shell: pwsh
run: Get-ChildItem "./publish-editor" -Recurse | ForEach-Object { Write-Host "$($_.Length) bytes - $($_.FullName)" }
- name: Prepare CLI Asset
shell: pwsh
run: |
$cliFiles = Get-ChildItem "./publish-cli" -File | Where-Object {
$_.Name -like "ReCap*" -and ($_.Extension -eq ".exe" -or $_.Extension -eq "" -or $_.Extension -eq $null)
}
$cliFile = $cliFiles | Sort-Object Length -Descending | Select-Object -First 1
if ($cliFile) {
$destName = "ReCap-CLI-${{ matrix.name }}${{ matrix.ext }}"
Write-Host "Moving CLI: $($cliFile.FullName) -> $destName"
Copy-Item $cliFile.FullName "./$destName" -Force
} else {
Write-Error "No CLI executable found!"
exit 1
}
- name: Prepare Editor Asset
shell: pwsh
run: |
$editorFiles = Get-ChildItem "./publish-editor" -File | Where-Object {
$_.Name -like "ReCap*" -and ($_.Extension -eq ".exe" -or $_.Extension -eq "" -or $_.Extension -eq $null)
}
$editorFile = $editorFiles | Sort-Object Length -Descending | Select-Object -First 1
if ($editorFile) {
$destName = "ReCap-Editor-${{ matrix.name }}${{ matrix.ext }}"
Write-Host "Moving Editor: $($editorFile.FullName) ($($editorFile.Length) bytes) -> $destName"
Copy-Item $editorFile.FullName "./$destName" -Force
} else {
Write-Error "No Editor executable found!"
exit 1
}
- name: Verify artifact sizes
shell: pwsh
run: |
$cli = Get-Item "./ReCap-CLI-${{ matrix.name }}${{ matrix.ext }}"
$editor = Get-Item "./ReCap-Editor-${{ matrix.name }}${{ matrix.ext }}"
Write-Host "CLI size: $($cli.Length / 1MB) MB"
Write-Host "Editor size: $($editor.Length / 1MB) MB"
# Editor should be at least 50MB for self-contained Avalonia app
if ($editor.Length -lt 50MB) {
Write-Warning "Editor file seems too small! Expected ~100MB+ for self-contained Avalonia app"
}
- name: Upload CLI Artifact
uses: actions/upload-artifact@v4
with:
name: ReCap-CLI-${{ matrix.name }}
path: ReCap-CLI-${{ matrix.name }}${{ matrix.ext }}
if-no-files-found: error
- name: Upload Editor Artifact
uses: actions/upload-artifact@v4
with:
name: ReCap-Editor-${{ matrix.name }}
path: ReCap-Editor-${{ matrix.name }}${{ matrix.ext }}
if-no-files-found: error
release:
name: Create Release
needs: build
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download All Artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
merge-multiple: true
- name: List artifacts
run: ls -la artifacts/
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
files: artifacts/*
draft: false
prerelease: false
generate_release_notes: true