Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
b55d3c3
docs: add RELEASING.md
MikeGoldsmith May 15, 2026
8809ed6
add note about towncrier dependency
MikeGoldsmith May 15, 2026
9c439ad
revert inline towncrier note
MikeGoldsmith May 15, 2026
0d582bf
Merge branch 'main' into mike/releasing-docs
MikeGoldsmith May 19, 2026
d92b156
Merge remote-tracking branch 'upstream/main' into mike/releasing-docs
MikeGoldsmith May 19, 2026
b487c37
port package release workflows from contrib
MikeGoldsmith May 19, 2026
df8f1e5
Merge remote-tracking branch 'origin/mike/releasing-docs' into mike/r…
MikeGoldsmith May 19, 2026
ad2bec4
drop --discussion-category from gh release create
MikeGoldsmith May 28, 2026
d2f42f7
Merge branch 'main' into mike/releasing-docs
MikeGoldsmith May 28, 2026
9fb0714
Merge branch 'main' into mike/releasing-docs
MikeGoldsmith Jun 1, 2026
529d6d3
restore setup-uv step to package release workflow
MikeGoldsmith Jun 9, 2026
4a74dec
Merge remote-tracking branch 'origin/mike/releasing-docs' into mike/r…
MikeGoldsmith Jun 9, 2026
beb49fa
Merge branch 'main' into mike/releasing-docs
MikeGoldsmith Jun 9, 2026
e069797
add bulk release workflows with tag-from-main and PyPI trusted publis…
MikeGoldsmith Jun 12, 2026
e22e745
merge remote mike/releasing-docs
MikeGoldsmith Jun 12, 2026
40f134c
Merge branch 'main' into mike/releasing-docs
MikeGoldsmith Jun 12, 2026
44f6084
Simplify release docs and release package list.
MikeGoldsmith Jun 15, 2026
faf20fd
Merge branch 'main' into mike/releasing-docs
MikeGoldsmith Jun 15, 2026
4c0c3f1
Merge branch 'main' into mike/releasing-docs
MikeGoldsmith Jun 15, 2026
e0c0b12
Merge branch 'mike/releasing-docs' of github.com:MikeGoldsmith/opente…
MikeGoldsmith Jun 15, 2026
3754e74
style: apply ruff format to scripts/eachdist.py
MikeGoldsmith Jun 16, 2026
e56ea60
Merge branch 'main' into mike/releasing-docs
MikeGoldsmith Jun 16, 2026
88d013b
Merge branch 'main' into mike/releasing-docs
MikeGoldsmith Jun 17, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/scripts/use-cla-approved-github-bot.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash -e

git config user.name otelbot
git config user.email 197425009+otelbot@users.noreply.github.com
85 changes: 85 additions & 0 deletions .github/workflows/_prepare-release-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: _Prepare release package
on:
workflow_call:
inputs:
package:
required: true
type: string
pr_title_prefix:
required: false
type: string
default: ""
add_release_label:
required: false
type: boolean
default: false

permissions:
contents: read

jobs:
prepare:
permissions:
contents: write
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Verify prerequisites
run: |
if [[ "$GITHUB_REF_NAME" != "main" ]]; then
echo "This workflow should only be run against main"
exit 1
fi

version_dev=$(./scripts/eachdist.py version --package ${{ inputs.package }})
if [[ ! "$version_dev" =~ \.dev$ ]]; then
echo "Expected a .dev version on main, got ${version_dev}"
exit 1
fi

echo "VERSION=${version_dev%.dev}" >> $GITHUB_ENV
echo "PACKAGE_NAME=${{ inputs.package }}" >> $GITHUB_ENV

- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: '3.10'

- name: Install tox and towncrier
run: |
pip install tox towncrier==25.8.0

- name: Prepare package for release
run: ./scripts/prepare_package_for_release.sh "${{ inputs.package }}"

- name: Use CLA approved github bot
run: .github/scripts/use-cla-approved-github-bot.sh

