Skip to content

Commit 0c53ec2

Browse files
authored
chore: Add dotnet release-please support. (#197)
## Summary Adds release please support for the dotnet observability plugin. Also adds documentation builds. ## How did you test this change? Ran manual publish and manual docs. Links: https://www.nuget.org/packages/LaunchDarkly.Observability/ https://launchdarkly.github.io/observability-sdk/sdk/@launchdarkly/observability-dotnet/ ## Are there any deployment considerations? <!-- Backend - Do we need to consider migrations or backfilling data? -->
1 parent e0baf35 commit 0c53ec2

File tree

14 files changed

+274
-5
lines changed

14 files changed

+274
-5
lines changed
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Publish .NET SDK
2+
3+
inputs:
4+
aws-role-arn:
5+
description: 'The AWS role ARN to assume.'
6+
type: string
7+
required: true
8+
dry-run:
9+
description: 'Is this a dry run. If so no package will be published.'
10+
type: boolean
11+
required: true
12+
13+
outputs:
14+
package-hashes:
15+
description: 'Base64 encoded SHA256 hashes of published packages'
16+
value: ${{ steps.package-hashes.outputs.package-hashes }}
17+
18+
runs:
19+
using: composite
20+
steps:
21+
- uses: launchdarkly/gh-actions/actions/[email protected]
22+
name: Get secrets
23+
with:
24+
aws_assume_role: ${{ inputs.aws-role-arn }}
25+
ssm_parameter_pairs:
26+
'/production/common/releasing/digicert/host = DIGICERT_HOST,
27+
/production/common/releasing/digicert/api_key = DIGICERT_API_KEY,
28+
/production/common/releasing/digicert/client_cert_file_b64 = DIGICERT_CLIENT_CERT_FILE_B64,
29+
/production/common/releasing/digicert/client_cert_password = DIGICERT_CLIENT_CERT_PASSWORD,
30+
/production/common/releasing/digicert/code_signing_cert_sha1_hash = DIGICERT_CODE_SIGNING_CERT_SHA1_HASH,
31+
/production/common/releasing/nuget/api_key = NUGET_API_KEY'
32+
s3_path_pairs: 'launchdarkly-releaser/dotnet/LaunchDarkly.snk = LaunchDarkly.snk'
33+
34+
- name: Restore
35+
shell: bash
36+
working-directory: sdk/@launchdarkly/observability-dotnet
37+
run: dotnet restore
38+
39+
- name: Build
40+
shell: bash
41+
working-directory: ./sdk/@launchdarkly/observability-dotnet
42+
run: dotnet build ./src/LaunchDarkly.Observability/LaunchDarkly.Observability.csproj --no-restore -p:Configuration=Release
43+
44+
- name: Package
45+
shell: bash
46+
working-directory: ./sdk/@launchdarkly/observability-dotnet
47+
run: dotnet pack ./src/LaunchDarkly.Observability/LaunchDarkly.Observability.csproj --no-build --output nupkgs --configuration Release
48+
49+
- name: Publish Package
50+
if: ${{ inputs.dry-run == 'false' }}
51+
shell: bash
52+
working-directory: ./sdk/@launchdarkly/observability-dotnet
53+
run: |
54+
for pkg in $(find ./nupkgs -name '*.nupkg' -o -name '*.snupkg'); do
55+
echo "publishing ${pkg}"
56+
dotnet nuget push "${pkg}" --api-key ${{ env.NUGET_API_KEY }} --source https://www.nuget.org
57+
echo "published ${pkg}"
58+
done
59+
60+
- name: Hash nuget packages
61+
id: package-hashes
62+
shell: bash
63+
working-directory: ./sdk/@launchdarkly/observability-dotnet
64+
run: |
65+
echo "package-hashes=$(sha256sum ./nupkgs/*.nupkg ./nupkgs/*.snupkg | base64 -w0)" >> "$GITHUB_OUTPUT"

.github/workflows/dotnet-plugin.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,7 @@ jobs:
2929

3030
- run: dotnet test --no-restore
3131
working-directory: sdk/@launchdarkly/observability-dotnet
32+
33+
- name: Lint
34+
run: dotnet format --verify-no-changes
35+
working-directory: sdk/@launchdarkly/observability-dotnet

.github/workflows/manual-publish-docs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ on:
1111
- 'sdk/@launchdarkly/observability-node'
1212
- 'sdk/@launchdarkly/observability-python'
1313
- 'sdk/@launchdarkly/observability-react-native'
14+
- 'sdk/@launchdarkly/observability-dotnet'
1415
workflow_call:
1516
inputs:
1617
workspace_path:

.github/workflows/manual-publish.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,14 @@ on:
3030
description: 'The tag name for the python package. Should be set when publishing a python package.'
3131
type: string
3232
required: false
33+
release_launchdarkly_dotnet:
34+
description: 'Should release @launchdarkly/observability-dotnet package.'
35+
type: boolean
36+
required: true
37+
dotnet_tag_name:
38+
description: 'The tag name for the dotnet package. Should be set when publishing a dotnet package.'
39+
type: string
40+
required: false
3341

3442
permissions:
3543
id-token: write
@@ -146,3 +154,34 @@ jobs:
146154
aws-role-arn: ${{ vars.AWS_ROLE_ARN }}
147155
dry-run: ${{ inputs.dry-run }}
148156
prerelease: ${{ inputs.prerelease }}
157+
158+
publish-dotnet-sdk:
159+
runs-on: ubuntu-latest
160+
if: ${{ inputs.release_launchdarkly_dotnet == true }}
161+
permissions:
162+
id-token: write
163+
outputs:
164+
package-hashes: ${{ steps.publish.outputs.package-hashes }}
165+
steps:
166+
- name: Checkout
167+
uses: actions/checkout@v4
168+
169+
- name: Publish .NET SDK
170+
id: publish
171+
uses: ./.github/actions/publish-dotnet-sdk
172+
with:
173+
aws-role-arn: ${{ vars.AWS_ROLE_ARN }}
174+
dry-run: ${{ inputs.dry-run }}
175+
176+
publish-dotnet-sdk-provenance:
177+
needs: ['publish-dotnet-sdk']
178+
if: ${{ inputs.release_launchdarkly_dotnet == true && inputs.dry-run == false }}
179+
permissions:
180+
actions: read
181+
id-token: write
182+
contents: write
183+
uses: slsa-framework/slsa-github-generator/.github/workflows/[email protected]
184+
with:
185+
base64-subjects: '${{ needs.publish-dotnet-sdk.outputs.package-hashes }}'
186+
upload-assets: true
187+
upload-tag-name: ${{ inputs.dotnet_tag_name }}

.github/workflows/release-please.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ jobs:
1616
python-plugin-tag-name: ${{ steps.release.outputs['sdk/@launchdarkly/observability-python--tag_name'] }}
1717
android-plugin-released: ${{ steps.release.outputs['sdk/@launchdarkly/observability-android--release_created'] }}
1818
android-plugin-tag-name: ${{ steps.release.outputs['sdk/@launchdarkly/observability-android--tag_name'] }}
19+
dotnet-plugin-released: ${{ steps.release.outputs['sdk/@launchdarkly/observability-dotnet--release_created'] }}
20+
dotnet-plugin-tag-name: ${{ steps.release.outputs['sdk/@launchdarkly/observability-dotnet--tag_name'] }}
1921
steps:
2022
- uses: googleapis/release-please-action@a02a34c4d625f9be7cb89156071d8567266a2445
2123
id: release
@@ -85,3 +87,47 @@ jobs:
8587
with:
8688
workspace-path: sdk/@launchdarkly/observability-android
8789
aws-role-arn: ${{ vars.AWS_ROLE_ARN }}
90+
91+
release-dotnet-plugin:
92+
runs-on: ubuntu-latest
93+
permissions:
94+
id-token: write # Used for publishing secrets.
95+
needs: ['release-package']
96+
outputs:
97+
package-hashes: ${{ steps.publish.outputs.package-hashes }}
98+
if: ${{ needs.release-package.outputs.dotnet-plugin-released == 'true' }}
99+
steps:
100+
- name: Checkout
101+
uses: actions/checkout@v4
102+
103+
- name: Publish .NET SDK
104+
id: publish
105+
uses: ./.github/actions/publish-dotnet-sdk
106+
with:
107+
aws-role-arn: ${{ vars.AWS_ROLE_ARN }}
108+
dry-run: false
109+
110+
release-dotnet-plugin-docs:
111+
runs-on: ubuntu-latest
112+
permissions:
113+
contents: write
114+
needs: ['release-package', 'release-dotnet-plugin']
115+
if: ${{ needs.release-package.outputs.dotnet-plugin-released == 'true' }}
116+
steps:
117+
- name: Build and Publish Docs
118+
uses: ./.github/workflows/manual-publish-docs.yml
119+
with:
120+
workspace_path: sdk/@launchdarkly/observability-dotnet
121+
122+
release-dotnet-sdk-provenance:
123+
needs: ['release-package', 'release-dotnet-plugin']
124+
if: ${{ needs.release-package.outputs.dotnet-plugin-released == 'true' }}
125+
permissions:
126+
actions: read
127+
id-token: write
128+
contents: write
129+
uses: slsa-framework/slsa-github-generator/.github/workflows/[email protected]
130+
with:
131+
base64-subjects: '${{ needs.release-dotnet-plugin.outputs.package-hashes }}'
132+
upload-assets: true
133+
upload-tag-name: ${{ needs.release-package.outputs.dotnet-plugin-tag-name }}

.release-please-manifest.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"sdk/@launchdarkly/observability-python": "0.1.0",
33
"go": "0.2.1",
4-
"sdk/@launchdarkly/observability-android": "0.4.0"
4+
"sdk/@launchdarkly/observability-android": "0.4.0",
5+
"sdk/@launchdarkly/observability-dotnet": "0.0.0"
56
}

