Skip to content
Merged
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
12 changes: 10 additions & 2 deletions .github/workflows/shared-build-and-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,22 @@ jobs:
fallback: 1.0.0

- name: Bump Version
id: bump-version
run: |
chmod +x ./scripts/bump_version.sh
if ${{ inputs.tag == 'internal' }}; then
./scripts/bump_version.sh "${{ steps.previoustag.outputs.tag }}" "$(git rev-parse --short "$GITHUB_SHA")"
./scripts/bump_version.sh "${{ steps.previoustag.outputs.tag }}" "$(git rev-parse --short "$GITHUB_SHA")" "${{ inputs.module }}"
else
./scripts/bump_version.sh "${{ steps.previoustag.outputs.tag }}" "" "${{ inputs.module }}"
fi

MODULE="${{ inputs.module }}"
if [ -n "$MODULE" ]; then
echo "pom_path=$MODULE/pom.xml" >> "$GITHUB_OUTPUT"
else
echo "pom_path=pom.xml" >> "$GITHUB_OUTPUT"
fi

- name: Commit changes
run: |
git config user.name ${{ github.actor }}
Expand All @@ -106,7 +114,7 @@ jobs:
git checkout ${{ env.branch_name }}
fi

git add flowvault/pom.xml
git add ${{ steps.bump-version.outputs.pom_path }}
if [[ "${{ inputs.tag }}" == "internal" ]]; then
git commit -m "[AUTOMATED] Private Release ${{ steps.previoustag.outputs.tag }}-dev-$(git rev-parse --short $GITHUB_SHA)"
git push origin ${{ github.ref_name }} -f
Expand Down
27 changes: 15 additions & 12 deletions scripts/bump_version.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Input Arguments
Version=$1
CommitHash=$2
PomFile="$GITHUB_WORKSPACE/pom.xml"
Module=$3
PomFile="$GITHUB_WORKSPACE/$Module/pom.xml"

if [ -z "$Version" ]; then
echo "Error: Version argument is required."
Expand All @@ -14,27 +15,29 @@ if [ -z "$CommitHash" ]; then

awk -v version="$Version" '
BEGIN { updated = 0 }
/<parent>/,/<\/parent>/ { print; next }
/<version>/ && updated == 0 {
sub(/<version>.*<\/version>/, "<version>" version "</version>")
updated = 1
}
{ print }
' "$PomFile" > tempfile && cat tempfile > "$PomFile" && rm -f tempfile
' "$PomFile" > tempfile && cat tempfile > "$PomFile" && rm -f tempfile

echo "--------------------------"
echo "Done. Main project version now at $Version"
else
echo "Bumping main project version to $Version-dev-$CommitHash"

awk -v version="$Version-dev.$CommitHash" '
BEGIN { updated = 0 }
/<version>/ && updated == 0 {
sub(/<version>.*<\/version>/, "<version>" version "</version>")
updated = 1
}
{ print }
' "$PomFile" > tempfile && cat tempfile > "$PomFile" && rm -f tempfile
awk -v version="$Version${CommitHash:+-dev.$CommitHash}" '
BEGIN { updated = 0 }
/<parent>/,/<\/parent>/ { print; next }
/<version>/ && updated == 0 {
sub(/<version>.*<\/version>/, "<version>" version "</version>")
updated = 1
}
{ print }
' "$PomFile" > tempfile && cat tempfile > "$PomFile" && rm -f tempfile

echo "--------------------------"
echo "Done. Main project version now at $Version-dev.$CommitHash"
echo "--------------------------"
echo "Done. $Module module version now at $Version${CommitHash:+-dev.$CommitHash}"
fi
Loading