Skip to content

Commit

Permalink
chore: improve pom version check ✅
Browse files Browse the repository at this point in the history
  • Loading branch information
oldratlee committed Apr 9, 2024
1 parent b764d6d commit a71e4e0
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 6 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
strategy:
matrix:
os: [ ubuntu-latest, windows-latest ]
java: [ 8, 11, 17, 21 ]
java: [ 8, 11, 17, 21, 22 ]
fail-fast: false
max-parallel: 64

Expand All @@ -27,7 +27,7 @@ jobs:
run: ./mvnw -V --no-transfer-progress clean package
if: matrix.java != 17
- name: Run release mode test
run: ./mvnw -V --no-transfer-progress clean package spotbugs:check git-commit-id:validateRevision -DperformRelease
run: ./mvnw -V --no-transfer-progress clean package spotbugs:check git-commit-id:validateRevision -DperformRelease -P'!enforce-project-version-when-release'
if: matrix.java == 17
# https://github.com/marketplace/actions/codecov
- uses: codecov/codecov-action@v4
Expand Down
45 changes: 41 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -292,8 +292,8 @@
<!-- https://maven.apache.org/enforcer/enforcer-rules/requireProperty.html -->
<requireProperty>
<property>project.version</property>
<regex>^\d\.\d+\.\d+(-(Alpha|Beta|RC)\d+)?$|^\d(\.\d+)?\.(\d+|x)-SNAPSHOT$</regex>
<regexMessage>"Project version(${project.version}) format is invalid!"</regexMessage>
<regex>^\d(\.\d+)?\.(\d+|x)-SNAPSHOT$</regex>
<regexMessage>Project dev version(${project.version}) format is invalid!</regexMessage>
</requireProperty>
</rules>
</configuration>
Expand Down Expand Up @@ -690,7 +690,7 @@
</build>
</profile>
<profile>
<id>force-jdk11-when-release</id>
<id>enforces-when-release</id>
<activation>
<property>
<name>performRelease</name>
Expand All @@ -707,7 +707,7 @@
<artifactId>maven-enforcer-plugin</artifactId>
<executions>
<execution>
<id>enforce-jdk-versions</id>
<id>enforces</id>
<goals>
<goal>enforce</goal>
</goals>
Expand All @@ -724,6 +724,43 @@
</plugins>
</build>
</profile>
<profile>
<id>enforce-project-version-when-release</id>
<activation>
<property>
<name>performRelease</name>
<value>true</value>
</property>
</activation>
<build>
<plugins>
<!--
add maven-enforce-plugin to make sure the right jdk is used
https://stackoverflow.com/a/18420462/922688
-->
<plugin>
<artifactId>maven-enforcer-plugin</artifactId>
<executions>
<execution>
<id>enforces</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireProperty>
<property>project.version</property>
<regex>^\d\.\d+\.\d+(-(Alpha|Beta|RC)\d+)?$</regex>
<regexMessage>Project release version(${project.version}) format is invalid!</regexMessage>
</requireProperty>
</rules>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>deploy-settings</id>
<activation>
Expand Down

0 comments on commit a71e4e0

Please sign in to comment.