Skip to content

Commit

Permalink
JFrog CLI's release - Improve Jenkinsfile & bump-version.sh (#2411)
Browse files Browse the repository at this point in the history
  • Loading branch information
eyalbe4 authored Jan 14, 2024
1 parent 3b84760 commit dd5b446
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
4 changes: 0 additions & 4 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@ node("docker") {

masterBranch = 'v2'
devBranch = 'dev'
if (BRANCH?.trim() == 'v1') {
masterBranch = 'v1'
devBranch = 'dev-v1'
}

releaseVersion = ''

Expand Down
18 changes: 11 additions & 7 deletions build/bump-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
# Function to get fromVersion from a file
populateFromVersion() {
build/build.sh
fromVersion=$(./jf -v | tr -d 'jfrog version' | tr -d '\n')
local versionString
versionString=$(./jf -v)
fromVersion=${versionString//[^0-9.+]/}
}

# Function to validate arguments
Expand Down Expand Up @@ -32,17 +34,18 @@ validateVersions() {
exit 1
fi

echo Bumping version from $fromVersion to $toVersion
echo "Bumping version from $fromVersion to $toVersion"
}

createBranch() {
branchName=bump-ver-from-$fromVersion-to-$toVersion
branchName="bump-ver-from-$fromVersion-to-$toVersion"
git remote rm upstream
git remote add upstream https://github.com/jfrog/jfrog-cli.git
git checkout dev
git fetch upstream dev
git pull upstream dev
git reset --hard upstream/dev
git push
git checkout -b $branchName
git checkout -b "$branchName"
}

# Function to replace version in file
Expand Down Expand Up @@ -83,7 +86,7 @@ replaceVersion() {
}

## Validate the argument was received.
validateArg
validateArg "$@"

## Read the script argument into the toVersion variable
toVersion=$1
Expand All @@ -108,4 +111,5 @@ replaceVersion "build/npm/v2-jf/package.json" "\"version\": \"$fromVersion\"," "
echo "Version bumped successfully."

## Push the new branch, with the version bump
git push --set-upstream origin $branchName
git commit -m "Bump version from $fromVersion to $toVersion"
git push --set-upstream origin "$branchName"

0 comments on commit dd5b446

Please sign in to comment.