Skip to content

Commit 0ff77d4

Browse files
[Out-of-process-collection] Add GitHub Actions workflow for releasing OpenTelemetry.OutOfProcess.Forwarder packages (open-telemetry#4372)
* release workflow. * copilot review update + repo standards
1 parent 45f39a5 commit 0ff77d4

File tree

1 file changed

+138
-0
lines changed

1 file changed

+138
-0
lines changed
Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
name: release-nextgen-forwarder-packages
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: 'Version number for the Forwarder packages (e.g., 1.0.0-alpha.1)'
8+
required: true
9+
type: string
10+
11+
permissions:
12+
contents: read
13+
14+
env:
15+
NUGET_PACKAGES: ${{ github.workspace }}/packages
16+
DOTNET_CLI_TELEMETRY_OPTOUT: 1
17+
18+
jobs:
19+
build-nextgen-forwarder:
20+
runs-on: windows-2022
21+
defaults:
22+
run:
23+
working-directory: next-gen
24+
steps:
25+
26+
- name: Checkout
27+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # tag: v4.2.2
28+
with:
29+
fetch-depth: 0
30+
ref: out-of-process-collection
31+
32+
- name: Setup .NET
33+
uses: actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9 # tag: v4.3.1
34+
with:
35+
dotnet-version: 9.0.303
36+
37+
- name: Check for NuGet packages cache
38+
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # tag: v4.2.3
39+
id: nuget-cache
40+
with:
41+
key: ${{ hashFiles('**/Directory.packages.props', '**/packages.config' ) }}
42+
path: ${{ env.NUGET_PACKAGES }}
43+
44+
- name: Restore dependencies
45+
run: dotnet restore
46+
47+
- name: Build projects
48+
run: dotnet build --no-restore --configuration Release
49+
50+
- name: Run tests
51+
run: dotnet test --no-build --configuration Release --verbosity normal
52+
53+
- name: Create NuGet packages directory
54+
run: New-Item -ItemType Directory -Path bin/nextgen-nuget-artifacts -Force
55+
shell: pwsh
56+
57+
- name: Pack OpenTelemetry.OutOfProcess.Forwarder
58+
run: |
59+
dotnet pack src/OpenTelemetry.OutOfProcess.Forwarder/OpenTelemetry.OutOfProcess.Forwarder.csproj `
60+
--no-build `
61+
--configuration Release `
62+
--output bin/nextgen-nuget-artifacts `
63+
/p:PackageVersion=${{ inputs.version }} `
64+
/p:AssemblyVersion=${{ inputs.version }} `
65+
/p:FileVersion=${{ inputs.version }} `
66+
/p:Version=${{ inputs.version }}
67+
68+
- name: Pack OpenTelemetry.OutOfProcess.Forwarder.Configuration
69+
run: |
70+
dotnet pack src/OpenTelemetry.OutOfProcess.Forwarder.Configuration/OpenTelemetry.OutOfProcess.Forwarder.Configuration.csproj `
71+
--no-build `
72+
--configuration Release `
73+
--output bin/nextgen-nuget-artifacts `
74+
/p:PackageVersion=${{ inputs.version }} `
75+
/p:AssemblyVersion=${{ inputs.version }} `
76+
/p:FileVersion=${{ inputs.version }} `
77+
/p:Version=${{ inputs.version }}
78+
79+
- name: Install dotnet-validate
80+
run: dotnet tool install --global dotnet-validate --version 0.0.1-preview.304
81+
82+
- name: Validate NuGet packages
83+
shell: pwsh
84+
run: |
85+
foreach ($file in (Get-ChildItem bin/nextgen-nuget-artifacts/*.nupkg)) {
86+
Write-Host "Validating package: $($file.Name)"
87+
dotnet validate package local $($file)
88+
if (-not ($LASTEXITCODE -eq 0)) {
89+
throw "dotnet validate failed for $($file)";
90+
}
91+
}
92+
93+
- name: List generated packages
94+
shell: pwsh
95+
run: |
96+
Write-Host "Generated packages:"
97+
Get-ChildItem bin/nextgen-nuget-artifacts/*.nupkg | ForEach-Object {
98+
Write-Host " - $($_.Name) ($([math]::Round($_.Length / 1KB, 2)) KB)"
99+
}
100+
101+
- name: Upload NuGet Artifacts
102+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # tag: v4.6.2
103+
with:
104+
name: opentelemetry-nextgen-forwarder-packages
105+
path: bin/nextgen-nuget-artifacts/
106+
retention-days: 30
107+
108+
- name: Create GitHub Release Summary
109+
shell: pwsh
110+
run: |
111+
$summary = @"
112+
## 📦 Next-Gen Forwarder Packages Built
113+
114+
**Version:** ${{ inputs.version }}
115+
**Branch:** out-of-process-collection
116+
117+
### Built Packages:
118+
"@
119+
120+
foreach ($file in (Get-ChildItem bin/nextgen-nuget-artifacts/*.nupkg)) {
121+
$packageName = $file.BaseName -replace '\.\d+\.\d+\.\d+.*$', ''
122+
$summary += "`n- [$packageName]($file.Name) - $([math]::Round($file.Length / 1KB, 2)) KB"
123+
}
124+
125+
$summary += @"
126+
127+
128+
### Manual Publishing Steps:
129+
1. Download the artifact 'opentelemetry-nextgen-forwarder-packages' from this workflow run
130+
2. Extract the .nupkg files
131+
3. Publish manually using:
132+
``````
133+
dotnet nuget push OpenTelemetry.OutOfProcess.Forwarder.${{ inputs.version }}.nupkg --api-key YOUR_API_KEY --source https://api.nuget.org/v3/index.json
134+
dotnet nuget push OpenTelemetry.OutOfProcess.Forwarder.Configuration.${{ inputs.version }}.nupkg --api-key YOUR_API_KEY --source https://api.nuget.org/v3/index.json
135+
``````
136+
"@
137+
138+
$summary | Out-File -FilePath $env:GITHUB_STEP_SUMMARY -Encoding utf8

0 commit comments

Comments
 (0)