diff --git a/.github/workflows/publish-packages-1.0.yml b/.github/workflows/publish-packages-1.0.yml index 1039e4bd77..3a7c7185bf 100644 --- a/.github/workflows/publish-packages-1.0.yml +++ b/.github/workflows/publish-packages-1.0.yml @@ -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 @@ -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 @@ -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 }} diff --git a/OpenTelemetry.sln b/OpenTelemetry.sln index 23c03fbf94..681a755ae7 100644 --- a/OpenTelemetry.sln +++ b/OpenTelemetry.sln @@ -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 diff --git a/build/RELEASING.md b/build/RELEASING.md index ceebf83432..57542d9d47 100644 --- a/build/RELEASING.md +++ b/build/RELEASING.md @@ -55,16 +55,7 @@ `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 @@ -72,7 +63,7 @@ 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-`) @@ -80,7 +71,7 @@ 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. @@ -113,35 +104,30 @@ 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 @@ -149,10 +135,17 @@ 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. diff --git a/build/generate-combined-changelog.ps1 b/build/generate-combined-changelog.ps1 deleted file mode 100644 index 486830aebe..0000000000 --- a/build/generate-combined-changelog.ps1 +++ /dev/null @@ -1,42 +0,0 @@ -param( - [Parameter(Mandatory=$true)][string]$minVerTagPrefix -) - -$projectDirs = Get-ChildItem -Path src/**/*.csproj | Select-String "$minVerTagPrefix" -List | Select Path | Split-Path -Parent - -foreach ($projectDir in $projectDirs) { - $path = Join-Path -Path $projectDir -ChildPath "CHANGELOG.md" - - $directory = Split-Path $Path -Parent | Split-Path -Leaf - - $lines = Get-Content -Path $path - - $headingWritten = $false - $started = $false - $content = "" - - foreach ($line in $lines) - { - if ($line -like "## Unreleased" -and $started -ne $true) - { - $started = $true - } - elseif ($line -like "## *" -and $started -eq $true) - { - break - } - else - { - if ($started -eq $true) - { - $content += $line + "`r`n" - } - } - } - - if ([string]::IsNullOrWhitespace($content) -eq $false) - { - Add-Content -Path ".\$($minVerTagPrefix)combinedchangelog.md" -Value "**$($directory)**" - Add-Content -Path ".\$($minVerTagPrefix)combinedchangelog.md" -NoNewline -Value $content - } -}