release-please-config.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,17 @@
2525
"include-v-in-tag": true,
2626
"include-component-in-tag": true,
2727
"extra-files": ["version.go"]
28+
},
29+
"sdk/@launchdarkly/observability-dotnet": {
30+
"release-as": "0.1.0",
31+
"bump-minor-pre-major": true,
32+
"package-name": "launchdarkly-observability-dotnet",
33+
"release-type": "simple",
34+
"include-v-in-tag": false,
35+
"include-component-in-tag": true,
36+
"extra-files": [
37+
"src/LaunchDarkly.Observability/LaunchDarkly.Observability.csproj"
38+
]
2839
}
2940
}
3041
}

sdk/@launchdarkly/observability-dotnet/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,6 @@
22
**/obj
33
LaunchDarkly.Observability.sln.DotSettings.user
44
**/launchSettings.json
5+
docs/
6+
api/
7+
nupkgs/
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
.PHONY: build test docs help install
2+
3+
# Default target
4+
help:
5+
@echo "Available targets:"
6+
@echo " build - Build the solution"
7+
@echo " test - Run tests"
8+
@echo " docs - Build documentation"
9+
@echo " lint - Run linting"
10+
@echo " help - Show this help message"
11+
12+
install:
13+
dotnet restore
14+
15+
build:
16+
dotnet build LaunchDarkly.Observability.sln
17+
18+
test:
19+
dotnet test LaunchDarkly.Observability.sln
20+
21+
lint:
22+
dotnet format --verify-no-changes
23+
24+
docs:
25+
dotnet tool update -g docfx
26+
docfx metadata
27+
docfx build

sdk/@launchdarkly/observability-dotnet/README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
LaunchDarkly Observability Plugin for .Net
22
===========================
33

4-
[//]: # (These can be uncommented once the links are live.)
5-
[//]: # ([![Actions Status][dotnetplugin-sdk-ci-badge]][dotnetplugin-sdk-ci])
6-
[//]: # ([![Documentation]&#40;https://img.shields.io/static/v1?label=GitHub+Pages&message=API+reference&color=00add8&#41;][o11y-docs-link])
7-
[//]: # ([![NuGet][dotnetplugin-nuget-badge]][dotnetplugin-nuget-link])
4+
[![Actions Status][dotnetplugin-sdk-ci-badge]][dotnetplugin-sdk-ci]
5+
[![Documentation](https://img.shields.io/static/v1?label=GitHub+Pages&message=API+reference&color=00add8&#41)][o11y-docs-link]
6+
[![NuGet][dotnetplugin-nuget-badge]][dotnetplugin-nuget-link]
87

98
# Early Access Preview️
109

0 commit comments

Comments
 (0)