Build Executables #70
This file contains 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 Executables | |
on: | |
workflow_dispatch: | |
workflow_run: | |
workflows: ["Test and Create Pull Request to Master"] | |
types: | |
- completed | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.number || github.ref }} | |
cancel-in-progress: true | |
permissions: | |
contents: write | |
id-token: write | |
pull-requests: write | |
jobs: | |
build_executables: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
# Setup .NET SDK for the NoMercy.Server project | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: "9.0.x" | |
# Restore dependencies for the NoMercy.Server project | |
- name: Restore dependencies | |
run: dotnet restore NoMercy.Server.sln | |
# Build the NoMercy.Server project | |
- name: Build NoMercy.Server | |
run: | | |
dotnet build ./src/NoMercy.Server/NoMercy.Server.csproj --configuration Release --runtime linux-x64 | |
dotnet build ./src/NoMercy.Server/NoMercy.Server.csproj --configuration Release --runtime win-x64 | |
dotnet build ./src/NoMercy.Server/NoMercy.Server.csproj --configuration Release --runtime osx-x64 | |
# Publish the NoMercy.Server project for the target OS | |
- name: Publish NoMercy.Server | |
run: | | |
mkdir -p ./output | |
# Publish for Linux | |
dotnet publish ./src/NoMercy.Server/NoMercy.Server.csproj --configuration Release --runtime linux-x64 --self-contained true /p:PublishSingleFile=true /p:IncludeNativeLibrariesForSelfExtract=true /p:IncludeAllContentForSelfExtract=true /p:EnableCompressionInSingleFile=true /p:DebugType=None /p:DebugSymbols=false /p:PublishReadyToRun=false /p:OutputFileName=NoMercyMediaServer --output ./output | |
mv ./output/NoMercyMediaServer ./output/NoMercyMediaServer-linux-x64 | |
# Publish for Windows | |
dotnet publish ./src/NoMercy.Server/NoMercy.Server.csproj --configuration Release --runtime win-x64 --self-contained true /p:PublishSingleFile=true /p:IncludeNativeLibrariesForSelfExtract=true /p:IncludeAllContentForSelfExtract=true /p:EnableCompressionInSingleFile=true /p:DebugType=None /p:DebugSymbols=false /p:PublishReadyToRun=false /p:OutputFileName=NoMercyMediaServer --output ./output | |
mv ./output/NoMercyMediaServer.exe ./output/NoMercyMediaServer-windows-x64.exe | |
# Publish for macOS | |
dotnet publish ./src/NoMercy.Server/NoMercy.Server.csproj --configuration Release --runtime osx-x64 --self-contained true /p:PublishSingleFile=true /p:IncludeNativeLibrariesForSelfExtract=true /p:IncludeAllContentForSelfExtract=true /p:EnableCompressionInSingleFile=true /p:DebugType=None /p:DebugSymbols=false /p:PublishReadyToRun=false /p:OutputFileName=NoMercyMediaServer --output ./output | |
mv ./output/NoMercyMediaServer ./output/NoMercyMediaServer-macos-x64 | |
- name: Publish NoMercy.Updater | |
run: | | |
mkdir -p ./output | |
# Publish for Linux | |
dotnet publish ./src/NoMercy.Updater/NoMercy.Updater.csproj --configuration Release --runtime linux-x64 --self-contained true /p:PublishSingleFile=true /p:IncludeNativeLibrariesForSelfExtract=true /p:IncludeAllContentForSelfExtract=true /p:EnableCompressionInSingleFile=true /p:DebugType=None /p:DebugSymbols=false /p:PublishReadyToRun=false /p:OutputFileName=NoMercyUpdater --output ./output | |
mv ./output/NoMercyUpdater ./output/NoMercyUpdater-linux-x64 | |
# Publish for Windows | |
dotnet publish ./src/NoMercy.Updater/NoMercy.Updater.csproj --configuration Release --runtime win-x64 --self-contained true /p:PublishSingleFile=true /p:IncludeNativeLibrariesForSelfExtract=true /p:IncludeAllContentForSelfExtract=true /p:EnableCompressionInSingleFile=true /p:DebugType=None /p:DebugSymbols=false /p:PublishReadyToRun=false /p:OutputFileName=NoMercyUpdater --output ./output | |
mv ./output/NoMercyUpdater.exe ./output/NoMercyUpdater-windows-x64.exe | |
# Publish for macOS | |
dotnet publish ./src/NoMercy.Updater/NoMercy.Updater.csproj --configuration Release --runtime osx-x64 --self-contained true /p:PublishSingleFile=true /p:IncludeNativeLibrariesForSelfExtract=true /p:IncludeAllContentForSelfExtract=true /p:EnableCompressionInSingleFile=true /p:DebugType=None /p:DebugSymbols=false /p:PublishReadyToRun=false /p:OutputFileName=NoMercyUpdater --output ./output | |
mv ./output/NoMercyUpdater ./output/NoMercyUpdater-macos-x64 | |
# Get the version of the project | |
- name: Get Version | |
uses: kzrnm/get-net-sdk-project-versions-action@v2 | |
id: get-version | |
with: | |
proj-path: ./src/NoMercy.Server/NoMercy.Server.csproj | |
- run: echo "${{steps.get-version.outputs.version}}" | |
# Create the GitHub release | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
with: | |
tag_name: v${{ steps.get-version.outputs.version }} | |
release_name: NoMercy MediaServer Release | |
body: | | |
New release for NoMercy MediaServer is ready. | |
draft: false | |
prerelease: false | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Get Short SHA | |
id: get_short_sha | |
run: echo "::set-output name=short_sha::${GITHUB_SHA::7}" | |
# Upload Windows Release Asset | |
- name: Upload Windows Release Asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./output/NoMercyMediaServer-windows-x64.exe | |
asset_name: NoMercyMediaServer-windows-x64-${{ steps.get_short_sha.outputs.short_sha }}.exe | |
asset_content_type: application/vnd.microsoft.portable-executable | |
- name: Upload Windows Updater Release Asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./output/NoMercyUpdater-windows-x64.exe | |
asset_name: NoMercyUpdater-windows-x64-${{ steps.get_short_sha.outputs.short_sha }}.exe | |
asset_content_type: application/vnd.microsoft.portable-executable | |
# Upload macOS Release Asset | |
- name: Upload macOS Release Asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./output/NoMercyMediaServer-macos-x64 | |
asset_name: NoMercyMediaServer-macos-x64-${{ steps.get_short_sha.outputs.short_sha }} | |
asset_content_type: application/x-apple-diskimage | |
- name: Upload macOS Updater Release Asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./output/NoMercyUpdater-macos-x64 | |
asset_name: NoMercyUpdater-macos-x64-${{ steps.get_short_sha.outputs.short_sha }} | |
asset_content_type: application/x-apple-diskimage | |
# Upload Linux Release Asset | |
- name: Upload Linux Release Asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./output/NoMercyMediaServer-linux-x64 | |
asset_name: NoMercyMediaServer-linux-x64-${{ steps.get_short_sha.outputs.short_sha }} | |
asset_content_type: application/x-executable | |
- name: Upload Linux Updater Release Asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./output/NoMercyUpdater-linux-x64 | |
asset_name: NoMercyUpdater-linux-x64-${{ steps.get_short_sha.outputs.short_sha }} | |
asset_content_type: application/x-executable |