Skip to content

Commit 55f9406

Browse files
author
Marvin Zhang
committed
chore: Remove version properties from pom.xml and enhance GitHub Actions workflow for versioning
- Removed version properties from the Maven profiles in pom.xml to simplify configuration. - Added steps in the GitHub Actions workflow to dynamically retrieve and set the project version with a padded run number for better versioning during snapshot deployments. - Improved the overall clarity and maintainability of the workflow for future releases.
1 parent b2fa00e commit 55f9406

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

.github/workflows/publish.yml

+8
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,14 @@ jobs:
2222
with:
2323
java-version: '17'
2424
distribution: 'temurin'
25+
- name: Get version
26+
id: get_version
27+
run: echo "name=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_OUTPUT
28+
- name: Pad run number
29+
id: pad_run_number
30+
run: echo "padded_run_number=$(printf '%04d' ${{ github.run_number }})" > $GITHUB_OUTPUT
31+
- name: Set version
32+
run: mvn versions:set -DnewVersion=${{ steps.get_version.outputs.version }}-SNAPSHOT-${{ steps.pad_run_number.outputs.padded_run_number }}
2533
- name: Publish package
2634
run: |
2735
mvn -P snapshot --batch-mode deploy

pom.xml

-6
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,6 @@
120120
</plugin>
121121
</plugins>
122122
</build>
123-
<properties>
124-
<version>${project.version}</version>
125-
</properties>
126123
</profile>
127124

128125
<!-- Profile for Snapshot Version -->
@@ -170,9 +167,6 @@
170167
</plugin>
171168
</plugins>
172169
</build>
173-
<properties>
174-
<version>${project.version}-SNAPSHOT</version>
175-
</properties>
176170
</profile>
177171
</profiles>
178172
</project>

0 commit comments

Comments
 (0)