@@ -620,12 +620,30 @@ jobs:
620620 files : target/site/jacoco/jacoco.xml
621621 continue-on-error : true
622622
623- github -snapshot :
624- name : Update Snapshot Pre-release on GitHub
623+ check -snapshot :
624+ name : Check: main branch / SNAPSHOT
625625 needs : [report]
626+ runs-on : ubuntu-latest
626627 if : >-
627628 (github.event_name == 'push' && github.ref == 'refs/heads/main') ||
628- github.event_name == 'workflow_dispatch'
629+ (github.event_name == 'workflow_dispatch' && !startsWith(github.ref, 'refs/tags/v'))
630+ steps :
631+ - name : Confirm snapshot ref
632+ run : echo "Confirmed on snapshot ref ${{ github.ref }}"
633+
634+ check-tag :
635+ name : Check: v* tag
636+ needs : [report]
637+ runs-on : ubuntu-latest
638+ if : startsWith(github.ref, 'refs/tags/v')
639+ steps :
640+ - name : Confirm tag ref
641+ run : echo "Confirmed on tag ${{ github.ref }}"
642+
643+ github-snapshot :
644+ name : Update Snapshot Pre-release on GitHub
645+ needs : [check-snapshot]
646+ if : needs.check-snapshot.result == 'success'
629647 runs-on : ubuntu-latest
630648 permissions :
631649 contents : write
@@ -650,10 +668,8 @@ jobs:
650668
651669 publish-snapshot :
652670 name : Publish Snapshot to Central
653- needs : [github-snapshot]
654- if : >-
655- (github.event_name == 'push' && github.ref == 'refs/heads/main') ||
656- github.event_name == 'workflow_dispatch'
671+ needs : [github-snapshot, check-snapshot]
672+ if : needs.check-snapshot.result == 'success'
657673 runs-on : ubuntu-latest
658674 environment : maven-central
659675 steps :
@@ -685,8 +701,8 @@ jobs:
685701
686702 github-release :
687703 name : Attach Binaries to GitHub Release
688- needs : [report ]
689- if : startsWith(github.ref, 'refs/tags/v')
704+ needs : [check-tag ]
705+ if : needs.check-tag.result == 'success'
690706 runs-on : ubuntu-latest
691707 permissions :
692708 contents : write
@@ -696,14 +712,14 @@ jobs:
696712 name : llama-jars
697713 path : release-assets/
698714 - name : Upload release assets
699- uses : softprops/action-gh-release@v2
715+ uses : softprops/action-gh-release@v3
700716 with :
701717 files : release-assets/*
702718
703719 publish-release :
704720 name : Publish Release to Central
705- if : startsWith(github.ref, 'refs/tags/v') || github.event.inputs.release_to_maven_central == 'true'
706- needs : [github-release, crosscompile-linux-x86_64-cuda]
721+ if : needs.check-tag.result == 'success' && github.event.inputs.release_to_maven_central == 'true'
722+ needs : [github-release, check-tag, crosscompile-linux-x86_64-cuda]
707723 runs-on : ubuntu-latest
708724 environment : maven-central
709725 steps :
0 commit comments