Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions .github/workflows/publish-dotnet-wrapper.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Publish SpannerLib .NET NuGet Package

on:
# TODO: Remove
pull_request:
workflow_dispatch:

env:
DOTNET_VERSION: '8.0.x' # Set your .NET version here
PROJECT_PATH: 'spannerlib/wrappers/spannerlib-dotnet'

jobs:
publish:
runs-on: ubuntu-latest

# These permissions are required to push packages to GitHub
permissions:
packages: write
contents: read

steps:
- name: Checkout Code
uses: actions/checkout@v4

- name: Setup .NET SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
source-url: https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json
env:
# This automatically authenticates the setup-dotnet step
NUGET_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Build library
run: ./build.sh
working-directory: ${{ env.PROJECT_PATH }}

- name: Restore Dependencies
run: dotnet restore ${{ env.PROJECT_PATH }}

- name: Build
run: dotnet build ${{ env.PROJECT_PATH }} --no-restore --configuration Release

- name: Pack
run: |
dotnet pack ${{ env.PROJECT_PATH }} \
--no-build \
--configuration Release \
--output ./nupkgs

- name: Publish to GitHub Packages
run: |
dotnet nuget push ./nupkgs/*.nupkg \
--source https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json \
--api-key ${{ secrets.GITHUB_TOKEN }} \
--skip-duplicate
1 change: 1 addition & 0 deletions spannerlib/wrappers/spannerlib-dotnet/publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
# Remove existing packages to ensure that only the packages that are built in the next step will be pushed to nuget.
find ./**/bin/Release -type f -name "Alpha*.nupkg" -exec rm {} \;

dotnet build
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The dotnet build command is redundant here. The dotnet pack command on line 17 will automatically build the projects before packing them. You can safely remove this line to simplify the script.

# Pack and publish to nuget
dotnet pack
find ./**/bin/Release -type f -name "Alpha*.nupkg" -exec \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,21 @@
<Nullable>enable</Nullable>
<LangVersion>default</LangVersion>
<PackageId>Alpha.Google.Cloud.SpannerLib.GrpcImpl</PackageId>
<Version>1.0.0-alpha.20260119112406</Version>
<Version>1.0.0-alpha.20260120171456</Version>
<Authors>Google</Authors>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<RepositoryUrl>https://github.com/googleapis/go-sql-spanner</RepositoryUrl>
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
</PropertyGroup>
<PropertyGroup Condition="'$(GITHUB_ACTIONS)' == 'true'">
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
</PropertyGroup>
Comment on lines +16 to 18
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This PropertyGroup is redundant because <ContinuousIntegrationBuild>true</ContinuousIntegrationBuild> is already set unconditionally on line 14. You can remove this conditional block to avoid duplication. This same issue is present in the other .csproj files modified in this pull request.


