Update lain.csproj #12
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: .NET Core Desktop | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
jobs: | |
build: | |
strategy: | |
matrix: | |
runtime: [win-x64, linux-x64, linux-arm64, osx-x64, osx-arm64] | |
runs-on: ${{ matrix.runtime == 'win-x64' && 'windows-latest' || 'ubuntu-latest' }} | |
env: | |
Output_Directory: publish-output/${{ matrix.runtime }} # Output directory based on runtime | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
# Skipping .NET SDK setup since it is already installed | |
- name: Restore dependencies | |
run: dotnet restore lain.sln # Directly reference the solution file | |
- name: Publish self-contained single-file executable | |
run: | | |
dotnet publish lain.sln --configuration Release --output $env:Output_Directory -p:PublishSingleFile=true -p:SelfContained=true -p:PublishTrimmed=true -r ${{ matrix.runtime }} | |
# Zip the build output for Windows using PowerShell | |
- name: Zip output (Windows) | |
if: matrix.runtime == 'win-x64' | |
run: | | |
Compress-Archive -Path $env:Output_Directory\* -DestinationPath lain-${{ matrix.runtime }}.zip | |
# Zip the build output for Linux/macOS using zip | |
- name: Zip output (Linux/macOS) | |
if: matrix.runtime != 'win-x64' | |
run: | | |
sudo apt-get install -y zip # Ensure zip is installed on Linux runners | |
cd $env:Output_Directory | |
zip -r ../lain-${{ matrix.runtime }}.zip . # Create a zip file for the output | |
- name: Upload ZIP artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Executables-${{ matrix.runtime }} # Name the artifact based on the platform | |
path: lain-${{ matrix.runtime }}.zip # Upload the ZIP file |