diff --git a/.github/workflows/post-release-bump.yml b/.github/workflows/post-release-bump.yml new file mode 100644 index 0000000000..0a8a3fcdef --- /dev/null +++ b/.github/workflows/post-release-bump.yml @@ -0,0 +1,49 @@ +name: Post-Release Version Bump + +on: + push: + tags: + - 'v*.*.*' + +jobs: + bump-version: + runs-on: ubuntu-latest + steps: + - name: Checkout main branch + uses: actions/checkout@v4 + with: + ref: main + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract release version and decide bump type + run: | + TAG_VERSION="${GITHUB_REF#refs/tags/v}" + echo "TAG_VERSION=$TAG_VERSION" >> $GITHUB_ENV + MAJOR=$(echo "$TAG_VERSION" | cut -d. -f1) + MINOR=$(echo "$TAG_VERSION" | cut -d. -f2) + PATCH=$(echo "$TAG_VERSION" | cut -d. -f3) + + # Always bump minor version and reset patch + NEW_MAJOR=$MAJOR + NEW_MINOR=$((MINOR + 1)) + NEW_PATCH=0 + + echo "NEW_MAJOR=$NEW_MAJOR" >> $GITHUB_ENV + echo "NEW_MINOR=$NEW_MINOR" >> $GITHUB_ENV + echo "NEW_PATCH=$NEW_PATCH" >> $GITHUB_ENV + + - name: Update version.h to DEV version + run: | + FILE_PATH="include/opentelemetry/version.h" + sed -i "s|#define OPENTELEMETRY_VERSION \".*\"|#define OPENTELEMETRY_VERSION \"${NEW_MAJOR}.${NEW_MINOR}.${NEW_PATCH}-DEV\"|" "$FILE_PATH" + sed -i "s|#define OPENTELEMETRY_VERSION_MAJOR .*|#define OPENTELEMETRY_VERSION_MAJOR ${NEW_MAJOR}|" "$FILE_PATH" + sed -i "s|#define OPENTELEMETRY_VERSION_MINOR .*|#define OPENTELEMETRY_VERSION_MINOR ${NEW_MINOR}|" "$FILE_PATH" + sed -i "s|#define OPENTELEMETRY_VERSION_PATCH .*|#define OPENTELEMETRY_VERSION_PATCH ${NEW_PATCH}|" "$FILE_PATH" + + - name: Commit and push changes + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git add include/opentelemetry/version.h + git commit -m "Bump version to ${NEW_MAJOR}.${NEW_MINOR}.${NEW_PATCH}-DEV after release" || echo "No changes to commit" + git push origin main diff --git a/.github/workflows/pre-release.yml b/.github/workflows/pre-release.yml new file mode 100644 index 0000000000..a9028296e4 --- /dev/null +++ b/.github/workflows/pre-release.yml @@ -0,0 +1,54 @@ +name: Pre-Release Preparation + +on: + workflow_dispatch: + inputs: + version: + description: 'Release version (e.g. 1.23.0)' + required: true + type: string + +jobs: + prepare-release: + runs-on: ubuntu-latest + steps: + - name: Checkout main branch + uses: actions/checkout@v4 + with: + ref: main + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Validate current version contains -DEV + run: | + FILE_PATH="api/include/opentelemetry/version.h" + if ! grep -q -- "-DEV" "$FILE_PATH"; then + echo "Error: version.h does not contain -DEV. Aborting to prevent overwriting a release." + exit 1 + fi + + - name: Remove -DEV from version.h + run: | + FILE_PATH="api/include/opentelemetry/version.h" + VERSION="${{ github.event.inputs.version }}" + + MAJOR=$(echo "$VERSION" | cut -d. -f1) + MINOR=$(echo "$VERSION" | cut -d. -f2) + PATCH=$(echo "$VERSION" | cut -d. -f3) + + sed -i "s|#define OPENTELEMETRY_VERSION \".*\"|#define OPENTELEMETRY_VERSION \"${VERSION}\"|" "$FILE_PATH" + sed -i "s|#define OPENTELEMETRY_VERSION_MAJOR .*|#define OPENTELEMETRY_VERSION_MAJOR ${MAJOR}|" "$FILE_PATH" + sed -i "s|#define OPENTELEMETRY_VERSION_MINOR .*|#define OPENTELEMETRY_VERSION_MINOR ${MINOR}|" "$FILE_PATH" + sed -i "s|#define OPENTELEMETRY_VERSION_PATCH .*|#define OPENTELEMETRY_VERSION_PATCH ${PATCH}|" "$FILE_PATH" + + - name: Commit clean release version + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git add api/include/opentelemetry/version.h + git commit -m "Prepare release ${{ github.event.inputs.version }}" || echo "No changes to commit" + git push origin main + + - name: Create and push tag + run: | + git tag -a "v${{ github.event.inputs.version }}" -m "Release v${{ github.event.inputs.version }}" + git push origin "v${{ github.event.inputs.version }}" diff --git a/api/include/opentelemetry/version.h b/api/include/opentelemetry/version.h index ab69ca02f2..63b296498b 100644 --- a/api/include/opentelemetry/version.h +++ b/api/include/opentelemetry/version.h @@ -10,9 +10,12 @@ # define OPENTELEMETRY_ABI_VERSION_NO 1 #endif -#define OPENTELEMETRY_VERSION "1.22.0" +// Development version after 1.23.0 release +#define OPENTELEMETRY_VERSION "1.24.0-DEV" +#define OPENTELEMETRY_VERSION_DEV "1.24.0-DEV" + #define OPENTELEMETRY_VERSION_MAJOR 1 -#define OPENTELEMETRY_VERSION_MINOR 22 +#define OPENTELEMETRY_VERSION_MINOR 24 #define OPENTELEMETRY_VERSION_PATCH 0 #define OPENTELEMETRY_ABI_VERSION OPENTELEMETRY_STRINGIFY(OPENTELEMETRY_ABI_VERSION_NO) @@ -25,5 +28,4 @@ }} #define OPENTELEMETRY_NAMESPACE opentelemetry :: OPENTELEMETRY_CONCAT(v, OPENTELEMETRY_ABI_VERSION_NO) - // clang-format on