Skip to content

Commit

Permalink
打包相关配置添加
Browse files Browse the repository at this point in the history
  • Loading branch information
yihango committed Jun 1, 2021
1 parent f64b42d commit e2286b2
Show file tree
Hide file tree
Showing 13 changed files with 290 additions and 3 deletions.
19 changes: 17 additions & 2 deletions LiteIM.sln
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,28 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LiteIM.CSRedisCore", "src\L
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{F8614B68-4A41-4F4B-B820-6ED675837E2B}"
EndProject

Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SampleWebApp", "tests\SampleWebApp\SampleWebApp.csproj", "{1C293584-7671-4166-8944-FB56AA61003B}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "nupkg", "nupkg", "{B633B00F-7E9A-4240-9EEA-5D8D6804C35A}"
ProjectSection(SolutionItems) = preProject
nupkg\common.ps1 = nupkg\common.ps1
nupkg\pack.ps1 = nupkg\pack.ps1
nupkg\push_packages.ps1 = nupkg\push_packages.ps1
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{17810CB1-B795-4842-8FE1-13BA00EDA5D2}"
ProjectSection(SolutionItems) = preProject
azure-pipelines.yml = azure-pipelines.yml
common.props = common.props
global.json = global.json
LICENSE = LICENSE
README.md = README.md
RELEASE_NOTES.md = RELEASE_NOTES.md
repository_info.props = repository_info.props
version.props = version.props
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SampleWebApp", "tests\SampleWebApp\SampleWebApp.csproj", "{1C293584-7671-4166-8944-FB56AA61003B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -45,6 +59,7 @@ Global
{DFA184B5-34EC-46C7-9DB4-DCE690AABECC} = {014D3084-B29E-4BFF-BCCD-7EF3C03D17EE}
{053F8E7C-F7BC-4AC5-A6D0-20FBB1305C0A} = {014D3084-B29E-4BFF-BCCD-7EF3C03D17EE}
{1C293584-7671-4166-8944-FB56AA61003B} = {F8614B68-4A41-4F4B-B820-6ED675837E2B}
{B633B00F-7E9A-4240-9EEA-5D8D6804C35A} = {17810CB1-B795-4842-8FE1-13BA00EDA5D2}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {A0EC0D4A-AA00-4443-A867-4997E35A50CB}
Expand Down
48 changes: 47 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,47 @@
# LiteIM
# Riven.LiteIM
Simple IM chat room/online/offline function library, not including communication.

## LICENSES
![GitHub](https://img.shields.io/github/license/rivenfx/Modular?color=brightgreen)
[![Badge](https://img.shields.io/badge/link-996.icu-%23FF4D5B.svg?style=flat-square)](https://996.icu/#/zh_CN)
[![LICENSE](https://img.shields.io/badge/license-Anti%20996-blue.svg?style=flat-square)](https://github.com/996icu/996.ICU/blob/master/LICENSE)

Please note: once the use of the open source projects as well as the reference for the project or containing the project code for violating labor laws (including but not limited the illegal layoffs, overtime labor, child labor, etc.) in any legal action against the project, the author has the right to punish the project fee, or directly are not allowed to use any contains the source code of this project!

## Build Status

[![Build Status](https://dev.azure.com/rivenfx/RivenFx/_apis/build/status/rivenfx.LiteIM?branchName=master)](https://dev.azure.com/rivenfx/RivenFx/_build/latest?definitionId=8&branchName=master)

## Nuget Packages

|Package|Status|Downloads|
|:------|:-----:|:-----:|
|Riven.LiteIM.Core|[![NuGet version](https://img.shields.io/nuget/v/Riven.LiteIM.Core?color=brightgreen)](https://www.nuget.org/packages/Riven.LiteIM.Core/)|[![Nuget](https://img.shields.io/nuget/dt/Riven.LiteIM.Core?color=brightgreen)](https://www.nuget.org/packages/Riven.LiteIM.Core/)|
|Riven.LiteIM.CSRedisCore|[![NuGet version](https://img.shields.io/nuget/v/Riven.LiteIM.CSRedisCore?color=brightgreen)](https://www.nuget.org/packages/Riven.LiteIM.CSRedisCore/)|[![Nuget](https://img.shields.io/nuget/dt/Riven.LiteIM.CSRedisCore?color=brightgreen)](https://www.nuget.org/packages/Riven.LiteIM.CSRedisCore/)|


## Quick start
> TODO
## Demos

> TODO

## Q&A

If you have any questions, you can go to [Issues](https://github.com/rivenfx/LiteIM/issues) to ask them.


## Reference project

> This project directly or indirectly refers to the following items
- [codearts](https://github.com/tinylit/codearts)
- [InfluxData.Net](https://github.com/tihomir-kit/InfluxData.Net)
- [influxdb-client-csharp](https://github.com/influxdata/influxdb-client-csharp)


## Stargazers over time

[![Stargazers over time](https://starchart.cc/rivenfx/LiteIM.svg)](https://starchart.cc/rivenfx/LiteIM)
3 changes: 3 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## Release V0.0.1
* 基本逻辑完成

47 changes: 47 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# github ci triggers doc:
# https://docs.microsoft.com/zh-cn/azure/devops/pipelines/repos/github?view=azure-devops&tabs=yaml#ci-triggers
trigger:
batch: true
tags:
include:
- v*

pool:
vmImage: 'ubuntu-latest'

variables:
gitHubConnection: 'rivenfx'

steps:
- task: PowerShell@2
name: "build_to_nuget_pakcages"
displayName: '打包'
inputs:
filePath: './nupkg/pack.ps1'
pwsh: true
workingDirectory: './nupkg'

- task: PowerShell@2
name: "publish_to_nuget"
displayName: '推送到 nuget'
inputs:
filePath: './nupkg/push_packages.ps1'
arguments: $(nuget_key)
pwsh: true
workingDirectory: './nupkg'

- task: GitHubRelease@1
name: "create_git_release_tag"
displayName: '创建 github release 标签'
inputs:
gitHubConnection: '$(gitHubConnection)'
repositoryName: '$(Build.Repository.Name)'
action: 'create'
target: '$(Build.SourceVersion)'
tagSource: 'gitTag'
tagPattern: 'v.*'
releaseNotesFilePath: './RELEASE_NOTES.md'
changeLogCompareToRelease: 'lastFullRelease'
changeLogType: 'commitBased'


36 changes: 36 additions & 0 deletions common.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<Project>

<PropertyGroup>
<Authors>RivenFx</Authors>
</PropertyGroup>

<PropertyGroup>
<NoWarn>$(NoWarn);CS1570;CS1572;CS1573;CS1587;CS1591;CS1701;CS1702;</NoWarn>
<PackageIconUrl>https://riven.staneee.com/images/riven_nupkg.png</PackageIconUrl>
<PackageProjectUrl>https://riven.staneee.com/</PackageProjectUrl>
</PropertyGroup>

<PropertyGroup>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<GenerateAssemblyTitleAttribute>false</GenerateAssemblyTitleAttribute>
<GenerateAssemblyDescriptionAttribute>false</GenerateAssemblyDescriptionAttribute>
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
<GenerateAssemblyCopyrightAttribute>false</GenerateAssemblyCopyrightAttribute>
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)' == 'Release' ">
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
</PropertyGroup>

<PropertyGroup>
<LangVersion>latest</LangVersion>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="SourceLink.Create.CommandLine" Version="2.8.1" PrivateAssets="All" />
</ItemGroup>

</Project>
6 changes: 6 additions & 0 deletions global.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"sdk": {
"version": "3.1.100",
"rollForward": "latestFeature"
}
}
14 changes: 14 additions & 0 deletions nupkg/common.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# 路径
$packFolder = (Get-Item -Path "./" -Verbose).FullName # 当前路径
$rootFolder = Join-Path $packFolder "../" # 项目根目录
$packOutputFolder = Join-Path $packFolder "dist" # 输出nuget package 目录
# 解决方案路径
$slnPath = $rootFolder
$srcPath = Join-Path $slnPath "src"


# 所有的项目名称
$projects = (
"LiteIM.Core",
"LiteIM.CSRedisCore"
)
43 changes: 43 additions & 0 deletions nupkg/pack.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# 执行公用脚本
. ".\common.ps1"


# 创建文件夹
if(!(Test-Path $packOutputFolder)){
mkdir $packOutputFolder
}

# 解决方案还原依赖
Set-Location $slnPath
& dotnet restore

# 创建并移动过所有的 nuget 包到输出目录
foreach($project in $projects) {

# 拼接项目目录
$projectFolder = Join-Path $srcPath $project

# 创建 nuget 包
Set-Location $projectFolder
Get-ChildItem (Join-Path $projectFolder "bin/Release") -ErrorAction SilentlyContinue | Remove-Item -Recurse
& dotnet msbuild /p:Configuration=Release /p:SourceLinkCreate=true
& dotnet msbuild /t:pack /p:Configuration=Release /p:SourceLinkCreate=true

# 获取包名称
$packageId = $project
Try{
[xml]$csprojXml = Get-Content ("./"+$project+".csproj")
$packageId = $csprojXml.Project.PropertyGroup.PackageId
}
Catch {
Write-Host ('get package id error in ' + $project + '.csproj, So use package id: '+ $packageId)
}

# 复制 nuget 包
$projectPackPath = Join-Path $projectFolder ("/bin/Release/" + $packageId + ".*.nupkg")
Move-Item $projectPackPath $packOutputFolder

}

# 返回脚本启动目录
Set-Location $packFolder
37 changes: 37 additions & 0 deletions nupkg/push_packages.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
. ".\common.ps1"

$apiKey = $args[0]
if ([System.String]::IsNullOrWhiteSpace($apiKey))
{
$apiKey = $env:NUGET_KEY
}

# 获取版本
[xml]$versionPropsXml = Get-Content (Join-Path $rootFolder "version.props")
$version = $versionPropsXml.Project.PropertyGroup.Version
$versionStr = $version.Trim()

# 发布所有包
foreach($project in $projects) {
$packageId = $project

# 获取packageid
Try {
$csprojPath = Join-Path $srcPath $project ("./"+$project+".csproj")
[xml]$csprojXml = Get-Content $csprojPath
$packageId = $csprojXml.Project.PropertyGroup.PackageId
} Catch {
Write-Host ('get package id error in ' + $project + '.csproj, So use package id: '+ $packageId)
}

# 包全路径
$packageFullPath = Join-Path $packOutputFolder ($packageId + "." + $versionStr + ".nupkg")

$packageFullPath

# 发布包
& dotnet nuget push $packageFullPath -s https://api.nuget.org/v3/index.json --api-key "$apiKey" --skip-duplicate
}

# 返回脚本执行目录
Set-Location $packFolder
9 changes: 9 additions & 0 deletions repository_info.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<Project>

<PropertyGroup>
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/rivenfx/LiteIM</RepositoryUrl>
<PackageLicense>https://github.com/rivenfx/LiteIM/blob/master/LICENSE</PackageLicense>
</PropertyGroup>

</Project>
12 changes: 12 additions & 0 deletions src/LiteIM.CSRedisCore/LiteIM.CSRedisCore.csproj
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk">

<Import Project="..\..\common.props" />
<Import Project="..\..\version.props" />
<Import Project="..\..\repository_info.props" />

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<RootNamespace>LiteIM</RootNamespace>


<PackageId>Riven.LiteIM.CSRedisCore</PackageId>
<Description>Riven.LiteIM.CSRedisCore</Description>
<AssemblyName>Riven.LiteIM.CSRedisCore</AssemblyName>

<PackageTags>riven;im;csrediscore;csredis;freeredis;</PackageTags>

</PropertyGroup>

<ItemGroup>
Expand Down
12 changes: 12 additions & 0 deletions src/LiteIM.Core/LiteIM.Core.csproj
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk">

<Import Project="..\..\common.props" />
<Import Project="..\..\version.props" />
<Import Project="..\..\repository_info.props" />

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<RootNamespace>LiteIM</RootNamespace>


<PackageId>Riven.LiteIM.Core</PackageId>
<Description>Riven.LiteIM.Core</Description>
<AssemblyName>Riven.LiteIM.Core</AssemblyName>

<PackageTags>riven;im;</PackageTags>

</PropertyGroup>

<ItemGroup>
Expand Down
7 changes: 7 additions & 0 deletions version.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<Project>

<PropertyGroup>
<Version>0.0.1</Version>
</PropertyGroup>

</Project>

0 comments on commit e2286b2

Please sign in to comment.