Release v1.1.0 #3
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: Build and Release (Beta) | |
| on: | |
| push: | |
| branches: | |
| - beta | |
| jobs: | |
| build: | |
| name: Build (${{ matrix.platform }}) | |
| runs-on: windows-latest | |
| strategy: | |
| matrix: | |
| platform: [x64, x86, ARM64] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup .NET SDK | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: '9.0.x' | |
| - name: Read version from vbproj | |
| id: version | |
| shell: pwsh | |
| run: | | |
| [xml]$proj = Get-Content "NTPilot.vbproj" | |
| $ver = $proj.Project.PropertyGroup[0].Version | |
| if (-not $ver) { $ver = "1.0.0" } | |
| echo "VERSION=$ver" >> $env:GITHUB_ENV | |
| echo "TAG=v$ver-beta" >> $env:GITHUB_ENV | |
| - name: Restore | |
| run: dotnet restore NTPilot.vbproj -p:Platform=${{ matrix.platform }} | |
| - name: Build (${{ matrix.platform }}) | |
| run: > | |
| dotnet build NTPilot.vbproj | |
| -c Release | |
| -p:Platform=${{ matrix.platform }} | |
| --no-restore | |
| - name: Rename output | |
| shell: pwsh | |
| run: | | |
| $src = "bin\Release\net481\NTPilot.exe" | |
| $dst = "NTPilot_${{ matrix.platform }}_beta.exe" | |
| if (Test-Path $src) { | |
| Copy-Item $src $dst | |
| } else { | |
| $alt = "bin\Release\net481\${{ matrix.platform }}\NTPilot.exe" | |
| if (Test-Path $alt) { Copy-Item $alt $dst } | |
| } | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: NTPilot_${{ matrix.platform }}_beta | |
| path: NTPilot_${{ matrix.platform }}_beta.exe | |
| - name: Upload version metadata | |
| if: matrix.platform == 'x64' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: version-meta | |
| path: CHANGELOG.md | |
| release: | |
| name: Create Beta Release | |
| needs: build | |
| runs-on: windows-latest | |
| steps: | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| merge-multiple: true | |
| - name: Download version metadata | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: version-meta | |
| - name: Read version | |
| shell: pwsh | |
| run: | | |
| $file = Get-ChildItem "NTPilot_x64_beta.exe" | |
| $ver = [System.Diagnostics.FileVersionInfo]::GetVersionInfo($file.FullName).FileVersion | |
| if (-not $ver) { $ver = "1.0.0" } | |
| if ($ver -match '^\d+\.\d+\.\d+\.0$') { $ver = $ver -replace '\.0$', '' } | |
| echo "TAG=v$ver-beta" >> $env:GITHUB_ENV | |
| - name: Extract release notes from CHANGELOG.md | |
| shell: pwsh | |
| run: | | |
| $content = Get-Content "CHANGELOG.md" -Raw | |
| if ($content -match '(?ms)^## \[\d+\.\d+\.\d+\][^\n]*\n(.*?)(?=^## \[|\z)') { | |
| $notes = "**⚠️ This is a pre-release (beta) build.**`n`n" + $Matches[1].Trim() | |
| } else { | |
| $notes = "**⚠️ This is a pre-release (beta) build.**" | |
| } | |
| $notes | Out-File "release_notes.txt" -Encoding utf8 | |
| - name: Create Beta Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ env.TAG }} | |
| name: Beta ${{ env.TAG }} | |
| body_path: release_notes.txt | |
| draft: false | |
| prerelease: true | |
| files: | | |
| NTPilot_x64_beta.exe | |
| NTPilot_x86_beta.exe | |
| NTPilot_ARM64_beta.exe | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |