add readme file #3
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: | |
| tags: | |
| - 'v*.*.*' | |
| env: | |
| PROJECT_PATH: 'RxEventBus/RxEventBus.Core/RxEventBus.Core.csproj' | |
| BUILD_CONFIGURATION: 'Release' # 构建配置 | |
| jobs: | |
| build_and_publish: | |
| runs-on: ubuntu-latest # 使用最新的 Ubuntu 运行器 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 # 检出代码 | |
| - name: Setup .NET SDK | |
| uses: actions/setup-dotnet@v4 # 设置 .NET SDK | |
| with: | |
| dotnet-version: '8.0' # 指定您的 .NET 版本, | |
| - name: Restore dependencies | |
| run: dotnet restore ${{ env.PROJECT_PATH }} # 恢复项目依赖 | |
| - name: Build project | |
| run: dotnet build ${{ env.PROJECT_PATH }} --configuration ${{ env.BUILD_CONFIGURATION }} --no-restore # 构建项目 | |
| - name: Create NuGet package | |
| run: dotnet pack ${{ env.PROJECT_PATH }} --configuration ${{ env.BUILD_CONFIGURATION }} --no-build --output nupkgs # 打包 NuGet 包,输出到 nupkgs 文件夹 | |
| - name: Publish NuGet package | |
| run: dotnet nuget push nupkgs/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json # 发布 NuGet 包 | |
| env: | |
| NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }} # 引用之前设置的 Secret |