Skip to content

Commit

Permalink
Add initial project files.
Browse files Browse the repository at this point in the history
  • Loading branch information
walterlv committed Oct 3, 2020
1 parent 1df96c6 commit c76fcfa
Show file tree
Hide file tree
Showing 10 changed files with 222 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/dotnet-core.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: .NET Core

on: [push]

jobs:
build:

runs-on: windows-latest

steps:
- uses: actions/checkout@v1

- name: Build with dotnet
run: dotnet build --configuration Release

- name: Test
run: dotnet test --configuration Release
40 changes: 40 additions & 0 deletions .github/workflows/nuget-master-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# 去掉注释可以合并 master 分支自动打包
# 为什么不期望推送 master 自动打包?原因是打出来的 CBB 没有 Tag 不利于回滚找到代码

# name: publish nuget

# on:
# push:
# branches:
# - master

# jobs:
# build:

# runs-on: windows-latest

# steps:
# - uses: actions/checkout@v1

# - name: Setup .NET Core
# uses: actions/setup-dotnet@v1
# with:
# dotnet-version: 3.1.300

# - name: Build with dotnet
# run: |
# dotnet build --configuration Release
# dotnet pack --configuration Release --no-build

# - name: Install Nuget
# uses: nuget/setup-nuget@v1
# with:
# nuget-version: '5.x'

# - name: Add private GitHub registry to NuGet
# run: |
# nuget sources add -name github -Source https://nuget.pkg.github.com/dotnet-campus/index.json -Username dotnet-campus -Password ${{ secrets.GITHUB_TOKEN }}
# - name: Push generated package to GitHub registry
# run: |
# nuget push .\bin\Release\*.nupkg -Source github -SkipDuplicate
# nuget push .\bin\Release\*.nupkg -Source https://api.nuget.org/v3/index.json -SkipDuplicate -ApiKey ${{ secrets.NugetKey }}
44 changes: 44 additions & 0 deletions .github/workflows/nuget-tag-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: publish nuget

on:
push:
tags:
- '*'

jobs:
build:

runs-on: windows-latest

steps:
- uses: actions/checkout@v1

- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.300

- name: Install dotnet tool
run: dotnet tool install -g dotnetCampus.TagToVersion

- name: Set tag to version
run: dotnet TagToVersion -t ${{ github.ref }}

- name: Build with dotnet
run: |
dotnet build --configuration Release
dotnet pack --configuration Release --no-build
- name: Install Nuget
uses: nuget/setup-nuget@v1
with:
nuget-version: '5.x'

- name: Add private GitHub registry to NuGet
run: |
nuget sources add -name github -Source https://nuget.pkg.github.com/dotnet-campus/index.json -Username dotnet-campus -Password ${{ secrets.GITHUB_TOKEN }}
- name: Push generated package to GitHub registry
run: |
nuget push .\bin\Release\*.nupkg -Source github -SkipDuplicate
nuget push .\bin\Release\*.nupkg -Source https://api.nuget.org/v3/index.json -SkipDuplicate -ApiKey ${{ secrets.NugetKey }}
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# dotnetCampus.Logger
18 changes: 18 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<Project>
<Import Project="build\Version.props" />
<PropertyGroup>
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
<PackageOutputPath>$(MSBuildThisFileDirectory)bin\$(Configuration)</PackageOutputPath>
<Company>dotnet campus(.NET 职业技术学院)</Company>

<!-- 替换下面信息 -->
<Authors>dotnet-campus</Authors>
<RepositoryUrl>https://github.com/dotnet-campus/dotnetCampus.Logger</RepositoryUrl>
<PackageProjectUrl>https://github.com/dotnet-campus/dotnetCampus.Logger</PackageProjectUrl>
<Description>提供统一的日志记录方法,并附带各种各样的实现。</Description>

<RepositoryType>git</RepositoryType>
<Copyright>Copyright © 2020 dotnet campus, All Rights Reserved.</Copyright>
</PropertyGroup>
</Project>
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# dotnetCampus.Logger

