Still fixing prepare release workflow
ADD
.github/scripts/update-examples.sh
+#!/bin/bash
+
+# Updates versions in these files
+# - examples/distro/build.gradle
+# - examples/extension/build.gradle
+
+version=$1
+
+if [[ $version == *-SNAPSHOT ]]; then
+ alpha_version=${version//-SNAPSHOT/-alpha-SNAPSHOT}
+else
+ alpha_version=$version-alpha
+fi
+
+
+sed -ri "s/(opentelemetryJavaagent *: )\"[^\"]*\"/\1\"$version\"/" examples/distro/build.gradle
+sed -ri "s/(opentelemetryJavaagentAlpha *: )\"[^\"]*\"/\1\"$alpha_version\"/" examples/distro/build.gradle
+
+sed -ri "s/(opentelemetryJavaagent *: )\"[^\"]*\"/\1\"$version\"/" examples/extension/build.gradle
+sed -ri "s/(opentelemetryJavaagentAlpha *: )\"[^\"]*\"/\1\"$alpha_version\"/" examples/extension/build.gradle
+
+sed -ri "s/(io.opentelemetry.instrumentation.muzzle-generation\" version )\"[^\"]*\"/\1\"$alpha_version\"/" examples/extension/build.gradle
+sed -ri "s/(io.opentelemetry.instrumentation.muzzle-check\" version )\"[^\"]*\"/\1\"$alpha_version\"/" examples/extension/build.gradle

DELETE
.github/scripts/update-version.sh
-#!/bin/bash
-
-# Bumps versions in these files
-# - version.gradle.kts
-# - examples/distro/build.gradle
-# - examples/extension/build.gradle
-
-new_version=$1
-new_alpha_version=$2
-
-if [[ $new_version == *-SNAPSHOT ]]; then
- sed -ri "s/val snapshot = .*/val snapshot = true/" version.gradle.kts
-else
- sed -ri "s/val snapshot = .*/val snapshot = false/" version.gradle.kts
-fi
-
-sed -ri "s/[0-9]*\.[0-9]*\.[0-9]*/$new_version/" version.gradle.kts
-
-sed -ri "s/(opentelemetryJavaagent *: )\"[^\"]*\"/\1\"$new_version\"/" examples/distro/build.gradle
-sed -ri "s/(opentelemetryJavaagentAlpha *: )\"[^\"]*\"/\1\"$new_alpha_version\"/" examples/distro/build.gradle
-
-sed -ri "s/(opentelemetryJavaagent *: )\"[^\"]*\"/\1\"$new_version\"/" examples/extension/build.gradle
-sed -ri "s/(opentelemetryJavaagentAlpha *: )\"[^\"]*\"/\1\"$new_alpha_version\"/" examples/extension/build.gradle
-
-sed -ri "s/(io.opentelemetry.instrumentation.muzzle-generation\" version )\"[^\"]*\"/\1\"$new_alpha_version\"/" examples/extension/build.gradle
-sed -ri "s/(io.opentelemetry.instrumentation.muzzle-check\" version )\"[^\"]*\"/\1\"$new_alpha_version\"/" examples/extension/build.gradle

MODIFY
.github/workflows/prepare-patch-release.yml
.github/workflows/prepare-patch-release.yml
@@ -20,11 +20,13 @@ jobs:
fi
echo "VERSION=$major_minor.$((patch + 1))" >> $GITHUB_ENV
- - name: Bump version
+ - name: Update version
run: |
- .github/scripts/update-version.sh "$VERSION" "$VERSION-alpha"
+ sed -ri "s/[0-9]+\.[0-9]+\.[0-9]+/$VERSION/" version.gradle.kts
- - name: Bump download link version
+ .github/scripts/update-examples.sh "$VERSION"
+
+ - name: Update download link version
run: |
sed -Ei "s,https://github\.com/open-telemetry/opentelemetry-java-instrumentation/releases/download/v[0-9]+\.[0-9]+\.[0-9]+/,https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/download/v$VERSION/," README.md

MODIFY
.github/workflows/prepare-release-branch.yml
.github/workflows/prepare-release-branch.yml
@@ -19,12 +19,14 @@ jobs:
echo "VERSION=$version" >> $GITHUB_ENV
echo "RELEASE_BRANCH_NAME=$release_branch_name" >> $GITHUB_ENV
- - name: Drop snapshot from version
+ - name: Update version
run: |
+ sed -ri "s/val snapshot = true/val snapshot = false/" version.gradle.kts
+
version=$(grep -Eo "[0-9]+.[0-9]+.0" version.gradle.kts)
- .github/scripts/update-version.sh "$version" "$version-alpha"
+ .github/scripts/update-examples.sh "$version"
- - name: Bump download link version
+ - name: Update download link version
run: |
version=$(grep -Eo "[0-9]+.[0-9]+.0" version.gradle.kts)
sed -Ei "s,https://github\.com/open-telemetry/opentelemetry-java-instrumentation/releases/latest/download/,https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/download/v$version/," README.md
@@ -51,7 +53,7 @@ jobs:
steps:
- uses: actions/checkout@v3
- - name: Bump snapshot version
+ - name: Update version
run: |
version=$(grep -Eo "[0-9]+.[0-9]+.0" version.gradle.kts)
if [[ $version =~ ([0-9]+).([0-9]+).0 ]]; then
@@ -62,7 +64,9 @@ jobs:
exit 1
fi
next_version="$major.$((minor + 1)).0"
- .github/scripts/update-version.sh "$next_version-SNAPSHOT" "$next_version-alpha-SNAPSHOT"
+ sed -ri "s/[0-9]+\.[0-9]+\.[0-9]+/$next_version/" version.gradle.kts
+
+ .github/scripts/update-examples.sh "$next_version-SNAPSHOT"
- name: Set git user
run: |
@@ -73,10 +77,10 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
- msg="Bump version"
+ msg="Update version"
git commit -a -m "$msg"
- git push origin HEAD:bump-snapshot-version
+ git push origin HEAD:update-version-on-main
gh pr create --title "$msg" \
--body "$msg" \
- --head bump-snapshot-version \
+ --head update-version-on-main \
--base main

MODIFY
.github/workflows/release.yml
.github/workflows/release.yml
@@ -182,7 +182,7 @@ jobs:
git fetch upstream
git checkout -b update-opentelemetry-javaagent-to-$VERSION upstream/main
- - name: Bump version
+ - name: Update version
run: |
echo $VERSION > autoinstrumentation/java/version.txt

Still fixing prepare release workflow (#5868)