Skip to content

Commit c456cef

Browse files
authored
Add nuget package creation (#3)
* Add nuget package creation * Test ci pipeline * Test ci pipeline * Test ci pipeline * Bump version
1 parent 76c9a19 commit c456cef

File tree

5 files changed

+60
-4
lines changed

5 files changed

+60
-4
lines changed

.github/workflows/ci.yml

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ env:
1616

1717
jobs:
1818
build:
19-
name: Build package
19+
name: Build python package
2020
runs-on: ubuntu-latest
2121
steps:
2222
- uses: actions/checkout@v3
@@ -57,7 +57,7 @@ jobs:
5757
path: dist/
5858
retention-days: 7
5959

60-
Release:
60+
release:
6161
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
6262
needs: [build]
6363
runs-on: ubuntu-latest
@@ -90,7 +90,7 @@ jobs:
9090
twine upload --skip-existing ./**/*.tar.gz
9191
env:
9292
TWINE_USERNAME: PAT
93-
TWINE_PASSWORD: ${{ secrets.PYANSYS_PYPI_PRIVATE_PAT }}
93+
TWINE_PASSWORD: ${{ secrets.PYANSYS_PYPI_PRIVATE_PAT }}
9494
TWINE_REPOSITORY_URL: https://pkgs.dev.azure.com/pyansys/_packaging/pyansys/pypi/upload
9595

9696
- name: Release
@@ -101,3 +101,24 @@ jobs:
101101
./**/*.whl
102102
./**/*.tar.gz
103103
./**/*.pdf
104+
105+
nuget:
106+
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
107+
name: build, pack & publish
108+
runs-on: ubuntu-latest
109+
steps:
110+
- uses: actions/checkout@v2
111+
112+
- name: Setup dotnet
113+
uses: actions/setup-dotnet@v1
114+
with:
115+
dotnet-version: 6.0.x
116+
117+
# Publish
118+
- name: build and publish nuget package
119+
run: |
120+
dotnet nuget add source --username ${{ github.actor }} --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/ansys/index.json"
121+
version=$(find . -name VERSION -exec cat "{}" \;)
122+
rm -rf nuget_package
123+
dotnet pack csharp/Ansys.Api.Additive.csproj -c Release -o nuget_package -p:PackageVersion=${version}
124+
dotnet nuget push nuget_package/*.nupkg --source github

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,7 @@ venv/
3838
# autogenerated Python code
3939
*pb2*.py
4040
*pb2*.pyi
41+
42+
# Compiled code
43+
bin/
44+
obj/

ansys/api/additive/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.1.1
1+
0.1.2

csharp/Ansys.Api.Additive.csproj

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>netstandard2.0</TargetFramework>
5+
<AssemblyName>Ansys.Api.Additive</AssemblyName>
6+
<Authors>Additive Developers</Authors>
7+
<Company>Ansys Inc.</Company>
8+
<PackageDescription>Protobuf definitions for Additive API</PackageDescription>
9+
<RepositoryUrl>https://github.com/ansys/ansys-api-additive</RepositoryUrl>
10+
</PropertyGroup>
11+
<ItemGroup>
12+
<Protobuf Include="../ansys/**/*.proto" ProtoRoot=".." GrpcServices="both" />
13+
</ItemGroup>
14+
<ItemGroup>
15+
<PackageReference Include="Google.Protobuf" Version="3.21.9" />
16+
<PackageReference Include="Grpc" Version="2.46.5" />
17+
<PackageReference Include="Grpc.Tools" Version="2.50.0">
18+
<PrivateAssets>all</PrivateAssets>
19+
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
20+
</PackageReference>
21+
</ItemGroup>
22+
</Project>

csharp/nuget.config

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<configuration>
3+
<activePackageSource>
4+
<add key="All" value="(Aggregate source)" />
5+
</activePackageSource>
6+
<packageSources>
7+
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
8+
</packageSources>
9+
</configuration>

0 commit comments

Comments
 (0)