fengling-platform/.gitea/workflows/nuget.yml
movingsam 6426a13852
All checks were successful
Publish Platform NuGet Packages / build (push) Successful in 21s
fix: 从git tag提取版本号并传递给dotnet pack
2026-03-01 01:26:56 +08:00

47 lines
1.4 KiB
YAML

name: Publish Platform NuGet Packages
on:
push:
branches:
- main
tags:
- "v*"
env:
GITEA_TOKEN: ${{ secrets.GITEATOKEN }}
GITEA_URL: https://gitea.shtao1.cn
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: "10.0.x"
- name: Get version from tag
if: startsWith(github.ref, 'refs/tags/v')
id: version
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
- name: Pack Domain
if: startsWith(github.ref, 'refs/tags/v')
run: dotnet pack Fengling.Platform.Domain/Fengling.Platform.Domain.csproj -c Release -o ./packages -p:PackageVersion=${{ steps.version.outputs.VERSION }}
- name: Pack Infrastructure
if: startsWith(github.ref, 'refs/tags/v')
run: dotnet pack Fengling.Platform.Infrastructure/Fengling.Platform.Infrastructure.csproj -c Release -o ./packages -p:PackageVersion=${{ steps.version.outputs.VERSION }}
- name: Push to Gitea
if: startsWith(github.ref, 'refs/tags/v')
run: |
for pkg in ./packages/*.nupkg; do
dotnet nuget push "$pkg" \
--source "$GITEA_URL/api/packages/fengling/nuget/index.json" \
--api-key "$GITEA_TOKEN" \
--skip-duplicate
done