Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
97 changes: 76 additions & 21 deletions .github/workflows/release-project-in-dir.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,31 @@ on:
version_branch:
type: string
required: true
release_tag:
type: string
required: true

env:
# set the target pom to use the input directory as root
# set the target pom to use the input directory as root
MAVEN_ARGS: -V -ntp -e -f ${{ inputs.project_dir }}/pom.xml

jobs:
publish:
runs-on: ubuntu-latest
outputs:
release_sha: ${{ steps.resolve-sha.outputs.commit }}
steps:
- name: Checkout "${{inputs.version_branch}}" branch
uses: actions/checkout@v7
- name: Checkout "${{ inputs.version_branch }}" branch
uses: actions/checkout@v4

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this is a mistake, v7 should be the version we want to use

@csviri csviri Sep 4, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Lavanya-N24 I still see the v4 here and other places

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Lavanya-N24 these checkout action and other action versions are still wrong, should not be changed

with:
ref: "${{inputs.version_branch}}"
ref: "${{ inputs.version_branch }}"

- name: Resolve checked-out commit
id: resolve-sha
run: echo "commit=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"

- name: Set up Java and Maven
uses: actions/setup-java@v6

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here this version should not be changed

uses: actions/setup-java@v4
with:
java-version: 17
distribution: temurin
Expand All @@ -36,11 +45,11 @@ jobs:
gpg-passphrase: MAVEN_GPG_PASSPHRASE

- name: Change version to release version
# Assume that RELEASE_VERSION will have form like: "v1.0.1". So we cut the "v"
run: |
./mvnw ${MAVEN_ARGS} versions:set -DnewVersion="${RELEASE_VERSION:1}" versions:commit -DprocessAllModules
env:
RELEASE_VERSION: ${{ github.event.release.tag_name }}
RELEASE_TAG: ${{ inputs.release_tag }}
run: |
RELEASE_VERSION="${RELEASE_TAG#v}"
./mvnw ${MAVEN_ARGS} versions:set -DnewVersion="${RELEASE_VERSION}" versions:commit -DprocessAllModules
Comment on lines +49 to +52

- name: Publish to Apache Maven Central
run: ./mvnw package deploy -Prelease
Expand All @@ -49,19 +58,67 @@ jobs:
MAVEN_CENTRAL_TOKEN: ${{ secrets.NEXUS_PASSWORD }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}

# This is separate job because there were issues with git after release step, was not able to commit changes.
update-working-version:
finalize-release:
runs-on: ubuntu-latest
needs: publish
if: "!contains(github.event.release.tag_name, 'RC')" # not sure we should keep this the RC part
permissions:
contents: write
steps:
- name: Checkout exact published commit
uses: actions/checkout@v4
with:
ref: "${{ needs.publish.outputs.release_sha }}"
fetch-depth: 0

- name: Set up Java and Maven
uses: actions/setup-java@v4
with:
java-version: 17
distribution: temurin
cache: 'maven'

- name: Change version to release version
env:
RELEASE_TAG: ${{ inputs.release_tag }}
run: |
RELEASE_VERSION="${RELEASE_TAG#v}"
./mvnw ${MAVEN_ARGS} versions:set -DnewVersion="${RELEASE_VERSION}" versions:commit -DprocessAllModules
Comment on lines +80 to +85

- name: Commit and push release version

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we have these 2 steps after maven release? that way if maven release fails, and we can easily retry.

env:
TARGET_BRANCH: ${{ inputs.version_branch }}
RELEASE_TAG: ${{ inputs.release_tag }}
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
if git diff --quiet; then
echo "No version changes to commit."
else
git commit -am "Release ${RELEASE_TAG}"
git push origin HEAD:"${TARGET_BRANCH}"
fi
Comment on lines +87 to +99

- name: Override release tag to point to release commit
env:
RELEASE_TAG: ${{ inputs.release_tag }}
run: |
git tag -f -a "${RELEASE_TAG}" -m "Release ${RELEASE_TAG}"
git push -f origin "refs/tags/${RELEASE_TAG}"
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Comment on lines +101 to +106
Comment thread
Lavanya-N24 marked this conversation as resolved.

update-working-version:
runs-on: ubuntu-latest
needs: finalize-release
permissions:
contents: write
Comment thread
Lavanya-N24 marked this conversation as resolved.
if: "!contains(inputs.release_tag, 'RC')"
steps:
- name: Checkout "${{inputs.version_branch}}" branch
uses: actions/checkout@v7
- name: Checkout "${{ inputs.version_branch }}" branch
uses: actions/checkout@v4
with:
ref: "${{inputs.version_branch}}"
ref: "${{ inputs.version_branch }}"

- name: Set up Java and Maven
uses: actions/setup-java@v6
uses: actions/setup-java@v4
with:
java-version: 17
distribution: temurin
Expand All @@ -73,11 +130,9 @@ jobs:
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git commit -m "Set new SNAPSHOT version into pom files." -a
env:
RELEASE_VERSION: ${{ github.event.release.tag_name }}

- name: Push changes to branch
uses: ad-m/github-push-action@master
uses: ad-m/github-push-action@881a6320fdb16eb5318c5054f31c218aec2b324c # v0.8.0
with:
branch: "${{inputs.version_branch}}"
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: "${{ inputs.version_branch }}"
github_token: ${{ secrets.GITHUB_TOKEN }}
12 changes: 9 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ jobs:
timeout-minutes: 10
env:
tmp_version_branch: ''
RAW_TAG: ${{ github.event.release.tag_name }}
outputs:
version_branch: ${{ steps.set-version-branch.outputs.version_branch }}
release_tag: ${{ steps.set-release-tag.outputs.release_tag }}
steps:
- if: ${{ startsWith(github.event.release.tag_name, 'v1.' ) }}
run: |
Expand Down Expand Up @@ -98,7 +100,10 @@ jobs:
exit 1
- id: set-version-branch
name: Set version_branch if matched
run: echo "version_branch=${{env.tmp_version_branch}}" >> $GITHUB_OUTPUT
run: echo "version_branch=${{ env.tmp_version_branch }}" >> "$GITHUB_OUTPUT"
- id: set-release-tag
name: Pass release tag
run: echo "release_tag=${RAW_TAG}" >> "$GITHUB_OUTPUT"
Comment on lines +103 to +106

release-sdk:
needs: prepare-release
Expand All @@ -108,5 +113,6 @@ jobs:
uses: ./.github/workflows/release-project-in-dir.yml
secrets: inherit
with:
version_branch: ${{needs.prepare-release.outputs.version_branch}}
project_dir: '.'
version_branch: ${{ needs.prepare-release.outputs.version_branch }}
release_tag: ${{ needs.prepare-release.outputs.release_tag }}
Comment thread
Lavanya-N24 marked this conversation as resolved.
Comment thread
Lavanya-N24 marked this conversation as resolved.
Comment thread
Lavanya-N24 marked this conversation as resolved.
project_dir: '.'
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Loading