Skip to content

Commit b91a3b3

Browse files
authored
Zero-commit release process (#1335)
This commit implements zero-commit releases by: - Updating release workflow configuration - Adding maven properties for release automation - Updating all module pom.xml files - Enhancing AnsiConsole functionality - Updating documentation Fixes date formatting and implements zero-commit release process.
1 parent e2422d7 commit b91a3b3

File tree

24 files changed

+89
-94
lines changed

24 files changed

+89
-94
lines changed

.github/workflows/release.yml

Lines changed: 48 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -12,59 +12,41 @@
1212
name: Manual Maven Release
1313

1414
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]*'
3118

3219
jobs:
3320
release:
3421
name: Release to Maven Central
3522
runs-on: ubuntu-latest
23+
if: github.ref_type == 'tag'
3624
steps:
3725

3826
- name: Checkout ${{ github.ref_name }}
3927
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
4042
4143
- name: Setup Java
4244
uses: actions/setup-java@v4
4345
with:
44-
distribution: ${{ github.event.inputs.distribution }}
45-
java-version: ${{ github.event.inputs.java-version }}
46+
distribution: temurin
47+
java-version: 22
4648
cache: maven
4749

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-
6850
- name: Release
6951
env:
7052
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
@@ -73,32 +55,46 @@ jobs:
7355
MAVEN_USER: ${{ secrets.MAVEN_USER }}
7456
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
7557
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
7759
7860
- name: Post release
7961
env:
8062
GH_TOKEN: ${{ github.token }}
8163
shell: bash
8264
run: |
83-
version=${{ steps.pre-release.outputs.version }}
65+
gh extension install valeriobelli/gh-milestone
66+
version=${{ steps.version.outputs.version }}
8467
echo "Trying to find milestone $version"
8568
milestone=$(gh milestone list --json id,title,state --jq "map_values(select(.title == \"${version}\" and .state == \"OPEN\")).[].number")
8669
if [ ! -z "$milestone" ]; then
8770
echo "Found milestone $version, closing it"
8871
gh milestone edit $milestone --state closed
8972
fi
9073
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
9996

10097
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"

.mvn/extensions.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,9 @@
55
<artifactId>extension</artifactId>
66
<version>0.7.5</version>
77
</extension>
8+
<extension>
9+
<groupId>eu.maveniverse.maven.nisse</groupId>
10+
<artifactId>extension</artifactId>
11+
<version>0.5.1</version>
12+
</extension>
813
</extensions>

.mvn/maven.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Enable GIT dynamic version
2+
nisse.source.jgit.dynamicVersion=true

builtins/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<parent>
1717
<groupId>org.jline</groupId>
1818
<artifactId>jline-parent</artifactId>
19-
<version>4.0.0-SNAPSHOT</version>
19+
<version>${nisse.jgit.dynamicVersion}</version>
2020
</parent>
2121

2222
<artifactId>jline-builtins</artifactId>

console-ui/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>org.jline</groupId>
77
<artifactId>jline-parent</artifactId>
8-
<version>4.0.0-SNAPSHOT</version>
8+
<version>${nisse.jgit.dynamicVersion}</version>
99
</parent>
1010

1111
<artifactId>jline-console-ui</artifactId>

console/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<parent>
1717
<groupId>org.jline</groupId>
1818
<artifactId>jline-parent</artifactId>
19-
<version>4.0.0-SNAPSHOT</version>
19+
<version>${nisse.jgit.dynamicVersion}</version>
2020
</parent>
2121

2222
<artifactId>jline-console</artifactId>

curses/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<parent>
1717
<groupId>org.jline</groupId>
1818
<artifactId>jline-parent</artifactId>
19-
<version>4.0.0-SNAPSHOT</version>
19+
<version>${nisse.jgit.dynamicVersion}</version>
2020
</parent>
2121

2222
<artifactId>jline-curses</artifactId>

demo/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<parent>
1717
<groupId>org.jline</groupId>
1818
<artifactId>jline-parent</artifactId>
19-
<version>4.0.0-SNAPSHOT</version>
19+
<version>${nisse.jgit.dynamicVersion}</version>
2020
</parent>
2121

2222
<artifactId>jline-demo</artifactId>

graal/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<parent>
1717
<groupId>org.jline</groupId>
1818
<artifactId>jline-parent</artifactId>
19-
<version>4.0.0-SNAPSHOT</version>
19+
<version>${nisse.jgit.dynamicVersion}</version>
2020
</parent>
2121

2222
<artifactId>jline-graal</artifactId>

groovy/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<parent>
1515
<groupId>org.jline</groupId>
1616
<artifactId>jline-parent</artifactId>
17-
<version>4.0.0-SNAPSHOT</version>
17+
<version>${nisse.jgit.dynamicVersion}</version>
1818
</parent>
1919
<artifactId>jline-groovy</artifactId>
2020
<name>JLine Groovy</name>

0 commit comments

Comments
 (0)