<ItemGroup>
<PackageReference Include="ConfigureAwaitChecker.Analyzer" PrivateAssets="All" Version="5.0.0.1" />
<PackageReference Include="Alpha.Google.Cloud.SpannerLib.GrpcServer" Version="1.0.0-alpha.20260119112406" />
<PackageReference Include="Alpha.Google.Cloud.SpannerLib.GrpcServer" Version="1.0.0-alpha.20260120171456" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All"/>
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,19 @@
<PackageId>Alpha.Google.Cloud.SpannerLib.GrpcServer</PackageId>
<Title>SpannerLib Grpc Server</Title>
<Authors>Google</Authors>
<Version>1.0.0-alpha.20260119112406</Version>
<Version>1.0.0-alpha.20260120171456</Version>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<RepositoryUrl>https://github.com/googleapis/go-sql-spanner</RepositoryUrl>
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
</PropertyGroup>
<PropertyGroup Condition="'$(GITHUB_ACTIONS)' == 'true'">
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="ConfigureAwaitChecker.Analyzer" PrivateAssets="All" Version="5.0.0.1" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All"/>
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,22 @@
<Nullable>enable</Nullable>
<LangVersion>default</LangVersion>
<PackageId>Alpha.Google.Cloud.SpannerLib.Grpc.V1</PackageId>
<Version>1.0.0-alpha.20260119112406</Version>
<Version>1.0.0-alpha.20260120171456</Version>
<Authors>Google</Authors>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<RepositoryUrl>https://github.com/googleapis/go-sql-spanner</RepositoryUrl>
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
</PropertyGroup>
<PropertyGroup Condition="'$(GITHUB_ACTIONS)' == 'true'">
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Google.Cloud.Spanner.V1" Version="5.8.0" />
<PackageReference Include="Google.Protobuf" Version="3.33.4" />
<PackageReference Include="Grpc.Net.Client" Version="2.71.0" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All"/>
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,23 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<PackageId>Alpha.Google.Cloud.SpannerLib.MockServer</PackageId>
<Version>1.0.0-alpha.20260119112406</Version>
<Version>1.0.0-alpha.20260120171456</Version>
<Authors>Google</Authors>
<LangVersion>default</LangVersion>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<RepositoryUrl>https://github.com/googleapis/go-sql-spanner</RepositoryUrl>
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
</PropertyGroup>
<PropertyGroup Condition="'$(GITHUB_ACTIONS)' == 'true'">
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Google.Cloud.Spanner.Admin.Database.V1" Version="5.8.0" />
<PackageReference Include="Google.Cloud.Spanner.V1" Version="5.8.0" />
<PackageReference Include="Grpc.AspNetCore.Server" Version="2.71.0" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All"/>
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,15 @@
<Nullable>enable</Nullable>
<LangVersion>default</LangVersion>
<PackageId>Alpha.Google.Cloud.SpannerLib.NativeImpl</PackageId>
<Version>1.0.0-alpha.20260119112406</Version>
<Version>1.0.0-alpha.20260120171456</Version>
<Authors>Google</Authors>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<RepositoryUrl>https://github.com/googleapis/go-sql-spanner</RepositoryUrl>
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
</PropertyGroup>
<PropertyGroup Condition="'$(GITHUB_ACTIONS)' == 'true'">
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
</PropertyGroup>

<ItemGroup>
Expand All @@ -16,7 +23,8 @@

<ItemGroup>
<PackageReference Include="ConfigureAwaitChecker.Analyzer" PrivateAssets="All" Version="5.0.0.1" />
<PackageReference Include="Alpha.Google.Cloud.SpannerLib.Native" Version="1.0.0-alpha.20260119112406" />
<PackageReference Include="Alpha.Google.Cloud.SpannerLib.Native" Version="1.0.0-alpha.20260120171456" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All"/>
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,19 @@
<PackageId>Alpha.Google.Cloud.SpannerLib.Native</PackageId>
<Title>.NET wrapper for the native SpannerLib shared library</Title>
<Authors>Google</Authors>
<Version>1.0.0-alpha.20260119112406</Version>
<Version>1.0.0-alpha.20260120171456</Version>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<RepositoryUrl>https://github.com/googleapis/go-sql-spanner</RepositoryUrl>
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
</PropertyGroup>
<PropertyGroup Condition="'$(GITHUB_ACTIONS)' == 'true'">
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="ConfigureAwaitChecker.Analyzer" PrivateAssets="All" Version="5.0.0.1" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All"/>
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,30 @@
<Nullable>enable</Nullable>
<LangVersion>default</LangVersion>
<PackageId>Alpha.Google.Cloud.SpannerLib</PackageId>
<Version>1.0.0-alpha.20260119112406</Version>
<Version>1.0.0-alpha.20260120171501</Version>
<PackageVersion>$(Version)</PackageVersion>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The <PackageVersion> property is redundant. If PackageVersion is not specified, it defaults to the value of the <Version> property. You can remove this line to simplify the project file.

<DebugType>portable</DebugType>
<Authors>Google</Authors>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<RepositoryUrl>https://github.com/googleapis/go-sql-spanner</RepositoryUrl>
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
<Deterministic>true</Deterministic>
</PropertyGroup>

<PropertyGroup>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
</PropertyGroup>

<PropertyGroup Condition="'$(GITHUB_ACTIONS)' == 'true'">
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="ConfigureAwaitChecker.Analyzer" PrivateAssets="All" Version="5.0.0.1" />
<PackageReference Include="Google.Cloud.Spanner.V1" Version="5.8.0" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All"/>
</ItemGroup>

</Project>
Loading