Add maven source plugin if not exists on maven-release

This commit is contained in:
Marko Frankovic 2026-02-16 12:49:03 +01:00
parent 13eef21a3a
commit f163e77124

View File

@ -75,6 +75,28 @@ jobs:
env:
SETTINGS_XML: ${{ secrets.MVN_SETTINGS_XML }}
- name: Add maven-source-plugin to POM
run: |
if ! grep -q "maven-source-plugin" pom.xml; then
echo "maven-source-plugin not found in pom.xml, adding it..."
sed -i '/<plugins>/a \
<plugin>\
<groupId>org.apache.maven.plugins</groupId>\
<artifactId>maven-source-plugin</artifactId>\
<version>3.3.1</version>\
<executions>\
<execution>\
<id>attach-sources</id>\
<goals>\
<goal>jar-no-fork</goal>\
</goals>\
</execution>\
</executions>\
</plugin>' pom.xml
else
echo "maven-source-plugin already exists in pom.xml"
fi
- name: Maven release
run: |
mvn org.apache.maven.plugins:maven-release-plugin:3.1.0:prepare -B -DrepositoryId=pravila--pravila-maven -DconnectionUrl=$REPO_URL