12
12
name : Manual Maven Release
13
13
14
14
on :
15
- workflow_dispatch :
16
- inputs :
17
- version :
18
- description : The version to release (will be inferred from the pom version by default).
19
- required : false
20
- next-version :
21
- description : The next development version (will be inferred from the pom version by default).
22
- required : false
23
- java-version :
24
- description : The java version to use
25
- required : false
26
- default : 22
27
- distribution :
28
- description : The java distribution to use.
29
- required : false
30
- default : temurin
15
+ push :
16
+ tags :
17
+ - ' [0-9]*.[0-9]*.[0-9]*'
31
18
32
19
jobs :
33
20
release :
34
21
name : Release to Maven Central
35
22
runs-on : ubuntu-latest
23
+ if : github.ref_type == 'tag'
36
24
steps :
37
25
38
26
- name : Checkout ${{ github.ref_name }}
39
27
uses : actions/checkout@v4
28
+ with :
29
+ fetch-depth : 0 # Full history for git describe
30
+ ref : ${{ github.ref }} # Ensures we're on the exact tag when triggered by tag push
31
+
32
+ - name : Verify tag state
33
+ id : version
34
+ run : |
35
+ git fetch --tags
36
+ echo "All recent tags:"
37
+ git tag -l --sort=version:refname | head -5
38
+ echo "Current commit: $(git rev-parse HEAD)"
39
+ echo "Git describe: $(git describe --tags --always)"
40
+ echo "Tag: ${GITHUB_REF#refs/tags/}"
41
+ echo "version=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
40
42
41
43
- name : Setup Java
42
44
uses : actions/setup-java@v4
43
45
with :
44
- distribution : ${{ github.event.inputs.distribution }}
45
- java-version : ${{ github.event.inputs.java-version }}
46
+ distribution : temurin
47
+ java-version : 22
46
48
cache : maven
47
49
48
- - name : Import GPG key
49
- uses : crazy-max/ghaction-import-gpg@v6
50
- with :
51
- gpg_private_key : ${{ secrets.GPG_SIGNING_KEY }}
52
- passphrase : ${{ secrets.GPG_PASSPHRASE }}
53
- git_config_global : true
54
- git_user_signingkey : true
55
- git_commit_gpgsign : true
56
- fingerprint : ${{ secrets.GPG_KEY_FINGERPRINT }}
57
-
58
- - name : Release preparation
59
- id : pre-release
60
- shell : bash
61
- env :
62
- GH_TOKEN : ${{ github.token }}
63
- run : |
64
- gh extension install valeriobelli/gh-milestone
65
- version=$(./mvnw -q -DforceStdout --raw-streams help:evaluate -N -Dexpression=project.version | sed -rn 's/([^-]+)(-SNAPSHOT|)$/\1/p')
66
- echo "version=$version" >> "$GITHUB_OUTPUT"
67
-
68
50
- name : Release
69
51
env :
70
52
MAVEN_GPG_PASSPHRASE : ${{ secrets.GPG_PASSPHRASE }}
@@ -73,32 +55,46 @@ jobs:
73
55
MAVEN_USER : ${{ secrets.MAVEN_USER }}
74
56
MAVEN_PASSWORD : ${{ secrets.MAVEN_PASSWORD }}
75
57
run : |
76
- ./mvnw -B release:prepare release:perform -Darguments="-DskipTests - Dnjord.autoPublish" - s .github/release-settings.xml -DreleaseVersion=${{ github.event.inputs.version }} -DdevelopmentVersion=${{ github.event.inputs.next-version }}
58
+ ./mvnw -B deploy - Dnjord.autoPublish -Pbundle,javadoc,format-check,sign - s .github/release-settings.xml
77
59
78
60
- name : Post release
79
61
env :
80
62
GH_TOKEN : ${{ github.token }}
81
63
shell : bash
82
64
run : |
83
- version=${{ steps.pre-release.outputs.version }}
65
+ gh extension install valeriobelli/gh-milestone
66
+ version=${{ steps.version.outputs.version }}
84
67
echo "Trying to find milestone $version"
85
68
milestone=$(gh milestone list --json id,title,state --jq "map_values(select(.title == \"${version}\" and .state == \"OPEN\")).[].number")
86
69
if [ ! -z "$milestone" ]; then
87
70
echo "Found milestone $version, closing it"
88
71
gh milestone edit $milestone --state closed
89
72
fi
90
73
91
- version=$(./mvnw -q -DforceStdout --raw-streams help:evaluate -N -Dexpression=project.version | sed -rn 's/([^-]+)(-SNAPSHOT|)$/\1/p')
92
- echo "Preparing development $version"
93
- echo "Trying to find milestone $version"
94
- milestone=$(gh milestone list --json id,title,state --jq "map_values(select(.title == \"${version}\" and .state == \"OPEN\")).[].number")
95
- if [ -z "$milestone" ]; then
96
- echo "Creating milestone $version"
97
- gh milestone create --title $version
98
- fi
74
+ # Parse semantic version and increment patch version
75
+ if [[ $version =~ ^([0-9]+)\.([0-9]+)\.([0-9]+)$ ]]; then
76
+ major=${BASH_REMATCH[1]}
77
+ minor=${BASH_REMATCH[2]}
78
+ patch=${BASH_REMATCH[3]}
79
+
80
+ # Increment patch version for next development cycle
81
+ next_patch=$((patch + 1))
82
+ next_version="${major}.${minor}.${next_patch}"
83
+
84
+ echo "Preparing development $next_version"
85
+ echo "Trying to find milestone $next_version"
86
+
87
+ milestone=$(gh milestone list --json id,title,state --jq "map_values(select(.title == \"${next_version}\" and .state == \"OPEN\")).[].number")
88
+ if [ -z "$milestone" ]; then
89
+ echo "Creating milestone $next_version"
90
+ gh milestone create --title $next_version
91
+ fi
92
+ else
93
+ echo "ERROR : Version $version is not a valid semantic version (x.y.z)"
94
+ exit 1
95
+ fi
99
96
100
97
name=$(./mvnw -q -DforceStdout --raw-streams help:evaluate -N -Dexpression=project.name)
101
- version=${{ steps.pre-release.outputs.version }}
102
- tag=$(git describe --tags --abbrev=0)
103
- echo "Creating release \"$name $version\" from tag $tag"
104
- gh release create $tag --verify-tag --notes-from-tag --title "$name $version"
98
+ version=${{ steps.version.outputs.version }}
99
+ echo "Creating release \"$name $version\" from tag"
100
+ gh release create $version --verify-tag --notes-from-tag --title "$name $version"
0 commit comments