This commit is contained in:
Andrea Santaniello 2024-11-05 14:57:46 +01:00
commit 4cd58dcd78

View File

@ -1,28 +1,56 @@
# This workflow will build a .NET project name: Build and Release RadioGUI
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
name: .NET
on: on:
push: push:
branches: [ "master" ] branches:
pull_request: - '**' # Run on all branches
branches: [ "master" ] tags:
- 'v*' # Also runs on tags starting with 'v*' (e.g., v1.0)
jobs: jobs:
build: build:
runs-on: windows-latest
runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - name: Checkout code
uses: actions/checkout@v3
- name: Setup .NET - name: Setup .NET
uses: actions/setup-dotnet@v4 uses: actions/setup-dotnet@v3
with: with:
dotnet-version: 8.0.x dotnet-version: '7.x' # Use the appropriate .NET SDK version for your project
- name: Restore dependencies - name: Restore dependencies
run: dotnet restore run: dotnet restore
- name: Build
run: dotnet build --no-restore - name: Build Solution
- name: Test run: dotnet build --configuration Release
run: dotnet test --no-build --verbosity normal
- name: Publish binaries
run: dotnet publish RadioGUI/RadioGUI.csproj --configuration Release --output ./publish
- name: Upload binaries if successful
if: success()
uses: actions/upload-artifact@v3
with:
name: RadioGUI-binaries
path: ./publish
release:
runs-on: windows-latest
needs: build
if: github.ref_type == 'tag' && success() # Only release if a tag push and build was successful
steps:
- name: Download binaries
uses: actions/download-artifact@v3
with:
name: RadioGUI-binaries
path: ./publish
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
files: ./publish/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}