90 lines
2.6 KiB
YAML
90 lines
2.6 KiB
YAML
name: Build and publish package
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
branches:
|
|
- "main"
|
|
push:
|
|
branches:
|
|
- "main"
|
|
paths:
|
|
- "SimpleToolkit.UI.WinUI.Controls**"
|
|
|
|
jobs:
|
|
build:
|
|
name: Build
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v6
|
|
- name: Setup .NET
|
|
uses: actions/setup-dotnet@v4
|
|
with:
|
|
dotnet-version: 8.0.x
|
|
- name: Restore dependencies
|
|
run: dotnet restore
|
|
- name: Build
|
|
run: dotnet build --no-restore
|
|
version:
|
|
name: Determine version
|
|
needs: build
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v6
|
|
with:
|
|
fetch-depth: 0
|
|
- name: Setup .NET
|
|
uses: actions/setup-dotnet@v3
|
|
with:
|
|
dotnet-version: 10.0.x
|
|
- name: Setup GitVersion
|
|
uses: gittools/actions/gitversion/setup@v4.2.0
|
|
with:
|
|
versionSpec: 6.4.x
|
|
- name: Determine version
|
|
uses: gittools/actions/gitversion/execute@v4.2.0
|
|
id: gitversion
|
|
with:
|
|
configFilePath: ./.gitea/config/gitversion.yml
|
|
outputs:
|
|
version: ${{ steps.gitversion.outputs.SemVer }}
|
|
pack:
|
|
name: Pack
|
|
needs: version
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v6
|
|
- name: Setup .NET
|
|
uses: actions/setup-dotnet@v3
|
|
with:
|
|
dotnet-version: 8.0.x
|
|
- name: Create NuGet package
|
|
run: dotnet pack -c Release -p:Version=${{needs.version.outputs.version}} -p:PackageVersion=${{needs.version.outputs.version}} --output ./
|
|
- name: Upload artifact
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: nuget
|
|
path: ./SimpleToolkit.UI.WinUI.Controls.${{needs.version.outputs.version}}.nupkg
|
|
outputs:
|
|
version: ${{needs.version.outputs.version}}
|
|
publish:
|
|
name: Publish
|
|
needs: pack
|
|
steps:
|
|
- name: Download artifact
|
|
uses: actions/download-artifact@v3
|
|
with:
|
|
name: nuget
|
|
path: ./
|
|
- name: Setup .NET
|
|
uses: actions/setup-dotnet@v3
|
|
with:
|
|
dotnet-version: 8.0.x
|
|
- name: Publish
|
|
run: dotnet nuget push ./SimpleToolkit.UI.WinUI.Controls.${{needs.pack.outputs.version}}.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_KEY }}
|
|
- name: Create Release
|
|
uses: akkuman/gitea-release-action@v1
|
|
with:
|
|
tag_name: ${{needs.pack.outputs.version}}
|
|
name: ${{needs.pack.outputs.version}}
|
|
files: |-
|
|
SimpleToolkit.UI.WinUI.Controls.${{needs.pack.outputs.version}}.nupkg |