Skip to content

Commit 5c49154

Browse files
authored
Switch to otelbot app (#206)
* Switch to otelbot app * streamline release also
1 parent c80e6fe commit 5c49154

File tree

5 files changed

+103
-81
lines changed

5 files changed

+103
-81
lines changed

.github/scripts/generate-release-contributors.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ echo $contributors1 $contributors2 \
8484
| sort -uf \
8585
| grep -v linux-foundation-easycla \
8686
| grep -v github-actions \
87-
| grep -v dependabot \
87+
| grep -v renovate \
88+
| grep -v otelbot \
8889
| grep -v codecov \
89-
| grep -v opentelemetrybot \
9090
| sed 's/^/@/'
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/bin/bash -e
22

3-
git config user.name opentelemetrybot
4-
git config user.email 107717825+opentelemetrybot@users.noreply.github.com
3+
git config user.name otelbot
4+
git config user.email 197425009+otelbot@users.noreply.github.com

.github/workflows/generate-post-release-pr.yml

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

.github/workflows/prepare-release-branch.yml

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,19 @@ jobs:
6363
- name: Use CLA approved github bot
6464
run: .github/scripts/use-cla-approved-github-bot.sh
6565

66+
- uses: actions/create-github-app-token@3ff1caaa28b64c9cc276ce0a02e2ff584f3900c5 # v2.0.2
67+
id: otelbot-token
68+
with:
69+
app-id: ${{ vars.OTELBOT_APP_ID }}
70+
private-key: ${{ secrets.OTELBOT_PRIVATE_KEY }}
71+
6672
- name: Create pull request against the release branch
6773
env:
6874
# not using secrets.GITHUB_TOKEN since pull requests from that token do not run workflows
69-
GH_TOKEN: ${{ secrets.OPENTELEMETRYBOT_GITHUB_TOKEN }}
75+
GH_TOKEN: ${{ steps.otelbot-token.outputs.token }}
7076
run: |
7177
message="Prepare release $VERSION"
72-
branch="opentelemetrybot/prepare-release-${VERSION}"
78+
branch="otelbot/prepare-release-${VERSION}"
7379
7480
git checkout -b $branch
7581
git commit -a -m "$message"
@@ -105,14 +111,20 @@ jobs:
105111
- name: Use CLA approved github bot
106112
run: .github/scripts/use-cla-approved-github-bot.sh
107113

114+
- uses: actions/create-github-app-token@3ff1caaa28b64c9cc276ce0a02e2ff584f3900c5 # v2.0.2
115+
id: otelbot-token
116+
with:
117+
app-id: ${{ vars.OTELBOT_APP_ID }}
118+
private-key: ${{ secrets.OTELBOT_PRIVATE_KEY }}
119+
108120
- name: Create pull request against main
109121
env:
110122
# not using secrets.GITHUB_TOKEN since pull requests from that token do not run workflows
111-
GH_TOKEN: ${{ secrets.OPENTELEMETRYBOT_GITHUB_TOKEN }}
123+
GH_TOKEN: ${{ steps.otelbot-token.outputs.token }}
112124
run: |
113125
message="Update changelog for $VERSION release"
114126
body="Update changelog for \`$VERSION\` release."
115-
branch="opentelemetrybot/update-version-to-${VERSION}"
127+
branch="otelbot/update-version-to-${VERSION}"
116128
117129
git checkout -b $branch
118130
git commit -a -m "$message"

.github/workflows/release.yml

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ jobs:
1212
runs-on: ubuntu-latest
1313
outputs:
1414
version: ${{ steps.create-github-release.outputs.version }}
15+
prior-version: ${{ steps.create-github-release.outputs.prior-version }}
1516
steps:
1617
- run: |
1718
if [[ $GITHUB_REF_NAME != release/* ]]; then
@@ -114,4 +115,86 @@ jobs:
114115
--notes-file /tmp/release-notes.txt \
115116
v$VERSION
116117
118+
# these are used as job outputs
117119
echo "version=$VERSION" >> $GITHUB_OUTPUT
120+
echo "prior-version=$PRIOR_VERSION" >> $GITHUB_OUTPUT
121+
122+
update-apidiff-baseline-to-released-version:
123+
permissions:
124+
contents: write # for git push to PR branch
125+
runs-on: ubuntu-latest
126+
needs:
127+
- release
128+
steps:
129+
# add change log sync (if any) into this PR since the apidiff update
130+
# is required before any other PR can be merged anyway
131+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
132+
133+
- name: Copy change log section from release branch
134+
env:
135+
VERSION: ${{ needs.release.outputs.version }}
136+
run: |
137+
sed -n "0,/^## Version $VERSION /d;/^## Version /q;p" CHANGELOG.md \
138+
> /tmp/changelog-section.md
139+
140+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
141+
with:
142+
ref: main
143+
144+
- name: Merge change log to main
145+
env:
146+
VERSION: ${{ needs.release.outputs.version }}
147+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
148+
run: |
149+
release_date=$(gh release view v$VERSION --json publishedAt --jq .publishedAt | sed 's/T.*//')
150+
RELEASE_DATE=$release_date .github/scripts/merge-change-log-after-release.sh
151+
git add CHANGELOG.md
152+
153+
- name: Wait for release to be available in maven central
154+
env:
155+
VERSION: ${{ needs.release.outputs.version }}
156+
run: |
157+
until curl --silent \
158+
--show-error \
159+
--output /dev/null \
160+
--head \
161+
--fail \
162+
https://repo1.maven.org/maven2/io/opentelemetry/semconv/opentelemetry-semconv/$VERSION/opentelemetry-semconv-$VERSION.jar
163+
do
164+
sleep 60
165+
done
166+
167+
- name: Update apidiff baseline
168+
env:
169+
VERSION: ${{ needs.release.outputs.version }}
170+
PRIOR_VERSION: ${{ needs.release.outputs.prior-version }}
171+
run: |
172+
./gradlew japicmp -PapiBaseVersion=$PRIOR_VERSION -PapiNewVersion=$VERSION
173+
./gradlew --refresh-dependencies japicmp
174+
git add docs/apidiffs
175+
176+
- name: Use CLA approved bot
177+
run: .github/scripts/use-cla-approved-bot.sh
178+
179+
- uses: actions/create-github-app-token@21cfef2b496dd8ef5b904c159339626a10ad380e # v1.11.6
180+
id: otelbot-token
181+
with:
182+
app-id: ${{ vars.OTELBOT_APP_ID }}
183+
private-key: ${{ secrets.OTELBOT_PRIVATE_KEY }}
184+
185+
- name: Create pull request against main
186+
env:
187+
VERSION: ${{ needs.release.outputs.version }}
188+
# not using secrets.GITHUB_TOKEN since pull requests from that token do not run workflows
189+
GH_TOKEN: ${{ steps.otelbot-token.outputs.token }}
190+
run: |
191+
message="Update apidiff baseline to released version $VERSION"
192+
body="Update apidiff baseline to released version \`$VERSION\`."
193+
branch="otelbot/update-apidiff-baseline-to-released-version-${VERSION}"
194+
195+
git checkout -b $branch
196+
git commit -m "$message"
197+
git push --set-upstream origin $branch
198+
gh pr create --title "$message" \
199+
--body "$body" \
200+
--base main

0 commit comments

Comments
 (0)