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 7
7
8
8
jobs :
9
9
publish :
10
+ name : Publish to GitHub Packages
10
11
runs-on : ubuntu-latest
11
12
permissions :
12
13
contents : read
@@ -18,20 +19,25 @@ jobs:
18
19
with :
19
20
submodules : true # Ensure submodules are checked out if needed
20
21
21
- - name : Set up JDK 8
22
+ - name : Set up JDK 8 and Configure Maven Settings
22
23
uses : actions/setup-java@v4
23
24
with :
24
25
java-version : " 8"
25
26
distribution : " zulu"
26
27
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
27
30
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..."
35
41
36
42
- name : Publish package
37
43
run : mvn --batch-mode deploy -DskipTests=true
You can’t perform that action at this time.
0 commit comments