Skip to content

Commit

Permalink
Improved release automation.
Browse files Browse the repository at this point in the history
  • Loading branch information
valdar committed Feb 7, 2025
1 parent d5cb630 commit 363f6e3
Showing 1 changed file with 36 additions and 10 deletions.
46 changes: 36 additions & 10 deletions release-utils/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,28 +17,54 @@

prefix=camel-kafka-connector-

read -p "Enter release version: " releaseV
read -r -p "Enter release version: " releaseV
export RELEASE_VERSION=$releaseV
releaseVbranch="${releaseV%.*}.x"

read -p "Enter next version: " nextV
read -r -p "Enter next version: " nextV
export NEXT_VERSION=$nextV

defaultReleaseBranch=$prefix$releaseVbranch
read -p "Enter release branch [$defaultReleaseBranch]: " releaseBranch
read -r -p "Enter release branch [$defaultReleaseBranch]: " releaseBranch
export RELEASE_BRANCH=${releaseBranch:-$defaultReleaseBranch}

defaultReleaseTag=$prefix$releaseV
read -p "Enter release tag: [$defaultReleaseTag]" releaseTag
read -r -p "Enter release tag: [$defaultReleaseTag]" releaseTag
export RELEASE_TAG=${releaseTag:-$defaultReleaseTag}

read -p "Enter apache username: " user
read -r -p "Enter apache username: " user
export APACHE_USER=$user

read -p "Enter apache password: " pass
read -r -s -p "Enter apache password: " pass
export APACHE_PASS=$pass
echo ""

git checkout -b $RELEASE_BRANCH && \
./mvnw -Prelease -Pgpg -DreleaseVersion=$RELEASE_VERSION -DdevelopmentVersion=$NEXT_VERSION -Dtag=$RELEASE_TAG -Dusername=$APACHE_USER -Dpassword=$APACHE_PASS release:prepare && \
git checkout $RELEASE_TAG && git add *.json && git commit -m"[after release perform chore]: regen catalog descriptors with new version" && git tag -f $RELEASE_TAG && git push -f upstream $RELEASE_TAG && git checkout $RELEASE_BRANCH && \
./mvnw -Prelease -Pgpg -Dusername=$APACHE_USER -Dpassword=$APACHE_PASS release:perform
defaultGpgProfile=gpg
read -r -p "Enter the maven gpg profile: [$defaultGpgProfile]" gpgProfile
export GPG_PROFILE=${gpgProfile:-$defaultGpgProfile}

defaultCheckoutReleaseBranch=Y
while true; do
read -r -p "Do you want to automatically checkout -b into $RELEASE_BRANCH branch?: [Y/n]" checkoutReleaseBranch
checkoutReleaseBranch=${checkoutReleaseBranch:-$defaultCheckoutReleaseBranch}
case $checkoutReleaseBranch in
[Yy]* )
export CHECKOUT_RELEASE_TAG=Y
break
;;
[Nn]* )
export CHECKOUT_RELEASE_TAG=N
break
;;
* )
echo "Invalid input. Please enter y or n"
;;
esac
done

if [ "$CHECKOUT_RELEASE_TAG" == Y ]; then
git checkout -b "$RELEASE_BRANCH"
fi
./mvnw -Prelease -P"$GPG_PROFILE" -DreleaseVersion="$RELEASE_VERSION" -DdevelopmentVersion="$NEXT_VERSION" -Dtag="$RELEASE_TAG" -Dusername="$APACHE_USER" -Dpassword="$APACHE_PASS" release:prepare && \
git checkout "$RELEASE_TAG" && git add ./*.json && git commit -m"[after release perform chore]: regen catalog descriptors with new version" && git tag -f "$RELEASE_TAG" && git push -f upstream "$RELEASE_TAG" && git checkout "$RELEASE_BRANCH" && \
./mvnw -Prelease -Pgpg -Dusername="$APACHE_USER" -Dpassword="$APACHE_PASS" release:perform

0 comments on commit 363f6e3

Please sign in to comment.