File tree Expand file tree Collapse file tree 1 file changed +14
-8
lines changed Expand file tree Collapse file tree 1 file changed +14
-8
lines changed Original file line number Diff line number Diff line change 77
88jobs :
99 publish :
10+ name : Publish to GitHub Packages
1011 runs-on : ubuntu-latest
1112 permissions :
1213 contents : read
@@ -18,20 +19,25 @@ jobs:
1819 with :
1920 submodules : true # Ensure submodules are checked out if needed
2021
21- - name : Set up JDK 8
22+ - name : Set up JDK 8 and Configure Maven Settings
2223 uses : actions/setup-java@v4
2324 with :
2425 java-version : " 8"
2526 distribution : " zulu"
2627 cache : maven
28+ server-id : github # Id of the publication repository field in the pom.xml
29+ settings-path : ${{ github.workspace }} # path for settings.xml with generated authentication info
2730
28- - name : Configure Maven Settings for GitHub Packages
29- uses : actions/setup-java@v4
30- with :
31- java-version : " 8" # Repeat setup to ensure settings are configured
32- distribution : " zulu"
33- server-id : github # Value of the distributionManagement/repository/id field of the pom.xml
34- settings-path : ${{ github.workspace }} # location for the settings.xml file
31+ - name : Verify Project Version is not a SNAPSHOT (on release event only)
32+ if : github.event_name == 'release' # Only run this check for actual releases
33+ run : |
34+ PROJECT_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
35+ echo "Checking project version: $PROJECT_VERSION for release trigger."
36+ if [[ "$PROJECT_VERSION" == *"-SNAPSHOT"* ]]; then
37+ echo "Error: Attempting to deploy a SNAPSHOT version ($PROJECT_VERSION) on a release event. Aborting."
38+ exit 1
39+ fi
40+ echo "Project version $PROJECT_VERSION is a valid release version. Proceeding..."
3541
3642 - name : Publish package
3743 run : mvn --batch-mode deploy -DskipTests=true
You can’t perform that action at this time.
0 commit comments