Files
Misaki.HighPerformance/.gitea/workflows/publish-nuget.yaml
2025-11-04 17:57:36 +09:00

59 lines
1.8 KiB
YAML

name: Publish NuGet Packages
on:
push:
tags:
- 'v*' # Trigger only on semantic version tags
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 9.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build all projects
run: dotnet build -c Release
- name: Pack all projects
run: |
set -e
for projfile in $(find . -name "*.csproj"); do
if grep -q "<IsPackable>true</IsPackable>" "$projfile"; then
echo "Packing $projfile..."
if ! dotnet pack "$projfile" -c Release -o ./artifacts; then
echo "Failed to pack $projfile"
fi
fi
done
- name: Publish all packages
env:
NUGET_API_KEY: ${{ secrets.NUGET_TOKEN }}
run: |
for projfile in $(find . -name "*.csproj"); do
packable=$(dotnet msbuild "$projfile" -t:GetProperty -p:PropertyName=IsPackable -nologo -v:q)
if [ "$packable" = "True" ]; then
projname=$(basename "$projfile" .csproj)
VERSION=$(dotnet msbuild "$projfile" -nologo -v:q -t:GetProperty -p:PropertyName=PackageVersion)
pkg=$(find "$projname/bin/Release" -maxdepth 1 -type f \
-name "$projname.*.nupkg" ! -name "*.symbols.nupkg" | sort -V | tail -n1)
if [ -n "$pkg" ]; then
dotnet nuget push "$pkg" \
--source "https://git.personalnas.com/api/packages/Misaki/nuget/index.json" \
--api-key "$NUGET_API_KEY"
else
echo "⚠ No package found for $projname"
fi
fi
done