add support dotnet 8 for rhino grass build #18
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: Publish NuGet Package | ||
| on: | ||
| push: | ||
| tags: | ||
| - 'v*' # Trigger on version tags like v1.0.0, v0.1.0-beta | ||
| jobs: | ||
| publish: | ||
| runs-on: windows-latest | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| - name: Setup .NET | ||
| uses: actions/setup-dotnet@v4 | ||
| with: | ||
| dotnet-version: '10.0.x' | ||
| # SOLUTION 1: Create minimal stub assembly | ||
| - name: Create stub ETABSv1.dll | ||
| run: | | ||
| # Create directory for ETABS DLL | ||
| $etabsPath = "C:\Program Files\Computers and Structures\ETABS 22" | ||
| New-Item -ItemType Directory -Force -Path $etabsPath | Out-Null | ||
| # Create minimal IL code for stub assembly | ||
| $ilCode = @' | ||
| .assembly extern mscorlib {} | ||
| .assembly extern System.Runtime { .ver 4:0:0:0 } | ||
| .assembly ETABSv1 | ||
| { | ||
| .ver 1:0:0:0 | ||
| .hash algorithm 0x00008004 | ||
| } | ||
| .module ETABSv1.dll | ||
| // Minimal type to make assembly valid | ||
| .class public auto ansi beforefieldinit ETABSv1.Helper | ||
| extends [mscorlib]System.Object | ||
| { | ||
| .method public hidebysig specialname rtspecialname | ||
| instance void .ctor() cil managed | ||
| { | ||
| .maxstack 8 | ||
| ldarg.0 | ||
| call instance void [mscorlib]System.Object::.ctor() | ||
| ret | ||
| } | ||
| } | ||
| '@ | ||
| # Save IL code to file | ||
| $ilFile = Join-Path $env:TEMP "ETABSv1.il" | ||
| $ilCode | Out-File -FilePath $ilFile -Encoding ASCII | ||
| # Find ilasm.exe | ||
| $ilasmPath = "C:\Windows\Microsoft.NET\Framework64\v4.0.30319\ilasm.exe" | ||
| if (Test-Path $ilasmPath) { | ||
| # Compile to DLL | ||
| $dllPath = Join-Path $etabsPath "ETABSv1.dll" | ||
| & $ilasmPath /DLL /QUIET /OUTPUT="$dllPath" $ilFile | ||
| if (Test-Path $dllPath) { | ||
| Write-Host "✓ Stub ETABSv1.dll created successfully at: $dllPath" | ||
| Write-Host " File size: $((Get-Item $dllPath).Length) bytes" | ||
| } else { | ||
| Write-Error "Failed to create ETABSv1.dll" | ||
| exit 1 | ||
| } | ||
| } else { | ||
| Write-Error "ilasm.exe not found at: $ilasmPath" | ||
| exit 1 | ||
| } | ||
| shell: pwsh | ||
| - name: Restore dependencies | ||
| run: dotnet restore | ||
| - name: Build | ||
| run: dotnet build --configuration Release --no-restore | ||
| - name: Run tests | ||
| run: dotnet test --configuration Release --no-build --verbosity normal | ||
| continue-on-error: true # Tests may fail without actual ETABS | ||
| - name: Extract version from tag | ||
| id: version | ||
| run: | | ||
| $tag = "${{ github.ref }}" -replace "refs/tags/v", "" | ||
| echo "version=$tag" >> $env:GITHUB_OUTPUT | ||
| # Check if it's a prerelease | ||
| if ($tag -match "-") { | ||
| echo "is_prerelease=true" >> $env:GITHUB_OUTPUT | ||
| } else { | ||
| echo "is_prerelease=false" >> $env:GITHUB_OUTPUT | ||
| } | ||
| - name: Update project version | ||
| run: | | ||
| $version = "${{ steps.version.outputs.version }}" | ||
| $csprojPath = "src\EtabSharp\EtabSharp.csproj" | ||
| if (Test-Path $csprojPath) { | ||
| $xml = [xml](Get-Content $csprojPath) | ||
| $xml.Project.PropertyGroup[0].Version = $version | ||
| $xml.Save($csprojPath) | ||
| Write-Host "✓ Updated version to $version in $csprojPath" | ||
| } else { | ||
| Write-Error "Project file not found: $csprojPath" | ||
| exit 1 | ||
| } | ||
| - name: Pack NuGet package | ||
| run: dotnet pack src/EtabSharp/EtabSharp.csproj --configuration Release --output nuget --no-build | ||
| - name: Publish to NuGet | ||
| run: dotnet nuget push "nuget\EtabSharp.${{ steps.version.outputs.version }}.nupkg" --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate | ||
| - name: Create GitHub Release | ||
| uses: ncipollo/release-action@v1 | ||
| with: | ||
| artifacts: nuget/EtabSharp.${{ steps.version.outputs.version }}.nupkg | ||
| token: ${{ secrets.GITHUB_TOKEN }} | ||
| draft: false | ||
| prerelease: ${{ steps.version.outputs.is_prerelease == 'true' }} | ||
| generateReleaseNotes: true | ||
| --- | ||