- uses: actions/create-github-app-token@df432ceedc7162793a195dd1713ff69aefc7379e # v2.0.6
id: otelbot-token
with:
app-id: ${{ vars.OTELBOT_APP_ID }}
private-key: ${{ secrets.OTELBOT_PRIVATE_KEY }}

- name: Create pull request against main
env:
GITHUB_TOKEN: ${{ steps.otelbot-token.outputs.token }}
run: |
prefix="${{ inputs.pr_title_prefix }}"
message="${prefix}Prepare release for ${PACKAGE_NAME} v${VERSION}"
body="Prepare \`${PACKAGE_NAME}\` v\`${VERSION}\` for release."
branch="otelbot/prepare-${PACKAGE_NAME}-v${VERSION}"

git commit -a -m "$message"
git push origin HEAD:"$branch"
pr_url=$(gh pr create --title "$message" \
--body "$body" \
--head "$branch" \
--base main \
--json url --jq .url)

if [[ "${{ inputs.add_release_label }}" == "true" ]]; then
gh pr edit "$pr_url" --add-label release
fi
218 changes: 218 additions & 0 deletions .github/workflows/_release-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,218 @@
name: _Release package
on:
workflow_call:
inputs:
package:
required: true
type: string
bump_after_release:
required: false
type: boolean
default: false
ref:
required: false
type: string
default: ""
on_main:
required: false
type: boolean
default: false

permissions:
contents: read

jobs:
release:
environment: pypi
permissions:
contents: write
pull-requests: write
id-token: write
runs-on: ubuntu-latest
steps:
- name: Resolve release target
id: target
run: |
if [[ "${{ inputs.on_main }}" == "true" || "$GITHUB_REF_NAME" == "main" ]]; then
echo "on_main=true" >> "$GITHUB_OUTPUT"
elif [[ "$GITHUB_REF_NAME" == package-release/${{ inputs.package }}/v* ]]; then
echo "on_main=false" >> "$GITHUB_OUTPUT"
else
echo "Run on main or package-release/${{ inputs.package }}/v*"
exit 1
fi

- uses: actions/checkout@v4
with:
ref: ${{ inputs.ref != '' && inputs.ref || github.ref }}

- name: Set environment variables
run: |
version=$(./scripts/eachdist.py version --package ${{ inputs.package }})
if [[ $version =~ ^([0-9]+)\.([0-9]+)\.([0-9]+) ]]; then
major="${BASH_REMATCH[1]}"
minor="${BASH_REMATCH[2]}"
patch="${BASH_REMATCH[3]}"
if [[ $patch != 0 ]]; then
prior_version_when_patch="${major}.${minor}.$((patch - 1))"
fi
elif [[ $version =~ ^([0-9]+)\.([0-9]+)b([0-9]+)$ ]]; then
major="${BASH_REMATCH[1]}"
minor="${BASH_REMATCH[2]}"
patch="${BASH_REMATCH[3]}"
if [[ $patch != 0 ]]; then
prior_version_when_patch="${major}.${minor}b$((patch - 1))"
fi
else
echo "unexpected version: $version"
exit 1
fi

if [[ "${{ steps.target.outputs.on_main }}" == "true" && "$version" == *.dev ]]; then
echo "version on main still has a .dev suffix; merge the prepare PR first"
exit 1
fi

path=$(./scripts/eachdist.py find-package --package ${{ inputs.package }})
echo "CHANGELOG=./$path/CHANGELOG.md" >> $GITHUB_ENV
echo "PACKAGE_NAME=${{ inputs.package }}" >> $GITHUB_ENV
echo "VERSION=$version" >> $GITHUB_ENV
echo "RELEASE_TAG=${{ inputs.package }}==$version" >> $GITHUB_ENV
echo "PRIOR_VERSION_WHEN_PATCH=$prior_version_when_patch" >> $GITHUB_ENV
if [[ "${{ steps.target.outputs.on_main }}" == "true" ]]; then
echo "RELEASE_TARGET=main" >> $GITHUB_ENV
else
echo "RELEASE_TARGET=$GITHUB_REF_NAME" >> $GITHUB_ENV
fi

