Skip to content

Commit

Permalink
Create profile for shaded jar, create rpm and bundle shaded jar there (
Browse files Browse the repository at this point in the history
…#505)

* Create profile to make shaded jars, create workflow to make shaded jar and rpm for it

* Indent rpm.pom.xml

* Use root:root as user/group
  • Loading branch information
StrongestNumber9 authored Feb 6, 2025
1 parent 38bf894 commit 3d7c269
Show file tree
Hide file tree
Showing 5 changed files with 146 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/upload_release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,13 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}

- name: Publish shaded jar as RPM to GitHub Assets
run: mvn --batch-mode -Drevision=${{ github.event.release.tag_name }} -Dsha1= -Dchangelist= clean package -Pbuild-shaded-jar && cd rpm/ && mvn --batch-mode -Drevision=${{ github.event.release.tag_name }} -Dsha1= -Dchangelist= -f rpm.pom.xml package
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Attach rpm to release
uses: softprops/action-gh-release@v1
with:
files: rpm/target/rpm/com.teragrep-pth_10/RPMS/noarch/com.teragrep-pth_10-*.noarch.rpm
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@
fuzzer/**
output.log
.project
dependency-reduced-pom.xml
24 changes: 24 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,7 @@
<exclude>toolchains.xml</exclude>
<exclude>settings.xml</exclude>
<exclude>dependencies.settings.xml</exclude>
<exclude>rpm/rpm.pom.xml</exclude>
<!-- readme -->
<exclude>README.adoc</exclude>
<exclude>README.md</exclude>
Expand Down Expand Up @@ -614,5 +615,28 @@
</plugins>
</build>
</profile>
<profile>
<id>build-shaded-jar</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.5.1</version>
<executions>
<execution>
<goals>
<goal>shade</goal>
</goals>
<phase>package</phase>
<configuration>
<shadedClassifierName>shaded</shadedClassifierName>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
1 change: 1 addition & 0 deletions rpm/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/target
110 changes: 110 additions & 0 deletions rpm/rpm.pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<packaging>rpm</packaging>
<modelVersion>4.0.0</modelVersion>
<artifactId>pth_10</artifactId>
<version>${revision}${sha1}${changelist}</version>
<name>pth_10</name>
<description>pth_10</description>
<groupId>com.teragrep</groupId>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<java.version>1.8</java.version>
<revision>0.0.1</revision>
<changelist>-SNAPSHOT</changelist>
<sha1/>
</properties>
<build>
<directory>${project.basedir}/target</directory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>rpm-maven-plugin</artifactId>
<version>2.2.0</version>
<extensions>true</extensions>
<executions>
<execution>
<id>default-rpm</id>
<goals>
<goal>rpm</goal>
</goals>
<phase>package</phase>
</execution>
</executions>
<configuration>
<summary>${project.groupId}-${project.artifactId}</summary>
<name>${project.groupId}-${project.artifactId}</name>
<version>${project.version}</version>
<release>${env.BUILD_ID}</release>
<license>Proprietary</license>
<distribution>teragrep Log Management Suite</distribution>
<vendor>https://teragrep.com/</vendor>
<packager>teragrep &lt;[email protected]&gt;</packager>
<group>teragrep/LogManagementSuite</group>
<needarch>false</needarch>
<defaultUsername>root</defaultUsername>
<defaultGroupname>root</defaultGroupname>
<defaultFilemode>0644</defaultFilemode>
<defaultDirmode>0755</defaultDirmode>
<defineStatements>
<defineStatement>_build_id_links none</defineStatement>
<defineStatement>__provides_exclude ^osgi\\(.*$</defineStatement>
<defineStatement>__requires_exclude ^osgi\\(.*$</defineStatement>
</defineStatements>
<mappings>
<mapping>
<directory>/opt/teragrep/${project.artifactId}/lib</directory>
<directoryIncluded>true</directoryIncluded>
<filemode>755</filemode>
<dirmode>755</dirmode>
<username>root</username>
<groupname>root</groupname>
<recurseDirectories>true</recurseDirectories>
<sources>
<source>
<location>${project.basedir}/../target/pth_10.jar</location>
<destination>pth_10-shaded.jar</destination>
</source>
</sources>
</mapping>
</mappings>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<executions>
<execution>
<id>default-compile</id>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<skipMain>true</skipMain>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

0 comments on commit 3d7c269

Please sign in to comment.