update 1.3 version #13
This file contains 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: | |
- main # 触发工作流的分支 | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
env: | |
PROJECT_DIR: EfCore.NamingConverter # 工作目录 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup .NET 8.x | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 8.0.x | |
- name: Setup .NET 9.x | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 9.0.x | |
- name: Restore dependencies | |
run: dotnet restore | |
working-directory: ${{ env.PROJECT_DIR }} | |
- name: Build | |
run: dotnet build --configuration Release --no-restore | |
working-directory: ${{ env.PROJECT_DIR }} | |
- name: Pack | |
run: dotnet pack --configuration Release --no-build --output ./nupkg | |
working-directory: ${{ env.PROJECT_DIR }} | |
- name: Upload NuGet package | |
uses: actions/upload-artifact@v3 | |
with: | |
name: nuget-package | |
path: ${{ env.PROJECT_DIR }}/nupkg/*.nupkg | |
- name: Publish to NuGet | |
if: github.ref == 'refs/heads/main' | |
env: | |
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }} | |
run: dotnet nuget push ./nupkg/*.nupkg --api-key $NUGET_API_KEY --source https://api.nuget.org/v3/index.json --skip-duplicate | |
working-directory: ${{ env.PROJECT_DIR }} |