|
| 1 | +name: Build and Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - 'v*' # e.g., v1.0.0, v0.2.3 |
| 7 | + |
| 8 | +jobs: |
| 9 | + build: |
| 10 | + name: Build and Publish Single EXE |
| 11 | + runs-on: windows-latest |
| 12 | + |
| 13 | + steps: |
| 14 | + - name: Checkout code |
| 15 | + uses: actions/checkout@v4 |
| 16 | + |
| 17 | + - name: Setup .NET |
| 18 | + uses: actions/setup-dotnet@v4 |
| 19 | + with: |
| 20 | + dotnet-version: 8.0.x |
| 21 | + |
| 22 | + - name: Restore dependencies |
| 23 | + run: dotnet restore Tnfsd.NET.sln |
| 24 | + |
| 25 | + - name: Build and publish single-file EXE |
| 26 | + run: dotnet publish Tnfsd.NET/Tnfsd.NET.csproj -c Release -r win-x64 --self-contained true ^ |
| 27 | + /p:PublishSingleFile=true /p:IncludeAllContentForSelfExtract=false /p:PublishTrimmed=false |
| 28 | + |
| 29 | + - name: Upload build artifacts |
| 30 | + uses: actions/upload-artifact@v4 |
| 31 | + with: |
| 32 | + name: Tnfsd.NET_Build |
| 33 | + path: | |
| 34 | + Tnfsd.NET/Tnfsd.NET/bin/Release/net8.0-windows/win-x64/publish/Tnfsd.NET.exe |
| 35 | + Tnfsd.NET/Tnfsd.NET/bin/Release/net8.0-windows/win-x64/publish/appsettings.json |
| 36 | +
|
| 37 | + release: |
| 38 | + name: Create GitHub Release |
| 39 | + needs: build |
| 40 | + runs-on: ubuntu-latest |
| 41 | + permissions: |
| 42 | + contents: write # Required for creating releases |
| 43 | + |
| 44 | + steps: |
| 45 | + - name: Checkout code |
| 46 | + uses: actions/checkout@v4 |
| 47 | + |
| 48 | + - name: Download build artifact |
| 49 | + uses: actions/download-artifact@v4 |
| 50 | + with: |
| 51 | + name: Tnfsd.NET_Build |
| 52 | + path: release_files |
| 53 | + |
| 54 | + - name: Create GitHub Release |
| 55 | + uses: softprops/action-gh-release@v2 |
| 56 | + with: |
| 57 | + files: | |
| 58 | + release_files/Tnfsd.NET.exe |
| 59 | + release_files/appsettings.json |
| 60 | + generate_release_notes: true |
| 61 | + env: |
| 62 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments