Skip to content

Commit 1b1e3af

Browse files
committed
better versioning
1 parent b4f0061 commit 1b1e3af

File tree

13 files changed

+41
-48
lines changed

13 files changed

+41
-48
lines changed

.github/workflows/release.yml

Lines changed: 11 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,12 @@ jobs:
2626
java-version: 11
2727
distribution: "temurin"
2828
cache: maven
29-
server-id: ossrh
30-
server-username: OSSRH_USERNAME
31-
server-password: OSSRH_PASSWORD
32-
settings-path: ${{ github.workspace }}/.mvn/settings.xml
3329

3430
- name: Install GPG key
3531
run: |
3632
echo "${{ secrets.GPG_PRIVATE_KEY }}" | base64 --decode | gpg --batch --import
3733
gpg --list-secret-keys --keyid-format LONG
3834
39-
# Determine if this is a tag push (release) or branch push (snapshot)
4035
- name: Set release type
4136
id: release_type
4237
run: |
@@ -49,34 +44,23 @@ jobs:
4944
echo "This is a snapshot build from branch ${GITHUB_REF#refs/heads/}"
5045
fi
5146
52-
# Build and test
53-
- name: Build and test
47+
- name: Build code
5448
run: mvn clean verify -DskipTests
5549

56-
# For releases
57-
- name: Deploy release to Maven Central
58-
if: env.IS_RELEASE == 'true'
50+
- name: Deploy to Maven Central
5951
run: |
60-
mvn deploy -P sonatype -DskipTests \
61-
-s ${{ github.workspace }}/.github/settings.xml
62-
env:
63-
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
64-
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
65-
GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }}
66-
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
67-
VERSIONING_GIT_REF: ${{ github.ref }}
68-
VERSIONING_EXTENSION_LOG: true
69-
70-
# For snapshots
71-
- name: Deploy snapshot to Maven Central
72-
if: env.IS_RELEASE == 'false'
73-
run: |
74-
mvn deploy -DskipTests \
75-
-s ${{ github.workspace }}/.github/settings.xml
52+
if [[ $IS_RELEASE == true ]]; then
53+
echo "Deploying release to Maven Central"
54+
mvn deploy -P sonatype -DskipTests \
55+
-s ${{ github.workspace }}/.github/settings.xml
56+
else
57+
echo "Deploying snapshot to Maven Central"
58+
mvn deploy -DskipTests \
59+
-s ${{ github.workspace }}/.github/settings.xml
60+
fi
7661
env:
7762
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
7863
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
7964
GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }}
8065
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
81-
VERSIONING_GIT_REF: ${{ github.ref }}
8266
VERSIONING_EXTENSION_LOG: true

.mvn/extensions.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
<extension>
44
<groupId>me.qoomon</groupId>
55
<artifactId>maven-git-versioning-extension</artifactId>
6-
<version>9.6.5</version>
6+
<version>9.10.2</version>
77
</extension>
88
</extensions>
Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,22 @@
1-
<?xml version="1.0" encoding="UTF-8"?>
2-
<gitVersioning>
3-
<refs>
4-
<ref type="branch">
5-
<pattern>.*</pattern>
6-
<version>${commit.short}-SNAPSHOT</version>
7-
</ref>
1+
<configuration xmlns="https://github.com/qoomon/maven-git-versioning-extension"
2+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="https://github.com/qoomon/maven-git-versioning-extension https://qoomon.github.io/maven-git-versioning-extension/configuration-9.4.0.xsd">
4+
5+
<refs considerTagsOnBranches="true">
86
<ref type="tag">
9-
<pattern>v([0-9]+)\.([0-9]+)\.([0-9]+)</pattern>
10-
<version>${1}.${2}.${3}</version>
7+
<pattern><![CDATA[v(?<version>.*)]]></pattern>
8+
<version>${ref.version}</version>
9+
</ref>
10+
<ref type="branch">
11+
<pattern>.+</pattern>
12+
<version>${describe.tag.version}+${describe.distance}-${commit.short}-SNAPSHOT</version>
1113
</ref>
1214
</refs>
13-
</gitVersioning>
15+
16+
<preferTags>true</preferTags>
17+
18+
<!-- optional fallback configuration in case of no matching ref configuration-->
19+
<rev>
20+
<version>${commit}</version>
21+
</rev>
22+
</configuration>

handlebars-caffeine/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>com.iterable</groupId>
77
<artifactId>handlebars.java</artifactId>
8-
<version>5.0.0-SNAPSHOT</version>
8+
<version>${project.version.release}+${git.commit.timestamp.datetime}-${git.commit.id.abbrev}-SNAPSHOT</version>
99
</parent>
1010

1111
<modelVersion>4.0.0</modelVersion>

handlebars-guava-cache/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>com.iterable</groupId>
77
<artifactId>handlebars.java</artifactId>
8-
<version>5.0.0-SNAPSHOT</version>
8+
<version>${project.version.release}+${git.commit.timestamp.datetime}-${git.commit.id.abbrev}-SNAPSHOT</version>
99
</parent>
1010

1111
<modelVersion>4.0.0</modelVersion>

handlebars-helpers/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<parent>
55
<groupId>com.iterable</groupId>
66
<artifactId>handlebars.java</artifactId>
7-
<version>5.0.0-SNAPSHOT</version>
7+
<version>${project.version.release}+${git.commit.timestamp.datetime}-${git.commit.id.abbrev}-SNAPSHOT</version>
88
</parent>
99

1010
<modelVersion>4.0.0</modelVersion>

handlebars-humanize/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<parent>
55
<groupId>com.iterable</groupId>
66
<artifactId>handlebars.java</artifactId>
7-
<version>5.0.0-SNAPSHOT</version>
7+
<version>${project.version.release}+${git.commit.timestamp.datetime}-${git.commit.id.abbrev}-SNAPSHOT</version>
88
</parent>
99

1010
<modelVersion>4.0.0</modelVersion>

handlebars-jackson2/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<parent>
55
<groupId>com.iterable</groupId>
66
<artifactId>handlebars.java</artifactId>
7-
<version>5.0.0-SNAPSHOT</version>
7+
<version>${project.version.release}+${git.commit.timestamp.datetime}-${git.commit.id.abbrev}-SNAPSHOT</version>
88
</parent>
99

1010
<modelVersion>4.0.0</modelVersion>

handlebars-maven-plugin-tests/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<parent>
55
<groupId>com.iterable</groupId>
66
<artifactId>handlebars.java</artifactId>
7-
<version>5.0.0-SNAPSHOT</version>
7+
<version>${project.version.release}+${git.commit.timestamp.datetime}-${git.commit.id.abbrev}-SNAPSHOT</version>
88
</parent>
99

1010
<modelVersion>4.0.0</modelVersion>

handlebars-maven-plugin/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>com.iterable</groupId>
88
<artifactId>handlebars.java</artifactId>
9-
<version>5.0.0-SNAPSHOT</version>
9+
<version>${project.version.release}+${git.commit.timestamp.datetime}-${git.commit.id.abbrev}-SNAPSHOT</version>
1010
</parent>
1111

1212
<modelVersion>4.0.0</modelVersion>

0 commit comments

Comments
 (0)