Skip to content

Commit d20b29e

Browse files
Updated thw workflow
1 parent 348a854 commit d20b29e

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

.github/workflows/main-build.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,13 @@ jobs:
5555
current_version=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
5656
echo "Current version: $current_version"
5757
echo "REVISION=$current_version" >> $GITHUB_ENV
58+
# Pre-populate UPDATED_VERSION so downstream condition works even if bump step is skipped
59+
echo "UPDATED_VERSION=$current_version" >> $GITHUB_ENV
5860
shell: bash
5961

6062
- name: Check and Update Version
61-
if: github.ref == 'refs/heads/develop'
63+
# Run on both develop and internal-repo branches
64+
if: ${{ github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/internal-repo' }}
6265
id: check-and-update-version
6366
run: |
6467
current_version=${{ env.REVISION }}
@@ -79,7 +82,9 @@ jobs:
7982
git config --local user.email "github-actions@github.com"
8083
git add pom.xml
8184
git commit -m "Increment version to ${new_version}"
82-
git push origin HEAD:develop
85+
current_branch="${GITHUB_REF#refs/heads/}"
86+
echo "Pushing version bump to $current_branch"
87+
git push origin HEAD:${current_branch}
8388
else
8489
echo "Current version already contains -SNAPSHOT, no update needed."
8590
fi
@@ -94,7 +99,8 @@ jobs:
9499
shell: bash
95100

96101
- name: Deploy snapshot
97-
if: ${{ endsWith(env.UPDATED_VERSION, '-SNAPSHOT') }}
102+
# Deploy only if we have a snapshot version
103+
if: ${{ env.UPDATED_VERSION && endsWith(env.UPDATED_VERSION, '-SNAPSHOT') }}
98104
run: |
99105
mvn -B -ntp -fae -Dmaven.install.skip=true -Dmaven.test.skip=true -DdeployAtEnd=true -DaltDeploymentRepository=github::default::https://maven.pkg.github.com/cap-java/sdm deploy
100106
env:

0 commit comments

Comments
 (0)