Skip to content

update full semver

update full semver #12

Workflow file for this run

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: Install GitVersion
uses: gittools/actions/gitversion/[email protected]
with:
versionSpec: '6.x'
- name: Determine Version
id: version_step # step id used as reference for output values
uses: gittools/actions/gitversion/[email protected]
- name: Output Version
run: echo "current version is ${{ steps.version_step.outputs.fullSemVer }}"
- 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 /p:PackageVersion=${{ steps.version_step.outputs.majorMinorPatch }}
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 }}