Skip to content

Commit eeb464a

Browse files
authored
Merge branch 'main' into fix-sqlalchemy-engine-from-config-monkeypatching
2 parents 8e0ba23 + 6a54106 commit eeb464a

File tree

36 files changed

+1214
-116
lines changed

36 files changed

+1214
-116
lines changed

Diff for: .github/workflows/package-prepare-patch-release.yml

+116
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
name: "[Package] Prepare patch release"
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
package:
6+
type: choice
7+
options:
8+
- opentelemetry-propagator-aws-xray
9+
- opentelemetry-resource-detector-azure
10+
- opentelemetry-sdk-extension-aws
11+
description: 'Package to be released'
12+
required: true
13+
jobs:
14+
prepare-patch-release:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Verify prerequisites
20+
run: |
21+
if [[ $GITHUB_REF_NAME != package-release/${{ inputs.package }}/v* ]]; then
22+
echo this workflow should only be run against package-release/${{ inputs.package }}* branches, but is running on $GITHUB_REF_NAME
23+
exit 1
24+
fi
25+
26+
path=./$(./scripts/eachdist.py find-package --package ${{ inputs.package }})
27+
changelog=$path/CHANGELOG.md
28+
29+
if [ ! -f $changelog ]; then
30+
echo "missing $changelog file"
31+
exit 1
32+
fi
33+
34+
if ! grep --quiet "^## Unreleased$" CHANGELOG.md; then
35+
echo the $changelog is missing an \"Unreleased\" section
36+
exit 1
37+
fi
38+
39+
version=$(./scripts/eachdist.py version --package ${{ inputs.package }})
40+
41+
version_file=$(find $path -type f -path "*version*.py")
42+
file_count=$(echo "$version_file" | wc -l)
43+
44+
if [ "$file_count" -ne 1 ]; then
45+
echo "Error: expected one version file, found $file_count"
46+
echo "$version_file"
47+
exit 1
48+
fi
49+
50+
if [[ $version =~ ^([0-9]+)\.([0-9]+)\.([0-9]+) ]]; then
51+
# 1.2.3 or 1.2.3rc1
52+
major="${BASH_REMATCH[1]}"
53+
minor="${BASH_REMATCH[2]}"
54+
patch="${BASH_REMATCH[3]}"
55+
next_version="$major.$minor.$((patch + 1))"
56+
release_branch_name="package-release/${{ inputs.package }}/v$major.$minor.x"
57+
elif [[ $version =~ ^([0-9]+)\.([0-9]+)b([0-9]+)$ ]]; then
58+
# 0.1b1
59+
major="${BASH_REMATCH[1]}"
60+
minor="${BASH_REMATCH[2]}"
61+
patch="${BASH_REMATCH[3]}"
62+
next_version="$major.${minor}b$((patch + 1))"
63+
release_branch_name="package-release/${{ inputs.package }}/v$major.${minor}bx"
64+
else
65+
echo "unexpected version: '$version'"
66+
exit 1
67+
fi
68+
69+
if [[ $GITHUB_REF_NAME != $release_branch_name ]]; then
70+
echo this workflow should only be run against $release_branch_name branch, but is running on $GITHUB_REF_NAME
71+
exit 1
72+
fi
73+
74+
echo "PACKAGE_NAME=${{ inputs.package }}" >> $GITHUB_ENV
75+
echo "VERSION=$version" >> $GITHUB_ENV
76+
echo "NEXT_VERSION=$next_version" >> $GITHUB_ENV
77+
echo "CHANGELOG=$changelog" >> $GITHUB_ENV
78+
echo "VERSION_FILE=$version_file" >> $GITHUB_ENV
79+
80+
- name: Update version
81+
run: |
82+
# replace the version in the version file (1.2.3 -> 1.2.4)
83+
sed -i -E "s/__version__\s*=\s*\"${VERSION}\"/__version__ = \"${NEXT_VERSION}\"/g" $VERSION_FILE
84+
85+
- name: Set up Python 3.9
86+
uses: actions/setup-python@v5
87+
with:
88+
python-version: 3.9
89+
- name: Install tox
90+
run: pip install tox
91+
- name: run tox
92+
run: tox -e generate
93+
94+
- name: Update the change log with the approximate release date
95+
run: |
96+
# the actual release date on main will be updated at the end of the release workflow
97+
date=$(date "+%Y-%m-%d")
98+
sed -Ei "s/^## Unreleased$/## Unreleased\n\n## Version ${NEXT_VERSION} ($date)/" ${CHANGELOG}
99+
100+
- name: Use CLA approved github bot
101+
run: .github/scripts/use-cla-approved-github-bot.sh
102+
103+
- name: Create pull request
104+
env:
105+
# not using secrets.GITHUB_TOKEN since pull requests from that token do not run workflows
106+
GITHUB_TOKEN: ${{ secrets.OPENTELEMETRYBOT_GITHUB_TOKEN }}
107+
run: |
108+
message="Prepare patch release for ${PACKAGE_NAME} v${NEXT_VERSION}"
109+
branch="opentelemetrybot/patch-${PACKAGE_NAME}-version-to-v${NEXT_VERSION}"
110+
111+
git commit -a -m "$message"
112+
git push origin HEAD:$branch
113+
gh pr create --title "[$GITHUB_REF_NAME] $message" \
114+
--body "$message." \
115+
--head $branch \
116+
--base $GITHUB_REF_NAME

