Skip to content

Commit

Permalink
Merge pull request #6049 from wso2/pavinduLakshan-hotfix-release-sh
Browse files Browse the repository at this point in the history
  • Loading branch information
pavinduLakshan authored Apr 30, 2024
2 parents fc16a3f + f2ece2d commit 9be135d
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/release-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -181,4 +181,4 @@ jobs:
working-directory: .github/workflows
run: |
PACKAGES="${{ toJson(steps.changesets.outputs.publishedPackages) }}"
bash ./scripts/release.sh "$PACKAGES" ${{ github.run_number }}
bash ./scripts/release.sh "$PACKAGES" ${{ github.run_number }} ${{ env.IS_HOTFIX }}
50 changes: 50 additions & 0 deletions .github/workflows/scripts/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ SCRIPT_LOCATION="$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd)"
PACKAGES=$1
# The GitHub Action run number.
GITHUB_RUN_NUMBER=$2
# Variable to determine whether the current release is a hotfix
IS_HOTFIX=$3
# The release branch name.
RELEASE_BRANCH=release-action-$GITHUB_RUN_NUMBER

Expand All @@ -46,6 +48,22 @@ process_console_package() {
return 0
fi

if [ "$IS_HOTFIX" = "true" ]; then
echo "Hotfix detected. Publishing the package as a hotfix."

search_tag=$tag-hotfix
echo "Search Tag: $search_tag"

hotfix_count=$(git tag | grep $search_tag | wc -l)
echo "Hotfix count: $hotfix_count"

next_hotfix_no=$((hotfix_count + 1))
echo "Next Hotfix number: $next_hotfix_no"

releaseVersion=$search_tag-$next_hotfix_no
echo "Hotfix release tag: $tag"
fi

goToRootDirectory &&
cd "apps/console/java" || exit 1 &&
echo "Releasing console version: $releaseVersion"
Expand All @@ -72,6 +90,22 @@ process_myaccount_package() {
return 0
fi

if [ "$IS_HOTFIX" = "true" ]; then
echo "Hotfix detected. Publishing the package as a hotfix."

search_tag=$tag-hotfix
echo "Search Tag: $search_tag"

hotfix_count=$(git tag | grep $search_tag | wc -l)
echo "Hotfix count: $hotfix_count"

next_hotfix_no=$((hotfix_count + 1))
echo "Next Hotfix number: $next_hotfix_no"

releaseVersion=$search_tag-$next_hotfix_no
echo "Hotfix release tag: $tag"
fi

goToRootDirectory &&
cd "apps/myaccount/java" || exit 1 &&
echo "Releasing myaccount version: $releaseVersion"
Expand All @@ -98,6 +132,22 @@ process_java_apps_package() {
return 0
fi

if [ "$IS_HOTFIX" = "true" ]; then
echo "Hotfix detected. Publishing the package as a hotfix."

search_tag=$tag-hotfix
echo "Search Tag: $search_tag"

hotfix_count=$(git tag | grep $search_tag | wc -l)
echo "Hotfix count: $hotfix_count"

next_hotfix_no=$((hotfix_count + 1))
echo "Next Hotfix number: $next_hotfix_no"

releaseVersion=$search_tag-$next_hotfix_no
echo "Hotfix release tag: $tag"
fi

goToRootDirectory &&
cd "identity-apps-core" || exit 1 &&
echo "Releasing identity-apps-core version: $releaseVersion"
Expand Down

0 comments on commit 9be135d

Please sign in to comment.