Skip to content

Commit 56a714e

Browse files
committed
action
1 parent ec8b18e commit 56a714e

7 files changed

Lines changed: 87 additions & 4 deletions

File tree

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Publish NuGet Packages
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
publish:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: read
13+
14+
defaults:
15+
run:
16+
working-directory: ./src
17+
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v4
21+
22+
- name: Setup .NET
23+
uses: actions/setup-dotnet@v4
24+
with:
25+
dotnet-version: 8.0.x
26+
27+
- name: Restore
28+
run: dotnet restore Disc.NET.sln
29+
30+
- name: Build package version
31+
shell: bash
32+
run: |
33+
VERSION="1.0.${{ github.run_number }}"
34+
echo "PACKAGE_VERSION=$VERSION" >> "$GITHUB_ENV"
35+
36+
- name: Pack
37+
run: dotnet pack Disc.NET.sln --configuration Release --no-restore --output ./artifacts -p:Version=${{ env.PACKAGE_VERSION }}
38+
39+
- name: Publish to NuGet
40+
run: dotnet nuget push "./artifacts/*.nupkg" --api-key "${{ secrets.NUGET_API_KEY }}" --source "https://api.nuget.org/v3/index.json" --skip-duplicate

src/Directory.Build.props

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<Project>
2+
<PropertyGroup>
3+
<PackageId>$(AssemblyName)</PackageId>
4+
<Authors>01Dri</Authors>
5+
<Company>01Dri</Company>
6+
<Description>Disc.NET libraries for building Discord applications with .NET.</Description>
7+
<PackageReadmeFile>README.md</PackageReadmeFile>
8+
<RepositoryUrl>https://github.com/01Dri/Disc.NET</RepositoryUrl>
9+
<RepositoryType>git</RepositoryType>
10+
<PackageProjectUrl>https://github.com/01Dri/Disc.NET</PackageProjectUrl>
11+
<PackageTags>discord;dotnet;net8;bot</PackageTags>
12+
<GenerateDocumentationFile>true</GenerateDocumentationFile>
13+
<IncludeSymbols>false</IncludeSymbols>
14+
</PropertyGroup>
15+
16+
<ItemGroup>
17+
<None Include="$(MSBuildThisFileDirectory)..\README.md" Pack="true" PackagePath="\" Link="README.md" Visible="false" />
18+
</ItemGroup>
19+
</Project>

src/Disc.NET.Client.SDK/Disc.NET.Client.SDK.csproj

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,18 @@
44
<TargetFramework>net8.0</TargetFramework>
55
<ImplicitUsings>enable</ImplicitUsings>
66
<Nullable>enable</Nullable>
7+
<TargetsForTfmSpecificBuildOutput>$(TargetsForTfmSpecificBuildOutput);IncludeSharedProjectOutput</TargetsForTfmSpecificBuildOutput>
78
</PropertyGroup>
89

910
<ItemGroup>
10-
<ProjectReference Include="..\Disc.NET.Shared\Disc.NET.Shared.csproj" />
11+
<ProjectReference Include="..\Disc.NET.Shared\Disc.NET.Shared.csproj" PrivateAssets="all" />
1112
</ItemGroup>
1213

14+
<Target Name="IncludeSharedProjectOutput" DependsOnTargets="ResolveReferences">
15+
<ItemGroup>
16+
<BuildOutputInPackage Include="@(ReferenceCopyLocalPaths)"
17+
Condition="'%(ReferenceCopyLocalPaths.ReferenceSourceTarget)' == 'ProjectReference' and '%(ReferenceCopyLocalPaths.Filename)' == 'Disc.NET.Shared'" />
18+
</ItemGroup>
19+
</Target>
20+
1321
</Project>

src/Disc.NET.Commands/Disc.NET.Commands.csproj

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,19 @@
44
<TargetFramework>net8.0</TargetFramework>
55
<ImplicitUsings>enable</ImplicitUsings>
66
<Nullable>enable</Nullable>
7+
<TargetsForTfmSpecificBuildOutput>$(TargetsForTfmSpecificBuildOutput);IncludeSharedProjectOutput</TargetsForTfmSpecificBuildOutput>
78
</PropertyGroup>
89

910
<ItemGroup>
1011
<ProjectReference Include="..\Disc.NET.Client.SDK\Disc.NET.Client.SDK.csproj" />
11-
<ProjectReference Include="..\Disc.NET.Shared\Disc.NET.Shared.csproj" />
12+
<ProjectReference Include="..\Disc.NET.Shared\Disc.NET.Shared.csproj" PrivateAssets="all" />
1213
</ItemGroup>
1314

15+
<Target Name="IncludeSharedProjectOutput" DependsOnTargets="ResolveReferences">
16+
<ItemGroup>
17+
<BuildOutputInPackage Include="@(ReferenceCopyLocalPaths)"
18+
Condition="'%(ReferenceCopyLocalPaths.ReferenceSourceTarget)' == 'ProjectReference' and '%(ReferenceCopyLocalPaths.Filename)' == 'Disc.NET.Shared'" />
19+
</ItemGroup>
20+
</Target>
21+
1422
</Project>

src/Disc.NET.Shared/Disc.NET.Shared.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<TargetFramework>net8.0</TargetFramework>
55
<ImplicitUsings>enable</ImplicitUsings>
66
<Nullable>enable</Nullable>
7+
<IsPackable>false</IsPackable>
78
</PropertyGroup>
89

910
<ItemGroup>

src/Disc.NET/Disc.NET.csproj

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<TargetFramework>net8.0</TargetFramework>
55
<ImplicitUsings>enable</ImplicitUsings>
66
<Nullable>enable</Nullable>
7+
<TargetsForTfmSpecificBuildOutput>$(TargetsForTfmSpecificBuildOutput);IncludeSharedProjectOutput</TargetsForTfmSpecificBuildOutput>
78
</PropertyGroup>
89

910
<ItemGroup>
@@ -14,7 +15,14 @@
1415
<ItemGroup>
1516
<ProjectReference Include="..\Disc.NET.Client.SDK\Disc.NET.Client.SDK.csproj" />
1617
<ProjectReference Include="..\Disc.NET.Commands\Disc.NET.Commands.csproj" />
17-
<ProjectReference Include="..\Disc.NET.Shared\Disc.NET.Shared.csproj" />
18+
<ProjectReference Include="..\Disc.NET.Shared\Disc.NET.Shared.csproj" PrivateAssets="all" />
1819
</ItemGroup>
1920

21+
<Target Name="IncludeSharedProjectOutput" DependsOnTargets="ResolveReferences">
22+
<ItemGroup>
23+
<BuildOutputInPackage Include="@(ReferenceCopyLocalPaths)"
24+
Condition="'%(ReferenceCopyLocalPaths.ReferenceSourceTarget)' == 'ProjectReference' and '%(ReferenceCopyLocalPaths.Filename)' == 'Disc.NET.Shared'" />
25+
</ItemGroup>
26+
</Target>
27+
2028
</Project>

tests/GenericBot/TestCommand.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ private async Task TestCallbackAsync(InteractionContext context)
4646
await context.Response.SendMessageAsync(new Message()
4747
{
4848
Content = "Teste",
49-
Type = 4,
5049
});
5150
}
5251

0 commit comments

Comments
 (0)