-
Notifications
You must be signed in to change notification settings - Fork 0
53 lines (42 loc) · 1.73 KB
/
dotnet-desktop.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
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