Skip to content

Commit

Permalink
更改支持net9
Browse files Browse the repository at this point in the history
  • Loading branch information
DUWENINK committed Nov 24, 2024
1 parent 7e35101 commit a3268d6
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 5 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/nuget-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: NuGet Package Publish

on:
push:
tags:
- 'v*'

jobs:
build-and-publish:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

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

- name: Restore dependencies
run: dotnet restore

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

- name: Get Version
id: get_version
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT

- name: Pack
run: dotnet pack DUWENINK.Captcha/DUWENINK.Captcha.csproj --configuration Release /p:Version=${{ steps.get_version.outputs.VERSION }} --no-build --output nupkg

- name: Push to NuGet
run: dotnet nuget push ./nupkg/*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_API_KEY }} --skip-duplicate
34 changes: 34 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
image: mcr.microsoft.com/dotnet/sdk:9.0

stages:
- build
- pack
- publish

variables:
PROJECT_PATH: "DUWENINK.Captcha/DUWENINK.Captcha.csproj"

build:
stage: build
script:
- dotnet restore
- dotnet build --configuration Release
only:
- tags

pack:
stage: pack
script:
- dotnet pack $PROJECT_PATH --configuration Release /p:Version=${CI_COMMIT_TAG} --output ./nupkg
artifacts:
paths:
- ./nupkg/*.nupkg
only:
- tags

publish:
stage: publish
script:
- dotnet nuget push ./nupkg/*.nupkg --source "${NUGET_SOURCE}" --api-key "${NUGET_API_KEY}" --skip-duplicate
only:
- tags
6 changes: 3 additions & 3 deletions DUWENINK.Captcha/DUWENINK.Captcha.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<Version>0.8.0</Version>
<Description>一个基于跨平台的验证码生成器工具,依赖注入后使用</Description>
<Product>DUWENINK.Captcha</Product>
Expand Down Expand Up @@ -56,8 +56,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.5" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.0" />
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.6" />
<PackageReference Include="SixLabors.ImageSharp.Drawing" Version="2.1.4" />
<None Include="docs\README.md" Pack="true" PackagePath="\" />
<None Include="LICENSE.txt" Pack="true" PackagePath="" />
Expand Down
5 changes: 3 additions & 2 deletions Demo/Demo.csproj
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="8.0.3" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="9.0.0" />
<PackageReference Include="System.Text.Json" Version="9.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Binary file removed RESOURCE1689663612812.pdf
Binary file not shown.

0 comments on commit a3268d6

Please sign in to comment.