Skip to content

Merge pull request #7 from StarryXYJ/dev #6

Merge pull request #7 from StarryXYJ/dev

Merge pull request #7 from StarryXYJ/dev #6

Workflow file for this run

name: Publish to NuGet
on:
push:
branches:
- main
tags:
- 'v*'
workflow_dispatch:
env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
DOTNET_NOLOGO: true
jobs:
build-and-publish:
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
8.0.x
9.0.x
10.0.x
- name: Build Core
run: dotnet build src/AutoSettingUI.Core/AutoSettingUI.Core.csproj --configuration Release -p:ContinuousIntegrationBuild=true
- name: Build Generator
run: dotnet build src/AutoSettingUI.Generator/AutoSettingUI.Generator.csproj --configuration Release -p:ContinuousIntegrationBuild=true
- name: Build Extension.Shared
run: dotnet build src/Extensions/AutoSettingUI.Extension.Shared/AutoSettingUI.Extension.Shared.csproj --configuration Release -p:ContinuousIntegrationBuild=true
- name: Build Avalonia
run: dotnet build src/Extensions/AutoSettingUI.Avalonia/AutoSettingUI.Avalonia.csproj --configuration Release -p:ContinuousIntegrationBuild=true
- name: Build Ursa
run: dotnet build src/Extensions/AutoSettingUI.Ursa/AutoSettingUI.Ursa.csproj --configuration Release -p:ContinuousIntegrationBuild=true
- name: Build WPF
run: dotnet build src/Extensions/AutoSettingUI.WPF/AutoSettingUI.WPF.csproj --configuration Release -p:ContinuousIntegrationBuild=true
- name: Build Tests
run: dotnet build src/AutoSettingUI.Generator.Tests/AutoSettingUI.Generator.Tests.csproj --configuration Release
- name: Run tests
run: dotnet test src/AutoSettingUI.Generator.Tests/AutoSettingUI.Generator.Tests.csproj --configuration Release --no-build --verbosity minimal
- name: Create artifacts directory
run: mkdir -p artifacts
- name: Pack Core
run: dotnet pack src/AutoSettingUI.Core/AutoSettingUI.Core.csproj --configuration Release --no-build --output artifacts
- name: Pack Generator
run: dotnet pack src/AutoSettingUI.Generator/AutoSettingUI.Generator.csproj --configuration Release --no-build --output artifacts
- name: Pack Extension.Shared
run: dotnet pack src/Extensions/AutoSettingUI.Extension.Shared/AutoSettingUI.Extension.Shared.csproj --configuration Release --no-build --output artifacts
- name: Pack Avalonia
run: dotnet pack src/Extensions/AutoSettingUI.Avalonia/AutoSettingUI.Avalonia.csproj --configuration Release --no-build --output artifacts
- name: Pack Ursa
run: dotnet pack src/Extensions/AutoSettingUI.Ursa/AutoSettingUI.Ursa.csproj --configuration Release --no-build --output artifacts
- name: Pack WPF
run: dotnet pack src/Extensions/AutoSettingUI.WPF/AutoSettingUI.WPF.csproj --configuration Release --no-build --output artifacts
- name: List packages
run: ls artifacts
- name: Publish to NuGet
if: startsWith(github.ref, 'refs/tags/v')
run: dotnet nuget push artifacts/*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_API_KEY }} --skip-duplicate
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: nuget-packages
path: artifacts/*.nupkg
retention-days: 30