Skip to content

Commit

Permalink
chore: Remove version properties from pom.xml and enhance GitHub Acti…
Browse files Browse the repository at this point in the history
…ons 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.
  • Loading branch information
Marvin Zhang committed Jan 3, 2025
1 parent b2fa00e commit 55f9406
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@ jobs:
with:
java-version: '17'
distribution: 'temurin'
- name: Get version
id: get_version
run: echo "name=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_OUTPUT
- name: Pad run number
id: pad_run_number
run: echo "padded_run_number=$(printf '%04d' ${{ github.run_number }})" > $GITHUB_OUTPUT
- name: Set version
run: mvn versions:set -DnewVersion=${{ steps.get_version.outputs.version }}-SNAPSHOT-${{ steps.pad_run_number.outputs.padded_run_number }}
- name: Publish package
run: |
mvn -P snapshot --batch-mode deploy
Expand Down
6 changes: 0 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,6 @@
</plugin>
</plugins>
</build>
<properties>
<version>${project.version}</version>
</properties>
</profile>

<!-- Profile for Snapshot Version -->
Expand Down Expand Up @@ -170,9 +167,6 @@
</plugin>
</plugins>
</build>
<properties>
<version>${project.version}-SNAPSHOT</version>
</properties>
</profile>
</profiles>
</project>

0 comments on commit 55f9406

Please sign in to comment.