|
| 1 | +# This workflow will build a .NET project |
| 2 | +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net |
| 3 | + |
| 4 | +name: .NET |
| 5 | + |
| 6 | +on: |
| 7 | + push: |
| 8 | + branches: [ "main" ] |
| 9 | + |
| 10 | +jobs: |
| 11 | + build-and-release: |
| 12 | + runs-on: windows-latest |
| 13 | + |
| 14 | + steps: |
| 15 | + - name: Checkout code |
| 16 | + uses: actions/checkout@v4 |
| 17 | + |
| 18 | + - name: Setup .NET SDK |
| 19 | + uses: actions/setup-dotnet@v4 |
| 20 | + with: |
| 21 | + dotnet-version: '9.0.x' |
| 22 | + |
| 23 | + - name: Install GitVersion |
| 24 | + uses: gittools/actions/gitversion/setup@v1 |
| 25 | + with: |
| 26 | + versionSpec: '5.x' |
| 27 | + |
| 28 | + - name: Run GitVersion |
| 29 | + id: gitversion |
| 30 | + uses: gittools/actions/gitversion/execute@v1 |
| 31 | + |
| 32 | + - name: Restore dependencies |
| 33 | + run: dotnet restore OTAPI.UnifiedServerProcess/src/OTAPI.UnifiedServerProcess/OTAPI.UnifiedServerProcess.csproj |
| 34 | + |
| 35 | + - name: Build project with version |
| 36 | + run: > |
| 37 | + dotnet build OTAPI.UnifiedServerProcess/src/OTAPI.UnifiedServerProcess/OTAPI.UnifiedServerProcess.csproj |
| 38 | + --configuration Release |
| 39 | + /p:GitVersion_NuGetVersion=${{ steps.gitversion.outputs.nuGetVersionV2 }} |
| 40 | + /p:GitVersion_AssemblySemVer=${{ steps.gitversion.outputs.assemblySemVer }} |
| 41 | + /p:GitVersion_AssemblySemFileVer=${{ steps.gitversion.outputs.assemblySemFileVer }} |
| 42 | + /p:GitVersion_InformationalVersion=${{ steps.gitversion.outputs.informationalVersion }} |
| 43 | +
|
| 44 | + - name: Run compiled EXE |
| 45 | + run: | |
| 46 | + cd OTAPI.UnifiedServerProcess/src/OTAPI.UnifiedServerProcess/bin/Release/net9.0 |
| 47 | + .\OTAPI.UnifiedServerProcess.exe |
| 48 | +
|
| 49 | + - name: Create output zip file |
| 50 | + run: | |
| 51 | + $version = "${{ steps.gitversion.outputs.nuGetVersionV2 }}" |
| 52 | + $outputDir = "OTAPI.UnifiedServerProcess/src/OTAPI.UnifiedServerProcess/bin/Release/net9.0/output" |
| 53 | + $zipPath = "UnifiedServerProcess-v$version.zip" |
| 54 | + Compress-Archive -Path "$outputDir\*" -DestinationPath "$zipPath" |
| 55 | + echo "Created zip at $zipPath" |
| 56 | +
|
| 57 | + - name: Upload ZIP as Release asset |
| 58 | + uses: softprops/action-gh-release@v2 |
| 59 | + with: |
| 60 | + files: UnifiedServerProcess-v${{ steps.gitversion.outputs.nuGetVersionV2 }}.zip |
| 61 | + env: |
| 62 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments