Skip to content

Commit 08499bf

Browse files
authored
Hotfix Release: v2.11.1.1-RC1+gr - collective changes (#9)
- CI/CD script
1 parent bde8379 commit 08499bf

File tree

2 files changed

+92
-2
lines changed

2 files changed

+92
-2
lines changed

.github/workflows/build.yml

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
name: 'confluent-kafka-dotnet build pipeline'
2+
3+
env:
4+
DOTNET_CLI_TELEMETRY_OPTOUT: 'true'
5+
6+
on:
7+
push:
8+
pull_request:
9+
10+
jobs:
11+
12+
build-test:
13+
strategy:
14+
matrix:
15+
os: [ubuntu-latest, windows-latest, macos-13] # macos-13 for x86_x64 arch
16+
runs-on: ${{ matrix.os }}
17+
steps:
18+
- uses: actions/checkout@v4
19+
- name: Setup .NET
20+
uses: actions/setup-dotnet@v4
21+
with:
22+
dotnet-version: |
23+
6.0.x
24+
8.0.x
25+
- name: Build and test
26+
run: |
27+
dotnet nuget add source --username user --password ${{ github.token }} --store-password-in-clear-text --name github https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json
28+
dotnet test -c Release /p:TreatWarningsAsErrors=true test/Confluent.Kafka.UnitTests/Confluent.Kafka.UnitTests.csproj
29+
30+
package:
31+
needs: [build-test]
32+
runs-on: windows-latest
33+
steps:
34+
35+
- name: Show default environment variables
36+
run: |
37+
echo "The job_id is: $GITHUB_JOB" # reference the default environment variables
38+
echo "The id of this action is: $GITHUB_ACTION" # reference the default environment variables
39+
echo "The run id is: $GITHUB_RUN_ID"
40+
echo "The GitHub Actor's username is: $GITHUB_ACTOR"
41+
echo "GitHub SHA: $GITHUB_SHA"
42+
- uses: actions/checkout@v4
43+
- name: Setup .NET
44+
uses: actions/setup-dotnet@v4
45+
with:
46+
dotnet-version: |
47+
6.0.x
48+
8.0.x
49+
- name: Build and create packages
50+
run: |
51+
dotnet nuget add source --username user --password ${{ github.token }} --store-password-in-clear-text --name github https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json
52+
dotnet build Confluent.Kafka.sln -c Release
53+
54+
# Different packaging for tagged vs untagged builds
55+
$proj_version = (dotnet msbuild ./src/Confluent.Kafka/Confluent.Kafka.csproj -getproperty:VersionPrefix)
56+
if ($env:GITHUB_REF -match '^refs/tags/') {
57+
$tag_version = $env:GITHUB_REF -replace '^refs/tags/v', ''
58+
if ($tag_version -ne $proj_version) {
59+
Write-Output "::error title=Version mismatch::Tag version '$tag_version' does not match project version '$proj_version'."
60+
exit 1
61+
}
62+
} else {
63+
$version_components = $proj_version -split '\+'
64+
$version_args = @("/p:Version=$($version_components[0])-ci-$env:GITHUB_RUN_ID+$($version_components[1])")
65+
}
66+
67+
dotnet pack src/Confluent.Kafka/Confluent.Kafka.csproj --output dist -c Release @version_args
68+
69+
- name: Upload artifacts
70+
uses: actions/upload-artifact@v4
71+
with:
72+
name: build-artifacts
73+
path: dist/
74+
75+
# Publish NuGet packages when a tag is pushed.
76+
# Tests need to succeed for all components and on all platforms first,
77+
# including having a tag name that matches the version number.
78+
publish-release:
79+
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
80+
needs: package
81+
runs-on: ubuntu-latest
82+
steps:
83+
- name: Download NuGet package artifacts
84+
uses: actions/download-artifact@v4
85+
with:
86+
name: build-artifacts
87+
path: dist
88+
- name: Publish to NuGet
89+
run: |
90+
dotnet nuget push "dist/Confluent.Kafka*.nupkg" --source https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json --api-key ${{ github.token }}

src/Confluent.Kafka/Confluent.Kafka.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<PackageReadmeFile>README.md</PackageReadmeFile>
1717
<Title>Confluent.Kafka</Title>
1818
<AssemblyName>Confluent.Kafka</AssemblyName>
19-
<VersionPrefix>2.11.1</VersionPrefix>
19+
<VersionPrefix>2.11.1.1-RC1+gr</VersionPrefix>
2020
<TargetFrameworks>netstandard2.0;net462;net6.0;net8.0</TargetFrameworks>
2121
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
2222
<GenerateDocumentationFile>true</GenerateDocumentationFile>
@@ -25,7 +25,7 @@
2525
</PropertyGroup>
2626

2727
<ItemGroup>
28-
<PackageReference Include="librdkafka.redist" Version="2.11.1">
28+
<PackageReference Include="librdkafka.redist" Version="2.11.1.1-RC1+gr">
2929
<PrivateAssets Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'">None</PrivateAssets>
3030
</PackageReference>
3131
</ItemGroup>

0 commit comments

Comments
 (0)