| Build | NuGet |
|--|--|
|![](https://github.com/dotnet-campus/dotnetCampus.Logger/workflows/.NET%20Core/badge.svg)|[![](https://img.shields.io/nuget/v/dotnetCampus.Logger.svg)](https://www.nuget.org/packages/dotnetCampus.Logger)|
5 changes: 5 additions & 0 deletions build/Version.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<Project>
<PropertyGroup>
<Version>0.1.0-alpha</Version>
</PropertyGroup>
</Project>
47 changes: 47 additions & 0 deletions dotnetCampus.Logger.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26124.0
MinimumVisualStudioVersion = 15.0.26124.0
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{5D196596-756D-45C2-8A05-C8E4AB8A36E6}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "dotnetCampus.Logger", "src\dotnetCampus.Logger\dotnetCampus.Logger.csproj", "{F7ED61F4-920C-49EB-8DC1-74B2BE6AF272}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{AFB0DF31-474C-4ACB-88C6-DD00552D5B5A}"
ProjectSection(SolutionItems) = preProject
build\Version.props = build\Version.props
README.md = README.md
CHANGELOG.md = CHANGELOG.md
Directory.Build.props = Directory.Build.props
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{F7ED61F4-920C-49EB-8DC1-74B2BE6AF272}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F7ED61F4-920C-49EB-8DC1-74B2BE6AF272}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F7ED61F4-920C-49EB-8DC1-74B2BE6AF272}.Debug|x64.ActiveCfg = Debug|Any CPU
{F7ED61F4-920C-49EB-8DC1-74B2BE6AF272}.Debug|x64.Build.0 = Debug|Any CPU
{F7ED61F4-920C-49EB-8DC1-74B2BE6AF272}.Debug|x86.ActiveCfg = Debug|Any CPU
{F7ED61F4-920C-49EB-8DC1-74B2BE6AF272}.Debug|x86.Build.0 = Debug|Any CPU
{F7ED61F4-920C-49EB-8DC1-74B2BE6AF272}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F7ED61F4-920C-49EB-8DC1-74B2BE6AF272}.Release|Any CPU.Build.0 = Release|Any CPU
{F7ED61F4-920C-49EB-8DC1-74B2BE6AF272}.Release|x64.ActiveCfg = Release|Any CPU
{F7ED61F4-920C-49EB-8DC1-74B2BE6AF272}.Release|x64.Build.0 = Release|Any CPU
{F7ED61F4-920C-49EB-8DC1-74B2BE6AF272}.Release|x86.ActiveCfg = Release|Any CPU
{F7ED61F4-920C-49EB-8DC1-74B2BE6AF272}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{F7ED61F4-920C-49EB-8DC1-74B2BE6AF272} = {5D196596-756D-45C2-8A05-C8E4AB8A36E6}
EndGlobalSection
EndGlobal
9 changes: 9 additions & 0 deletions src/dotnetCampus.Logger/Class1.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using System;

namespace dotnetCampus.Logger
{
class Class1
{

}
}
36 changes: 36 additions & 0 deletions src/dotnetCampus.Logger/dotnetCampus.Logger.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netcoreapp3.1;netstandard2.0;net45</TargetFrameworks>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>

<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>

<!-- 在 GitHub 的 Action 构建会添加 GITHUB_ACTIONS 变量 -->
<!-- 下面进行自动构建,自动添加源代码链接等 -->
<!-- 详细请看 https://github.com/dotnet/sourcelink -->
<PropertyGroup Condition="'$(GITHUB_ACTIONS)' == 'true'">
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>

<!-- Optional: Publish the repository URL in the built .nupkg (in the NuSpec <Repository> element) -->
<PublishRepositoryUrl>true</PublishRepositoryUrl>

<!-- 只有在 GitHub 的 Action 构建才能使用源代码链接 -->
<!-- 源代码链接需要使用 commit 号,而在 GitHub 的 Action 构建的 commit 才是对的 -->
<!-- 本地构建,也许没有记得 commit 就构建,此时的 nuget 包的源代码是不对的,上传上去会让调试诡异 -->
<!-- Optional: Embed source files that are not tracked by the source control manager in the PDB -->
<EmbedUntrackedSources>true</EmbedUntrackedSources>

<!-- 本地等不需要创建符号文件 -->
<!-- Optional: Build symbol package (.snupkg) to distribute the PDB containing Source Link -->
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
</PropertyGroup>

<ItemGroup>
<!-- 链接源代码到 GitHub 仓库,方便调试 -->
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" />
</ItemGroup>

</Project>

0 comments on commit c76fcfa

Please sign in to comment.