Skip to content

Commit

Permalink
Create nuget.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
yedajiang44 authored Aug 27, 2024
1 parent a2bf2a8 commit e79d18c
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/nuget.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Publish NuGet Package

on:
push:
tags:
- 'v*' # 触发条件为推送符合 v* 格式的标签,例如 v1.0.0

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Setup .NET Core
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0.203'

- name: Restore dependencies
run: dotnet restore

- name: Build
run: dotnet build --configuration Release --no-restore

- name: Pack NuGet package
run: dotnet pack --configuration Release --no-build --output ./output

- name: Publish to NuGet
run: dotnet nuget push ./output/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}

0 comments on commit e79d18c

Please sign in to comment.