|
| 1 | +name: Build and Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - 'v*' |
| 7 | + |
| 8 | +jobs: |
| 9 | + build-and-release: |
| 10 | + runs-on: windows-latest |
| 11 | + |
| 12 | + steps: |
| 13 | + - name: Checkout code |
| 14 | + uses: actions/checkout@v4 |
| 15 | + |
| 16 | + - name: Setup .NET |
| 17 | + uses: actions/setup-dotnet@v4 |
| 18 | + with: |
| 19 | + dotnet-version: '8.0.x' |
| 20 | + |
| 21 | + - name: Restore dependencies |
| 22 | + run: dotnet restore SourceServerManager/SourceServerManager.csproj |
| 23 | + |
| 24 | + - name: Build application |
| 25 | + run: dotnet build SourceServerManager/SourceServerManager.csproj --configuration Release --no-restore |
| 26 | + |
| 27 | + - name: Publish application |
| 28 | + run: dotnet publish SourceServerManager/SourceServerManager.csproj --configuration Release --framework net8.0 --runtime win-x64 --self-contained true --output SourceServerManager/bin/Release/net8.0/publish |
| 29 | + |
| 30 | + - name: Setup NSIS |
| 31 | + uses: joncloud/makensis-action@v4 |
| 32 | + |
| 33 | + - name: Build installer |
| 34 | + run: | |
| 35 | + cd SourceServerManager/Installer |
| 36 | + makensis Installer.nsi |
| 37 | + |
| 38 | + - name: Get tag name |
| 39 | + id: tag |
| 40 | + run: | |
| 41 | + $tagName = $env:GITHUB_REF -replace 'refs/tags/', '' |
| 42 | + echo "tag_name=$tagName" >> $env:GITHUB_OUTPUT |
| 43 | + echo "release_name=$tagName" >> $env:GITHUB_OUTPUT |
| 44 | + shell: pwsh |
| 45 | + |
| 46 | + - name: Create Release |
| 47 | + id: create_release |
| 48 | + uses: actions/create-release@v1 |
| 49 | + env: |
| 50 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 51 | + with: |
| 52 | + tag_name: ${{ steps.tag.outputs.tag_name }} |
| 53 | + release_name: ${{ steps.tag.outputs.release_name }} |
| 54 | + draft: false |
| 55 | + prerelease: false |
| 56 | + body: | |
| 57 | + Release ${{ steps.tag.outputs.tag_name }} |
| 58 | + |
| 59 | + ## Download |
| 60 | + Download the installer below to install Source Server Manager on your Windows system. |
| 61 | + |
| 62 | + - name: Upload Release Asset |
| 63 | + uses: actions/upload-release-asset@v1 |
| 64 | + env: |
| 65 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 66 | + with: |
| 67 | + upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 68 | + asset_path: SourceServerManager/Installer/SourceServerManager.Installer.exe |
| 69 | + asset_name: SourceServerManager-${{ steps.tag.outputs.tag_name }}-Setup.exe |
| 70 | + asset_content_type: application/octet-stream |
0 commit comments