Create pipeline to pack and push nuget package.
This commit is contained in:
parent
d141cdbeb0
commit
227109eef1
44
.github/workflows/nuget.yml
vendored
Normal file
44
.github/workflows/nuget.yml
vendored
Normal file
@ -0,0 +1,44 @@
|
||||
name: windows
|
||||
|
||||
on: pull_request
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: windows-latest
|
||||
strategy:
|
||||
matrix:
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- uses: nuget/setup-nuget@v1
|
||||
with:
|
||||
nuget-api-key: ${{ secrets.nuget_apikey }}
|
||||
nuget-version: '5.x'
|
||||
|
||||
- name: Create Build Environment
|
||||
run: cmake -E make_directory build
|
||||
|
||||
- name: Configure
|
||||
working-directory: build
|
||||
run: |
|
||||
cmake -DCMAKE_BUILD_TYPE=Debug -DBUILD_SHARED_LIBS=ON -A x64 -DCMAKE_CXX_STANDARD=17 ..
|
||||
|
||||
- name: Build
|
||||
working-directory: ${{runner.workspace}}/build
|
||||
run: |
|
||||
$threads = (Get-CimInstance Win32_ComputerSystem).NumberOfLogicalProcessors
|
||||
cmake --build . --config Debug --parallel $threads
|
||||
cmake --build . --config Release --parallel $threads
|
||||
|
||||
- name: Test
|
||||
working-directory: build
|
||||
run: ctest -C Debug -V
|
||||
env:
|
||||
CTEST_OUTPUT_ON_FAILURE: True
|
||||
|
||||
- name: NuGet Pack
|
||||
run: |
|
||||
cp readme.rst readme.md
|
||||
cp license.rst readme.md
|
||||
nuget pack bundle\nuget\fmt.nuspec -properties Id=wuganhao.fmt -version 1.0-dev -basepath . -OutputFileNamesWithoutVersion
|
||||
55
.github/workflows/tag.yml
vendored
Normal file
55
.github/workflows/tag.yml
vendored
Normal file
@ -0,0 +1,55 @@
|
||||
name: windows
|
||||
|
||||
on: pull_request
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: windows-latest
|
||||
strategy:
|
||||
matrix:
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- uses: nuget/setup-nuget@v1
|
||||
with:
|
||||
nuget-api-key: ${{ secrets.nuget_apikey }}
|
||||
nuget-version: '5.x'
|
||||
|
||||
- name: Create Build Environment
|
||||
run: cmake -E make_directory build
|
||||
|
||||
- name: Configure
|
||||
working-directory: build
|
||||
run: |
|
||||
cmake -DCMAKE_BUILD_TYPE=Debug -DBUILD_SHARED_LIBS=ON -A x64 -DCMAKE_CXX_STANDARD=17 ..
|
||||
|
||||
- name: Build
|
||||
working-directory: ${{runner.workspace}}/build
|
||||
run: |
|
||||
$threads = (Get-CimInstance Win32_ComputerSystem).NumberOfLogicalProcessors
|
||||
cmake --build . --config Debug --parallel $threads
|
||||
cmake --build . --config Release --parallel $threads
|
||||
|
||||
- name: Test
|
||||
working-directory: build
|
||||
run: ctest -C Debug -V
|
||||
env:
|
||||
CTEST_OUTPUT_ON_FAILURE: True
|
||||
|
||||
- name: NuGet Pack
|
||||
run: |
|
||||
cp readme.rst readme.md
|
||||
cp license.rst readme.md
|
||||
$Tag = "${{ github.ref }}" -replace '(refs/tags/)(.+)', '$2'
|
||||
$Version = $Tag -replace '((\d+)(\.\d+){1,3})(-.+|)', '$1'
|
||||
$InformationalVersion = "$Tag SHA-${{ github.SHA }}"
|
||||
$PackageVersion = $Tag
|
||||
echo "Version: $Tag"
|
||||
echo "Informational Version: $InformationalVersion"
|
||||
echo "Package Version: $Tag"
|
||||
nuget pack bundle\nuget\fmt.nuspec -properties Id=wuganhao.fmt -version $PackageVersion -basepath . -OutputFileNamesWithoutVersion -OutputDirectory dist
|
||||
|
||||
- name: Nuget Push
|
||||
run: |
|
||||
nuget push dist\*.nupkg -source https://api.nuget.org/v3/index.json -apikey ${{ secrets.nuget_apikey }}
|
||||
3
.gitignore
vendored
3
.gitignore
vendored
@ -35,3 +35,6 @@ FMT.build
|
||||
Makefile
|
||||
run-msbuild.bat
|
||||
fmt.pc
|
||||
*.nupkg
|
||||
/license.md
|
||||
/readme.md
|
||||
|
||||
30
bundle/nuget/fmt.nuspec
Normal file
30
bundle/nuget/fmt.nuspec
Normal file
@ -0,0 +1,30 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
|
||||
<metadata>
|
||||
<id>$Id$</id>
|
||||
<version>$version$</version>
|
||||
<authors>Wu Ganhao<wuganhao@hotmail.com></authors>
|
||||
<owners>Wu Ganhao<wuganhao@hotmail.com></owners>
|
||||
<developmentDependency>true</developmentDependency>
|
||||
<requireLicenseAcceptance>false</requireLicenseAcceptance>
|
||||
<description>{fmt} is an open-source formatting library providing a fast and safe alternative to C stdio and C++ iostreams.</description>
|
||||
<repository type="git" url="https://github.com/$repository$/" />
|
||||
<license type="file">docs\license.md</license>
|
||||
<readme>docs\readme.md</readme>
|
||||
<dependencies>
|
||||
<group targetFramework="native0.0" />
|
||||
</dependencies>
|
||||
</metadata>
|
||||
<files>
|
||||
<file src="include\fmt\**\*" target="include\fmt\" />
|
||||
<file src="build\Debug\fmtd.lib" target="lib\native\x64\debug\" />
|
||||
<file src="build\bin\Debug\fmtd.dll" target="lib\native\x64\debug\" />
|
||||
<file src="build\bin\Debug\fmtd.pdb" target="lib\native\x64\debug\" />
|
||||
<file src="build\Release\fmt.lib" target="lib\native\x64\debug\" />
|
||||
<file src="build\bin\Release\fmt.dll" target="lib\native\x64\debug\" />
|
||||
<file src="bundle\nuget\fmt.props" target="build\$Id$.props" />
|
||||
<file src="bundle\nuget\fmt.targets" target="build\$Id$.targets" />
|
||||
<file src="LICENSE.md" target="docs\" />
|
||||
<file src="README.md" target="docs\" />
|
||||
</files>
|
||||
</package>
|
||||
12
bundle/nuget/fmt.props
Normal file
12
bundle/nuget/fmt.props
Normal file
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<fmtIncludePaths>$(MSBuildThisFileDirectory)..\include\;$(MSBuildThisFileDirectory)..\lib\native\x64\$(Configuration)</fmtIncludePaths>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)'=='Release'">
|
||||
<fmtLibs>fmt.lib;</fmtLibs>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)'=='Debug'">
|
||||
<fmtLibs>fmtd.lib;</fmtLibs>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
29
bundle/nuget/fmt.targets
Normal file
29
bundle/nuget/fmt.targets
Normal file
@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>$(fmtIncludePaths);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup>
|
||||
<Link>
|
||||
<AdditionalDependencies>%(fmtLibs);%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup>
|
||||
<Link>
|
||||
<AdditionalLibraryDirectories>$(MSBuildThisFileDirectory)..\lib\native\$(Platform)\$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<BuildDependsOn>$(BuildDependsOn);DeployfmtArtifacts</BuildDependsOn>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<wxWidgetsArtifacts Include="$(MSBuildThisFileDirectory)..\lib\native\x64\$(Configuration)\*.dll" />
|
||||
<wxWidgetsArtifacts Condition="'$(Configuration)'=='Debug'" Include="$(MSBuildThisFileDirectory)..\lib\native\x64\$(Configuration)\*.pdb" />
|
||||
</ItemGroup>
|
||||
<Target Name="DeployfmtArtifacts">
|
||||
<Error Text="Package 'wxWidgets' currently only support 64bit build" Condition="'$(Platform)'!='x64'" />
|
||||
<Copy SourceFiles="@(fmtArtifacts)" DestinationFolder="$(TargetDir)\" />
|
||||
</Target>
|
||||
</Project>
|
||||
Loading…
Reference in New Issue
Block a user