- name: Check that changelog update was merged to main
if: steps.target.outputs.on_main == 'true'
run: |
if [[ -z $PRIOR_VERSION_WHEN_PATCH ]]; then
if ! grep --quiet "^## Version ${VERSION}" ${CHANGELOG}; then
echo "The prepare-release PR needs to be merged first"
exit 1
fi
fi

- uses: actions/checkout@v4
if: steps.target.outputs.on_main != 'true'
with:
ref: main

- name: Check that changelog update was merged to main (backport branch)
if: steps.target.outputs.on_main != 'true'
run: |
if [[ -z $PRIOR_VERSION_WHEN_PATCH ]]; then
if ! grep --quiet "^## Version ${VERSION}" ${CHANGELOG}; then
echo "The prepare-release PR needs to be merged first"
exit 1
fi
fi

- uses: actions/checkout@v4
if: steps.target.outputs.on_main != 'true'
with:
ref: ${{ inputs.ref != '' && inputs.ref || github.ref }}

- uses: actions/setup-python@v5
with:
python-version: '3.10'

- name: Install uv
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0

- name: Build wheels
run: ./scripts/build_a_package.sh

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist/
skip-existing: true

- name: Generate release notes
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./scripts/generate_release_notes.sh

- name: Create GitHub release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create --target "$RELEASE_TARGET" \
--title "${PACKAGE_NAME} ${VERSION}" \
--notes-file /tmp/release-notes.txt \
"$RELEASE_TAG"

- uses: actions/checkout@v4
with:
ref: main

- name: Copy changelog updates to main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./scripts/merge_changelog_to_main.sh

- name: Use CLA approved github bot
run: .github/scripts/use-cla-approved-github-bot.sh

- uses: actions/create-github-app-token@df432ceedc7162793a195dd1713ff69aefc7379e # v2.0.6
id: otelbot-token
with:
app-id: ${{ vars.OTELBOT_APP_ID }}
private-key: ${{ secrets.OTELBOT_PRIVATE_KEY }}

- name: Open pull request for changelog updates on main
env:
GITHUB_TOKEN: ${{ steps.otelbot-token.outputs.token }}
run: |
message="Copy changelog updates for ${PACKAGE_NAME} v${VERSION}"
body="Copy changelog updates for \`${PACKAGE_NAME}\` v\`${VERSION}\`."
branch="otelbot/changelog-${PACKAGE_NAME}-${VERSION}"

changes=0
if [[ -z $PRIOR_VERSION_WHEN_PATCH ]]; then
if ! git diff --quiet; then
changes=1
fi
else
changes=1
fi

if [[ $changes == 0 ]]; then
echo "No changelog updates needed on main"
exit 0
fi

git commit -a -m "$message"
git push origin HEAD:"$branch"
gh pr create --title "$message" \
--body "$body" \
--head "$branch" \
--base main

- name: Bump package version on main after release
if: inputs.bump_after_release && steps.target.outputs.on_main == 'true'
env:
GITHUB_TOKEN: ${{ steps.otelbot-token.outputs.token }}
run: |
git checkout main
git pull origin main

./scripts/bump_package_dev_version.sh "${PACKAGE_NAME}"

if git diff --quiet; then
echo "No version bump needed"
exit 0
fi

message="Bump ${PACKAGE_NAME} to next dev version after v${VERSION}"
branch="otelbot/bump-${PACKAGE_NAME}-after-v${VERSION}"

git commit -a -m "$message"
git push origin HEAD:"$branch"
gh pr create --title "$message" \
--body "Bump \`${PACKAGE_NAME}\` to the next \`.dev\` version after releasing v\`${VERSION}\`." \
--head "$branch" \
--base main
Loading
Loading