dotnet nuget push **/*0.9.*.nupkg #6
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Publish NuGet Package | |
| on: | |
| push: | |
| # branches: | |
| # - 'release/v*' # 触发条件:推送到以 'release/v' 开头的分支 | |
| tags: | |
| - 'v*' # 触发条件:推送到以 'v' 开头的标签 | |
| jobs: | |
| build-and-publish: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v2 | |
| - name: Set up .NET SDK | |
| uses: actions/setup-dotnet@v1 | |
| with: | |
| dotnet-version: '9.0.x' # 使用 .NET 9.0.x SDK | |
| - name: Install dependencies | |
| run: dotnet restore | |
| - name: Build project | |
| run: dotnet build --configuration Release --no-restore | |
| - name: Pack project | |
| run: dotnet pack --configuration Release --no-build --output . | |
| - name: Push NuGet package | |
| run: | | |
| dotnet nuget push **/*0.9.*.nupkg -s ${{ vars.NUGET_API_SOURCE }} -k ${{ secrets.NUGET_API_KEY }} --skip-duplicate | |
| # env: | |
| # NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }} | |
| # NUGET_API_SOURCE: ${{ vars.NUGET_API_SOURCE }} | |