Skip to content

Commit 8fc34fd

Browse files
committed
Configure Versioning
1 parent 3ba36d1 commit 8fc34fd

File tree

2 files changed

+48
-4
lines changed

2 files changed

+48
-4
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Publish NuGet Package
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*.*.*' # فقط زمانی اجرا میشه که tag مثل v1.2.3 اضافه بشه
7+
8+
jobs:
9+
publish:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v3
15+
16+
- name: Setup .NET
17+
uses: actions/setup-dotnet@v4
18+
with:
19+
dotnet-version: |
20+
6.0.x
21+
8.0.x
22+
10.0.100-preview.4
23+
24+
- name: Extract version from tag
25+
id: tag
26+
run: |
27+
echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
28+
29+
- name: Restore dependencies
30+
run: dotnet restore
31+
32+
- name: Build
33+
run: dotnet build --configuration Release --no-restore
34+
35+
- name: Pack NuGet
36+
run: |
37+
dotnet pack --configuration Release \
38+
-p:PackageVersion=${{ steps.tag.outputs.VERSION }} \
39+
--no-build -o out
40+
41+
- name: Push to NuGet
42+
run: |
43+
dotnet nuget push out/*.nupkg \
44+
--api-key ${{ secrets.NUGET_API_KEY }} \
45+
--source https://api.nuget.org/v3/index.json

src/KSFramework/KSFramework.csproj

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>net10.0;net8.0;net6.0</TargetFrameworks>
4+
<TargetFrameworks>net8.0;net6.0;net10.0</TargetFrameworks>
55
<ImplicitUsings>enable</ImplicitUsings>
66
<Nullable>enable</Nullable>
77
</PropertyGroup>
88

99
<PropertyGroup>
1010
<PackageId>KSFramework</PackageId>
11-
<Version>1.0.0</Version>
11+
<Version Condition="'$(Version)' == ''">1.0.0</Version>
1212
<Authors>Kamran Sadin</Authors>
1313
<Company>Sadin</Company>
1414
<CopyRight>Copyright (c) 2022 SadinCo.</CopyRight>
1515
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
16-
<PackageIconUrl>https://api.nuget.org/v3-flatcontainer/ks-utilities/1.0.0.2/icon</PackageIconUrl>
16+
<PackageIconUrl>https://raw.githubusercontent.com/A-Programmer/KSFramework/refs/heads/main/assets/icon.png</PackageIconUrl>
1717
<Owners>Kamran Sadin</Owners>
1818
<PackageProjectUrl>https://sadin.dev/nuget-packages/ksframework</PackageProjectUrl>
1919
<Summary>A Mini framework for .NET Core</Summary>
@@ -22,7 +22,6 @@
2222
<Description>A tool for .NET projects contain utilities for working with string, numbers, date time, and also helpers and base classes for Clean Architecture and DDD projects</Description>
2323
<ReleaseNotes>Initialize.</ReleaseNotes>
2424
<RepositoryUrl>https://github.com/A-Programmer/KSFramework</RepositoryUrl>
25-
<TargetFramework>net10.0</TargetFramework>
2625
</PropertyGroup>
2726

2827
<ItemGroup>

0 commit comments

Comments
 (0)