Diff for: .github/workflows/package-prepare-release.yml

+194
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,194 @@
1+
name: "[Package] Prepare release"
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
package:
6+
type: choice
7+
options:
8+
- opentelemetry-propagator-aws-xray
9+
- opentelemetry-resource-detector-azure
10+
- opentelemetry-sdk-extension-aws
11+
description: 'Package to be released'
12+
required: true
13+
14+
jobs:
15+
prereqs:
16+
runs-on: ubuntu-latest
17+
outputs:
18+
version: ${{ steps.verify.outputs.version }}
19+
changelog: ${{ steps.verify.outputs.changelog }}
20+
version_file: ${{ steps.verify.outputs.version_file }}
21+
release_branch_name: ${{ steps.verify.outputs.release_branch_name }}
22+
next_version: ${{ steps.verify.outputs.next_version }}
23+
steps:
24+
- uses: actions/checkout@v4
25+
26+
- id: verify
27+
name: Verify prerequisites
28+
run: |
29+
if [[ $GITHUB_REF_NAME != main ]]; then
30+
echo this workflow should only be run against main
31+
exit 1
32+
fi
33+
34+
path=./$(./scripts/eachdist.py find-package --package ${{ inputs.package }})
35+
changelog=$path/CHANGELOG.md
36+
37+
if [ ! -f $changelog ]; then
38+
echo "missing $changelog file"
39+
exit 1
40+
fi
41+
42+
if ! grep --quiet "^## Unreleased$" $changelog; then
43+
echo the $changelog is missing an \"Unreleased\" section
44+
exit 1
45+
fi
46+
47+
version_dev=$(./scripts/eachdist.py version --package ${{ inputs.package }})
48+
49+
if [[ ! $version_dev =~ ^([0-9]+)\.([0-9]+)[\.|b]{1}([0-9]+).*.dev$ ]]; then
50+
echo "unexpected version: $version"
51+
exit 1
52+
fi
53+
54+
version=${version_dev%.dev}
55+
56+
version_file=$(find $path -type f -path "*version*.py")
57+
file_count=$(echo "$version_file" | wc -l)
58+
59+
if [ "$file_count" -ne 1 ]; then
60+
echo "Error: expected one version file, found $file_count"
61+
echo "$version_file"
62+
exit 1
63+
fi
64+
65+
if [[ $version =~ ^([0-9]+)\.([0-9]+)\.([0-9]+) ]]; then
66+
# 1.2.3 or 1.2.3rc1
67+
major="${BASH_REMATCH[1]}"
68+
minor="${BASH_REMATCH[2]}"
69+
release_branch_name="package-release/${{ inputs.package }}/v$major.$minor.x"
70+
next_version="$major.$((minor + 1)).0"
71+
elif [[ $version =~ ^([0-9]+)\.([0-9]+)b([0-9]+)$ ]]; then
72+
# 0.1b1
73+
major="${BASH_REMATCH[1]}"
74+
minor="${BASH_REMATCH[2]}"
75+
release_branch_name="package-release/${{ inputs.package }}/v$major.${minor}bx"
76+
next_version="$major.$((minor + 1))b0"
77+
else
78+
echo "unexpected version: '$version'"
79+
exit 1
80+
fi
81+
82+
echo "version=$version" >> $GITHUB_OUTPUT
83+
echo "changelog=$changelog" >> $GITHUB_OUTPUT
84+
echo "version_file=$version_file" >> $GITHUB_OUTPUT
85+
echo "release_branch_name=$release_branch_name" >> $GITHUB_OUTPUT
86+
echo "next_version=$next_version" >> $GITHUB_OUTPUT
87+
88+
create-pull-request-against-release-branch:
89+
runs-on: ubuntu-latest
90+
needs: prereqs
91+
steps:
92+
- uses: actions/checkout@v4
93+
94+
- name: Set environment variables
95+
run: |
96+
echo "RELEASE_BRANCH_NAME=${{ needs.prereqs.outputs.release_branch_name }}" >> $GITHUB_ENV
97+
echo "VERSION=${{ needs.prereqs.outputs.version }}" >> $GITHUB_ENV
98+
echo "CHANGELOG=${{ needs.prereqs.outputs.changelog }}" >> $GITHUB_ENV
99+
echo "VERSION_FILE=${{ needs.prereqs.outputs.version_file }}" >> $GITHUB_ENV
100+
echo "PACKAGE_NAME=${{ github.event.inputs.package }}" >> $GITHUB_ENV
101+
102+
- name: Create package release branch
103+
run: |
104+
git push origin HEAD:$RELEASE_BRANCH_NAME
105+
106+
- name: Update package version
107+
run: |
108+
# replace the version in the version file (1.2.3dev -> 1.2.3)
109+
sed -i -E "s/__version__\s*=\s*\"${VERSION}\.dev\"/__version__ = \"${VERSION}\"/g" $VERSION_FILE
110+
111+
- name: Set up Python 3.9
112+
uses: actions/setup-python@v5
113+
with:
114+
python-version: 3.9
115+
- name: Install tox
116+
run: pip install tox
117+
- name: run tox
118+
run: tox -e generate
119+
120+
- name: Update the change log with the approximate release date
121+
run: |
122+
date=$(date "+%Y-%m-%d")
123+
sed -Ei "s/^## Unreleased$/## Version ${VERSION} ($date)/" ${CHANGELOG}
124+
125+
- name: Use CLA approved github bot
126+
run: .github/scripts/use-cla-approved-github-bot.sh
127+
128+
- name: Create pull request against the release branch
129+
env:
130+
# not using secrets.GITHUB_TOKEN since pull requests from that token do not run workflows
131+
GITHUB_TOKEN: ${{ secrets.OPENTELEMETRYBOT_GITHUB_TOKEN }}
132+
run: |
133+
message="Prepare release for ${PACKAGE_NAME} v${VERSION}"
134+
branch="opentelemetrybot/prepare-${RELEASE_BRANCH_NAME}"
135+
136+
git commit -a -m "$message"
137+
git push origin HEAD:$branch
138+
gh pr create --title "[$RELEASE_BRANCH_NAME] $message" \
139+
--body "$message." \
140+
--head $branch \
141+
--base $RELEASE_BRANCH_NAME
142+
143+
create-pull-request-against-main:
144+
runs-on: ubuntu-latest
145+
needs: prereqs
146+
steps:
147+
- uses: actions/checkout@v4
148+
149+
- name: Set environment variables
150+
run: |
151+
echo "PACKAGE_NAME=${{ github.event.inputs.package }}" >> $GITHUB_ENV
152+
echo "VERSION=${{ needs.prereqs.outputs.version }}" >> $GITHUB_ENV
153+
echo "VERSION_FILE=${{ needs.prereqs.outputs.version_file }}" >> $GITHUB_ENV
154+
echo "NEXT_VERSION=${{ needs.prereqs.outputs.next_version }}" >> $GITHUB_ENV
155+
echo "CHANGELOG=${{ needs.prereqs.outputs.changelog }}" >> $GITHUB_ENV
156+
157+
- name: Update version
158+
run: |
159+
# replace the version in the version file (1.2.3dev -> 1.3.3.dev)
160+
sed -i -E "s/__version__\s*=\s*\"${VERSION}\.dev\"/__version__ = \"${NEXT_VERSION}.dev\"/g" $VERSION_FILE
161+
162+
- name: Set up Python 3.9
163+
uses: actions/setup-python@v5
164+
with:
165+
python-version: 3.9
166+
- name: Install tox
167+
run: pip install tox
168+
- name: run tox
169+
run: tox -e generate
170+
171+
- name: Update the change log on main
172+
run: |
173+
# the actual release date on main will be updated at the end of the release workflow
174+
date=$(date "+%Y-%m-%d")
175+
sed -Ei "s/^## Unreleased$/## Unreleased\n\n## Version ${VERSION} ($date)/" ${CHANGELOG}
176+
177+
- name: Use CLA approved github bot
178+
run: .github/scripts/use-cla-approved-github-bot.sh
179+
180+
- name: Create pull request against main
181+
env:
182+
# not using secrets.GITHUB_TOKEN since pull requests from that token do not run workflows
183+
GITHUB_TOKEN: ${{ secrets.OPENTELEMETRYBOT_GITHUB_TOKEN }}
184+
run: |
185+
message="Update ${PACKAGE_NAME} version to v${NEXT_VERSION}"
186+
body="Update \`${PACKAGE_NAME}\` version to v\`${NEXT_VERSION}\`."
187+
branch="opentelemetrybot/update-${PACKAGE_NAME}-version-to-v${NEXT_VERSION}"
188+
189+
git commit -a -m "$message"
190+
git push origin HEAD:$branch
191+
gh pr create --title "$message" \
192+
--body "$body" \
193+
--head $branch \
194+
--base main

0 commit comments

Comments
 (0)