Skip to content

Commit eace49c

Browse files
authored
[repo] Release process tweaks & improvements (open-telemetry#5584)
1 parent c2558da commit eace49c

File tree

4 files changed

+87
-80
lines changed

4 files changed

+87
-80
lines changed

.github/workflows/publish-packages-1.0.yml

Lines changed: 60 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,18 @@
88
name: Build, pack, and publish to MyGet
99

1010
on:
11-
release:
12-
types: [published]
11+
workflow_dispatch:
12+
push:
13+
tags:
14+
- 'core-*'
15+
- 'coreunstable-*'
16+
- 'Instrumentation.*-'
1317
schedule:
1418
- cron: '0 0 * * *' # once in a day at 00:00
1519

20+
permissions:
21+
contents: write
22+
1623
jobs:
1724
build-pack-publish:
1825
runs-on: windows-latest
@@ -36,7 +43,7 @@ jobs:
3643
run: dotnet build OpenTelemetry.proj --configuration Release --no-restore -p:Deterministic=true -p:BuildNumber=${{ github.run_number }} -p:RunningDotNetPack=true
3744

3845
- name: dotnet pack
39-
run: dotnet pack OpenTelemetry.proj --configuration Release --no-restore --no-build -p:PackTag=${{ github.ref }}
46+
run: dotnet pack OpenTelemetry.proj --configuration Release --no-restore --no-build -p:PackTag=${{ github.ref_type == 'tag' && github.ref_name || '' }}
4047

4148
- name: Publish Artifacts
4249
uses: actions/upload-artifact@v4
@@ -48,3 +55,53 @@ jobs:
4855
run: |
4956
nuget setApiKey ${{ secrets.MYGET_TOKEN }} -Source https://www.myget.org/F/opentelemetry/api/v2/package
5057
nuget push **/bin/**/*.nupkg -Source https://www.myget.org/F/opentelemetry/api/v2/package
58+
59+
- name: Create GitHub Release Draft
60+
if: github.ref_type == 'tag'
61+
shell: pwsh
62+
run: |
63+
$packages = (Get-ChildItem -Path src/*/bin/Release/*.nupkg).Name
64+
65+
$notes = ''
66+
$firstPackageVersion = ''
67+
68+
foreach ($package in $packages)
69+
{
70+
$match = [regex]::Match($package, '(.*)\.(\d+\.\d+\.\d+.*?)\.nupkg')
71+
$packageName = $match.Groups[1].Value
72+
$packageVersion = $match.Groups[2].Value
73+
74+
if ($firstPackageVersion -eq '')
75+
{
76+
$firstPackageVersion = $packageVersion
77+
}
78+
79+
$notes +=
80+
@"
81+
* NuGet: [$packageName v$packageVersion](https://www.nuget.org/packages/$packageName/$packageVersion)
82+
83+
See [CHANGELOG](https://github.com/${{ github.repository }}/blob/${{ github.ref_name }}/src/$packageName/CHANGELOG.md) for details.
84+
85+
"@
86+
}
87+
88+
if ($firstPackageVersion -match '-alpha' -or $firstPackageVersion -match '-beta' -or $firstPackageVersion -match '-rc')
89+
{
90+
gh release create ${{ github.ref_name }} `
91+
--title ${{ github.ref_name }} `
92+
--verify-tag `
93+
--notes "$notes" `
94+
--prerelease `
95+
--draft
96+
}
97+
else
98+
{
99+
gh release create ${{ github.ref_name }} `
100+
--title ${{ github.ref_name }} `
101+
--verify-tag `
102+
--notes "$notes" `
103+
--latest `
104+
--draft
105+
}
106+
env:
107+
GH_TOKEN: ${{ github.token }}

OpenTelemetry.sln

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{7CB2F02E
3535
build\docker-compose.net7.0.yml = build\docker-compose.net7.0.yml
3636
build\docker-compose.net8.0.yml = build\docker-compose.net8.0.yml
3737
build\finalize-publicapi.ps1 = build\finalize-publicapi.ps1
38-
build\generate-combined-changelog.ps1 = build\generate-combined-changelog.ps1
3938
build\GlobalAttrExclusions.txt = build\GlobalAttrExclusions.txt
4039
build\InstrumentationLibraries.proj = build\InstrumentationLibraries.proj
4140
build\opentelemetry-icon-color.png = build\opentelemetry-icon-color.png

build/RELEASING.md

Lines changed: 27 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -55,32 +55,23 @@
5555
`OTelLatestStableVer` property in `Directory.Packages.props` has been
5656
updated to the latest stable core version.
5757

58-
2. Generate combined CHANGELOG
59-
60-
Run the PowerShell script `.\build\generate-combined-changelog.ps1
61-
-minVerTagPrefix [MinVerTagPrefix]`. Where `[MinVerTagPrefix]` is the tag
62-
prefix (eg `core-`) for the components being released. This generates a
63-
combined changelog file to be used in GitHub release. The file is created in
64-
the repo root but should not be checked in. Move it or copy the contents off
65-
and then delete the file.
66-
67-
3. Update CHANGELOG files
58+
2. Update CHANGELOG files
6859

6960
Run the PowerShell script `.\build\update-changelogs.ps1 -minVerTagPrefix
7061
[MinVerTagPrefix] -version [Version]`. Where `[MinVerTagPrefix]` is the tag
7162
prefix (eg `core-`) for the components being released and `[Version]` is the
7263
version being released (eg `1.9.0`). This will update `CHANGELOG.md` files
7364
for the projects being released.
7465

75-
4. **Stable releases only**: Normalize PublicApi files
66+
3. **Stable releases only**: Normalize PublicApi files
7667

7768
Run the PowerShell script `.\build\finalize-publicapi.ps1 -minVerTagPrefix
7869
[MinVerTagPrefix]`. Where `[MinVerTagPrefix]` is the tag prefix (eg `core-`)
7970
for the components being released. This will merge the contents of any
8071
detected `PublicAPI.Unshipped.txt` files in the `.publicApi` folder into the
8172
corresponding `PublicAPI.Shipped.txt` files for the projects being released.
8273

83-
5. Tag Git with version to be released. We use
74+
4. Tag Git with version to be released. We use
8475
[MinVer](https://github.com/adamralph/minver) to do versioning, which
8576
produces version numbers based on git tags.
8677

@@ -113,46 +104,48 @@
113104
git push origin Instrumentation.AspNetCore-1.6.0
114105
```
115106

116-
6. Go to the [list of
117-
tags](https://github.com/open-telemetry/opentelemetry-dotnet/tags) and find
118-
the tag(s) which were pushed. Click the three dots next to the tag and
119-
choose `Create release`.
120-
* Give the release a name based on the tags created (e.g.
121-
`core-1.9.0-beta.1` or `Instrumentation.Http-1.8.0`).
122-
* Paste the contents of combined changelog from Step 2. Only include
123-
projects with changes.
124-
* Check "This is a pre-release" if applicable.
125-
* Click "Publish release". This will kick off the [Pack and publish to
126-
MyGet
127-
workflow](https://github.com/open-telemetry/opentelemetry-dotnet/actions/workflows/publish-packages-1.0.yml).
107+
Pushing the tag will kick off the [Build, pack, and publish to MyGet
108+
workflow](https://github.com/open-telemetry/opentelemetry-dotnet/actions/workflows/publish-packages-1.0.yml).
128109

129-
7. Validate using MyGet packages. Basic sanity checks :)
110+
5. :stop_sign: Wait for the [Build, pack, and publish to MyGet
111+
workflow](https://github.com/open-telemetry/opentelemetry-dotnet/actions/workflows/publish-packages-1.0.yml)
112+
to complete.
130113

131-
8. From the above build, get the artifacts from the drop, which has all the
132-
NuGet packages.
114+
6. Validate locally everything works using the MyGet packages pushed from the
115+
release. Basic sanity checks :)
133116

134-
9. Copy all the NuGet files and symbols for the packages being released into a
135-
local folder.
117+
7. Download the artifacts from the drop attached to the workflow run. The
118+
artifacts archive (`.zip`) contains all the NuGet packages (`.nupkg`) and
119+
symbols (`.snupkg`) from the build which were pushed to MyGet.
136120

137-
10. Download latest [nuget.exe](https://www.nuget.org/downloads) into the same
138-
folder from Step 9.
121+
8. Extract the artifacts from the archive (`.zip`) into a local folder.
139122

140-
11. Create or regenerate an API key from nuget.org (only maintainers have
123+
9. Download latest [nuget.exe](https://www.nuget.org/downloads) into the same
124+
folder from Step 8.
125+
126+
10. Create or regenerate an API key from nuget.org (only maintainers have
141127
access). When creating API keys make sure it is set to expire in 1 day or
142128
less.
143129

144-
12. Run the following commands from PowerShell from local folder used in Step 9:
130+
11. Run the following commands from PowerShell from local folder used in Step 8:
145131

146132
```powershell
147133
.\nuget.exe setApiKey <actual api key>
148134
149135
get-childitem -Recurse | where {$_.extension -eq ".nupkg"} | foreach ($_) {.\nuget.exe push $_.fullname -Source https://api.nuget.org/v3/index.json}
150136
```
151137
152-
13. Validate that the package(s) are uploaded. Packages are available
138+
12. Validate that the package(s) are uploaded. Packages are available
153139
immediately to maintainers on nuget.org but aren't publicly visible until
154140
scanning completes. This process usually takes a few minutes.
155141
142+
13. Open the
143+
[Releases](https://github.com/open-telemetry/opentelemetry-dotnet/releases)
144+
page on the GitHub repository. The [Build, pack, and publish to MyGet
145+
workflow](https://github.com/open-telemetry/opentelemetry-dotnet/actions/workflows/publish-packages-1.0.yml)
146+
creates a draft release for the tag which was pushed. Edit the draft Release
147+
and click `Publish release`.
148+
156149
14. If a new stable version of the core packages was released, open a PR to
157150
update the `OTelLatestStableVer` property in `Directory.Packages.props` to
158151
the just released stable version.

build/generate-combined-changelog.ps1

Lines changed: 0 additions & 42 deletions
This file was deleted.

0 commit comments

Comments
 (0)