Skip to content

Update GitHub Action #3

Update GitHub Action

Update GitHub Action #3

Workflow file for this run

name: .NET Core Desktop
on:
workflow_dispatch:
push:
branches: [ "test_github_actions" ]
pull_request:
jobs:
build:
runs-on: windows-latest
env:
Dotnet_Version: 8.0.x
Project_Path: Flow.Launcher.Localization\Flow.Launcher.Localization.csproj
NuGet_Source: 'https://api.nuget.org/v3/index.json'
steps:
# Checkout codes
- name: Checkout
uses: actions/checkout@v4
# Install the .NET Core workload
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.Dotnet_Version }}
# Restore dependencies
- name: Restore dependencies
run: dotnet restore ${{ env.Project_Path }}
# Build the project
- name: Build
run: dotnet build ${{ env.Project_Path }} --configuration Release --no-restore
# Execute all unit tests in the solution
- name: Execute unit tests
run: dotnet test --configuration Release --no-build
# Pack the NuGet package
- name: Create NuGet package
run: dotnet pack ${{ env.PROJECT_PATH }} --configuration Release --no-build --output nupkgs
# Upload the NuGet package
- name: Upload NuGet package
uses: actions/upload-artifact@v4
with:
name: Full nupkg
path: |
Flow.Launcher.Localization\nupkgs\Flow.Launcher.Localization.*.nupkg
compression-level: 0
# Publish to NuGet.org
# - name: Publish to NuGet
# if: github.event_name == 'push' && github.ref == 'refs/heads/main' # Only publish on push to main
# run: dotnet nuget push ./nupkgs/*.nupkg --source ${{ env.NuGet_Source }} --api-key ${{ secrets.NUGET_API_KEY }}