11name : Release
2+
23on :
3- workflow_dispatch :
44 push :
5+ # Run a real release on pushes to tags like v1.0, v2.3.4, etc.
56 tags :
67 - " v*"
7- push :
8+ # Run a dry-run on pushes to any branch
89 branches :
9- - " renaud-hartert_data/maven-migration "
10+ - " ** "
1011
1112jobs :
1213 publish :
14+ # Dynamically set the job name based on the trigger
15+ name : ${{ startsWith(github.ref, 'refs/tags/') && 'Publish Release' || 'Run Release Dry-Run' }}
16+
1317 runs-on :
1418 group : databricks-deco-testing-runner-group
1519 labels : ubuntu-latest-deco
@@ -29,10 +33,19 @@ jobs:
2933 gpg-private-key : ${{ secrets.GPG_PRIVATE_KEY }}
3034 gpg-passphrase : ${{ secrets.GPG_PASSPHRASE }}
3135
32- - name : Publish to the Maven Central Repository
36+ # This step runs ONLY on branch pushes (dry-run)
37+ - name : Run Release Dry-Run (Verify)
38+ if : " !startsWith(github.ref, 'refs/tags/')"
3339 run : mvn -Prelease -DskipTests=true --batch-mode verify
3440
41+ # This step runs ONLY on tag pushes (real release)
42+ - name : Publish to Maven Central Repository (Deploy)
43+ if : " startsWith(github.ref, 'refs/tags/')"
44+ run : mvn -Prelease -DskipTests=true --batch-mode deploy
45+
46+ # This step also runs ONLY on tag pushes (real release)
3547 - name : Create GitHub release
48+ if : " startsWith(github.ref, 'refs/tags/')"
3649 uses : softprops/action-gh-release@v1
3750 with :
38- files : target/*.jar
51+ files : target/*.jar
0 commit comments