Skip to content

Commit 730436e

Browse files
committed
ci: update otel components on cron
1 parent 7ed1f5d commit 730436e

File tree

2 files changed

+79
-3
lines changed

2 files changed

+79
-3
lines changed
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: 🔄 CI | Bump Component Versions
2+
3+
on:
4+
workflow_dispatch:
5+
schedule:
6+
# Scheduled to run every hour on every day-of-week from Monday through Friday.
7+
- cron: '0 * * * 1-5'
8+
9+
jobs:
10+
bump:
11+
name: Bump Component Versions
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v4
16+
with:
17+
fetch-depth: 0 # required for tag metadata
18+
19+
- name: Setup Go
20+
uses: actions/setup-go@v5
21+
with:
22+
go-version: '1.23'
23+
check-latest: true
24+
25+
- name: Tidy go.mod files
26+
run: go mod tidy
27+
28+
- name: Bump component versions
29+
id: bump_component_versions
30+
run: |
31+
output=$(./scripts/bump-component-versions.sh)
32+
echo "output=${output}" >> $GITHUB_OUTPUT
33+
# Check for unstaged changes
34+
if git diff --quiet; then
35+
echo "No unstaged changes found. Exiting."
36+
echo "has_changes=false" >> $GITHUB_OUTPUT
37+
else
38+
echo "Unstaged changes found. Continuing..."
39+
echo "has_changes=true" >> $GITHUB_OUTPUT
40+
fi
41+
42+
- name: Setup ENV
43+
if: steps.bump_component_versions.outputs.has_changes == 'true'
44+
env:
45+
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
46+
run: |
47+
gh_username=$(gh api user | jq -r '.login')
48+
output=$(echo "${{ steps.bump_component_versions.outputs.output }}")
49+
echo "gh_username=${gh_username}" >> $GITHUB_ENV
50+
next_beta_core=$(echo "${output}" | jq -r '.nextVersions.betaCoreVersion')
51+
current_beta_core=$(echo "${output}" | jq -r '.currentVersions.betaCoreVersion')
52+
echo "next_beta_core=${next_beta_core}" >> $GITHUB_ENV
53+
echo "current_beta_core=${current_beta_core}" >> $GITHUB_ENV
54+
echo "branch=otel-release/${next_beta_core}" >> $GITHUB_ENV
55+
56+
- name: Commit Component Version Bump
57+
if: steps.bump_component_versions.outputs.has_changes == 'true'
58+
env:
59+
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
60+
run: |
61+
git switch -c ${{ env.branch }}
62+
git config --global user.name '${{ env.gh_username }}'
63+
git config --global user.email '${{ env.gh_username }}@users.noreply.github.com'
64+
65+
git add --all
66+
git commit -m "feat: Bump otel component versions from ${{ env.current_beta_core }} to ${{ env.next_beta_core }}"
67+
git push origin ${{ env.branch }}
68+
69+
- name: Issue PR
70+
if: ${{ !env.ACT && steps.bump_component_versions.outputs.has_changes == 'true' }}
71+
env:
72+
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
73+
run: |
74+
gh pr create --title "Bump OTEL beta core to ${{ env.next_beta_core }}" \
75+
--body "Updates the version of the otel beta core from ${{ env.current_beta_core }} to ${{ env.next_beta_core }}." \
76+
--repo ${{ github.event.repository.name }} \
77+
--base main --head ${{ github.event.repository.name }}:${{ env.branch }}

scripts/bump-component-versions.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,8 @@ next_beta_core=${next_beta_core#v}
4545

4646
# If the current beta core version is not equal to the next beta core version, update the Makefile
4747
if [[ "$current_beta_core" != "$next_beta_core" ]]; then
48-
echo "Updating Makefile from $current_beta_core to $next_beta_core"
4948
# Update Makefile OCB version
5049
sed_inplace "s/OTELCOL_BUILDER_VERSION ?= $escaped_current_beta_core/OTELCOL_BUILDER_VERSION ?= $next_beta_core/" Makefile
51-
else
52-
echo "No update needed for the Makefile."
5350
fi
51+
52+
echo $OUTPUT

0 commit comments

Comments
 (0)