Use matrix to build app for win-x64 and linux-x64 with artifacts
All checks were successful
First CI / build (linux-x64) (push) Successful in 1m47s
First CI / build (win-x64) (push) Successful in 1m49s

This commit is contained in:
Dana123098
2025-11-20 12:40:36 +01:00
parent df46ba7171
commit c67d4b9ef2

View File

@@ -4,26 +4,29 @@ on: [push]
jobs: jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy:
matrix:
rid: ["win-x64", "linux-x64"]
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: actions/setup-dotnet@v3 - uses: actions/setup-dotnet@v3
with: with:
dotnet-version: '8.0.x' dotnet-version: '8.0.x'
- run: dotnet restore - run: dotnet restore
- run: dotnet build - run: dotnet build
- run: dotnet test - run: dotnet test
- run: dotnet publish -o app -r linux-x64 --sc /p:PublishSingleFile=true,AssemblyName=app
- run: tar cf app.tar app/
- uses: actions/upload-artifact@v3
with:
name: app.tar
path: app.tar
test: - name: publish app for ${{ matrix.rid }}
runs-on: ubuntu-latest run: dotnet publish -o app-${{ matrix.rid }} -r ${{ matrix.rid }} --sc /p:PublishSingleFile=true,AssemblyName=app
steps:
- uses: actions/download-artifact@v3 - name: pack app-${{ matrix.rid }} to tar
run: tar cf app-${{ matrix.rid }}.tar app-${{ matrix.rid }}/
- name: upload artifact for ${{ matrix.rid }}
uses: actions/upload-artifact@v3
with: with:
name: app.tar name: app-${{ matrix.rid }}.tar
- run: tar xf app.tar path: app-${{ matrix.rid }}.tar
- run: ./app/app