Skip to content

Commit 40c13d6

Browse files
feat: enhance publishing logic for snapshots and releases in CI/CD workflow
1 parent 9554d13 commit 40c13d6

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

.github/workflows/hyperion_java-client_publish.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,17 +91,24 @@ jobs:
9191
BRANCH_NAME="${{ steps.version.outputs.branch-name }}"
9292
EVENT="${{ github.event_name }}"
9393
94-
# Publish on push events (feature branches → snapshots, stable branches → releases)
95-
if [[ "$EVENT" == "push" ]]; then
94+
echo "🔍 Event: $EVENT"
95+
echo "🔍 GitHub ref: ${{ github.ref }}"
96+
echo "🔍 Branch name: $BRANCH_NAME"
97+
98+
# Publish on push events, workflow_dispatch, OR pull_request (for snapshots only)
99+
if [[ "$EVENT" == "push" ]] || [[ "$EVENT" == "workflow_dispatch" ]]; then
96100
echo "should-publish=true" >> $GITHUB_OUTPUT
97101
if [[ "${{ steps.version.outputs.is-snapshot }}" == "true" ]]; then
98102
echo "✅ Will publish feature snapshot to GitHub Packages"
99103
else
100104
echo "✅ Will publish release to GitHub Packages + Maven Central"
101105
fi
106+
elif [[ "$EVENT" == "pull_request" ]] && [[ "${{ steps.version.outputs.is-snapshot }}" == "true" ]]; then
107+
echo "should-publish=true" >> $GITHUB_OUTPUT
108+
echo "✅ Will publish PR snapshot to GitHub Packages for testing"
102109
else
103110
echo "should-publish=false" >> $GITHUB_OUTPUT
104-
echo "ℹ️ PR: Build only, no publishing"
111+
echo "ℹ️ Event '$EVENT': Build only, no publishing"
105112
fi
106113
107114
- name: Build & Test

0 commit comments

Comments
 (0)