versionnr fix #3
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release | |
| on: | |
| push: | |
| tags: | |
| - "v*" | |
| - "[0-9]*" | |
| jobs: | |
| release: | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # MinVer needs full history to read tags | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: "10.x" | |
| - name: Get version from tag | |
| id: version | |
| run: | | |
| $full = "${{ github.ref_name }}" -replace '^v', '' | |
| $numeric = ($full -split '-')[0] | |
| echo "version=$full" >> $env:GITHUB_OUTPUT | |
| echo "version_numeric=$numeric" >> $env:GITHUB_OUTPUT | |
| echo "SPACEMOUSE_VERSION=$full" >> $env:GITHUB_ENV | |
| echo "SPACEMOUSE_VERSION_NUMERIC=$numeric" >> $env:GITHUB_ENV | |
| - name: Publish | |
| run: | | |
| dotnet publish SpaceMousePilot/SpaceMousePilot.csproj ` | |
| --configuration Release ` | |
| --runtime win-x64 ` | |
| --self-contained true ` | |
| -p:PublishSingleFile=true ` | |
| -p:IncludeNativeLibrariesForSelfExtract=true ` | |
| -p:EnableCompressionInSingleFile=true ` | |
| --output SpaceMousePilot/dist/app ` | |
| --nologo | |
| - name: Install Inno Setup | |
| run: choco install innosetup --no-progress -y | |
| - name: Build installer | |
| run: | | |
| & "${env:ProgramFiles(x86)}\Inno Setup 6\ISCC.exe" SpaceMousePilot\installer\spacemouse_pilot.iss | |
| - name: Read changelog | |
| id: changelog | |
| run: | | |
| $version = "${{ steps.version.outputs.version }}" | |
| $content = "" | |
| if (Test-Path "SpaceMousePilot/CHANGELOG.md") { | |
| $raw = (Get-Content SpaceMousePilot/CHANGELOG.md -Raw) -replace "`r`n", "`n" | |
| if ($raw -match "(?ms)##\s+$([regex]::Escape($version))\s*\n(.*?)(?=\n##\s|\z)") { | |
| $content = $Matches[1].Trim() | |
| } | |
| } | |
| $content | Set-Content patch_notes.md -Encoding UTF8 | |
| echo "has_notes=$($content -ne '')" >> $env:GITHUB_OUTPUT | |
| - name: Build release notes | |
| run: | | |
| $version = "${{ steps.version.outputs.version }}" | |
| $changes = if ("${{ steps.changelog.outputs.has_notes }}" -eq "true") { | |
| "### Changes`n$(Get-Content patch_notes.md -Raw)`n`n" | |
| } else { "" } | |
| @" | |
| ## SpaceMouse Pilot $version | |
| ${changes}### Requirements | |
| - Windows 10/11 x64 | |
| - [ViGEmBus driver](https://github.com/nefarius/ViGEmBus/releases/latest) — install before launching | |
| ### Setup | |
| 1. Install ViGEmBus | |
| 2. Run the installer | |
| 3. Launch SpaceMouse Pilot and click **Start Bridge** | |
| 4. Calibrate axes on first use | |
| "@ | Set-Content release_notes.md -Encoding UTF8 | |
| - name: Create GitHub release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| name: "SpaceMouse Pilot v${{ steps.version.outputs.version }}" | |
| body_path: release_notes.md | |
| files: SpaceMousePilot/dist/installer/SpaceMousePilot_Setup_${{ steps.version.outputs.version }}.exe |