Skip to content

Commit

Permalink
[repo] Release process tweaks & improvements (#5584)
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeBlanch committed May 1, 2024
1 parent c2558da commit eace49c
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 80 deletions.
63 changes: 60 additions & 3 deletions .github/workflows/publish-packages-1.0.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,18 @@
name: Build, pack, and publish to MyGet

on:
release:
types: [published]
workflow_dispatch:
push:
tags:
- 'core-*'
- 'coreunstable-*'
- 'Instrumentation.*-'
schedule:
- cron: '0 0 * * *' # once in a day at 00:00

permissions:
contents: write

jobs:
build-pack-publish:
runs-on: windows-latest
Expand All @@ -36,7 +43,7 @@ jobs:
run: dotnet build OpenTelemetry.proj --configuration Release --no-restore -p:Deterministic=true -p:BuildNumber=${{ github.run_number }} -p:RunningDotNetPack=true

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

- name: Publish Artifacts
uses: actions/upload-artifact@v4
Expand All @@ -48,3 +55,53 @@ jobs:
run: |
nuget setApiKey ${{ secrets.MYGET_TOKEN }} -Source https://www.myget.org/F/opentelemetry/api/v2/package
nuget push **/bin/**/*.nupkg -Source https://www.myget.org/F/opentelemetry/api/v2/package
- name: Create GitHub Release Draft
if: github.ref_type == 'tag'
shell: pwsh
run: |
$packages = (Get-ChildItem -Path src/*/bin/Release/*.nupkg).Name
$notes = ''
$firstPackageVersion = ''
foreach ($package in $packages)
{
$match = [regex]::Match($package, '(.*)\.(\d+\.\d+\.\d+.*?)\.nupkg')
$packageName = $match.Groups[1].Value
$packageVersion = $match.Groups[2].Value
if ($firstPackageVersion -eq '')
{
$firstPackageVersion = $packageVersion
}
$notes +=
@"
* NuGet: [$packageName v$packageVersion](https://www.nuget.org/packages/$packageName/$packageVersion)
See [CHANGELOG](https://github.com/${{ github.repository }}/blob/${{ github.ref_name }}/src/$packageName/CHANGELOG.md) for details.
"@
}
if ($firstPackageVersion -match '-alpha' -or $firstPackageVersion -match '-beta' -or $firstPackageVersion -match '-rc')
{
gh release create ${{ github.ref_name }} `
--title ${{ github.ref_name }} `
--verify-tag `
--notes "$notes" `
--prerelease `
--draft
}
else
{
gh release create ${{ github.ref_name }} `
--title ${{ github.ref_name }} `
--verify-tag `
--notes "$notes" `
--latest `
--draft
}
env:
GH_TOKEN: ${{ github.token }}
1 change: 0 additions & 1 deletion OpenTelemetry.sln
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{7CB2F02E
build\docker-compose.net7.0.yml = build\docker-compose.net7.0.yml
build\docker-compose.net8.0.yml = build\docker-compose.net8.0.yml
build\finalize-publicapi.ps1 = build\finalize-publicapi.ps1
build\generate-combined-changelog.ps1 = build\generate-combined-changelog.ps1
build\GlobalAttrExclusions.txt = build\GlobalAttrExclusions.txt
build\InstrumentationLibraries.proj = build\InstrumentationLibraries.proj
build\opentelemetry-icon-color.png = build\opentelemetry-icon-color.png
Expand Down
61 changes: 27 additions & 34 deletions build/RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,32 +55,23 @@
`OTelLatestStableVer` property in `Directory.Packages.props` has been
updated to the latest stable core version.

2. Generate combined CHANGELOG

Run the PowerShell script `.\build\generate-combined-changelog.ps1
-minVerTagPrefix [MinVerTagPrefix]`. Where `[MinVerTagPrefix]` is the tag
prefix (eg `core-`) for the components being released. This generates a
combined changelog file to be used in GitHub release. The file is created in
the repo root but should not be checked in. Move it or copy the contents off
and then delete the file.

3. Update CHANGELOG files
2. Update CHANGELOG files

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

4. **Stable releases only**: Normalize PublicApi files
3. **Stable releases only**: Normalize PublicApi files

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

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

Expand Down Expand Up @@ -113,46 +104,48 @@
git push origin Instrumentation.AspNetCore-1.6.0
```

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

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

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

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

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

11. Create or regenerate an API key from nuget.org (only maintainers have
9. Download latest [nuget.exe](https://www.nuget.org/downloads) into the same
folder from Step 8.

10. Create or regenerate an API key from nuget.org (only maintainers have
access). When creating API keys make sure it is set to expire in 1 day or
less.

12. Run the following commands from PowerShell from local folder used in Step 9:
11. Run the following commands from PowerShell from local folder used in Step 8:

```powershell
.\nuget.exe setApiKey <actual api key>
get-childitem -Recurse | where {$_.extension -eq ".nupkg"} | foreach ($_) {.\nuget.exe push $_.fullname -Source https://api.nuget.org/v3/index.json}
```

13. Validate that the package(s) are uploaded. Packages are available
12. Validate that the package(s) are uploaded. Packages are available
immediately to maintainers on nuget.org but aren't publicly visible until
scanning completes. This process usually takes a few minutes.

13. Open the
[Releases](https://github.com/open-telemetry/opentelemetry-dotnet/releases)
page on the GitHub repository. The [Build, pack, and publish to MyGet
workflow](https://github.com/open-telemetry/opentelemetry-dotnet/actions/workflows/publish-packages-1.0.yml)
creates a draft release for the tag which was pushed. Edit the draft Release
and click `Publish release`.

14. If a new stable version of the core packages was released, open a PR to
update the `OTelLatestStableVer` property in `Directory.Packages.props` to
the just released stable version.
Expand Down
42 changes: 0 additions & 42 deletions build/generate-combined-changelog.ps1

This file was deleted.

0 comments on commit eace49c

Please sign in to comment.