Skip to content

Commit 3d7c269

Browse files
Create profile for shaded jar, create rpm and bundle shaded jar there (#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
1 parent 38bf894 commit 3d7c269

5 files changed

Lines changed: 146 additions & 0 deletions

File tree

.github/workflows/upload_release.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,13 @@ jobs:
5959
env:
6060
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6161
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
62+
63+
- name: Publish shaded jar as RPM to GitHub Assets
64+
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
65+
env:
66+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
67+
68+
- name: Attach rpm to release
69+
uses: softprops/action-gh-release@v1
70+
with:
71+
files: rpm/target/rpm/com.teragrep-pth_10/RPMS/noarch/com.teragrep-pth_10-*.noarch.rpm

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@
99
fuzzer/**
1010
output.log
1111
.project
12+
dependency-reduced-pom.xml

pom.xml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,7 @@
409409
<exclude>toolchains.xml</exclude>
410410
<exclude>settings.xml</exclude>
411411
<exclude>dependencies.settings.xml</exclude>
412+
<exclude>rpm/rpm.pom.xml</exclude>
412413
<!-- readme -->
413414
<exclude>README.adoc</exclude>
414415
<exclude>README.md</exclude>
@@ -614,5 +615,28 @@
614615
</plugins>
615616
</build>
616617
</profile>
618+
<profile>
619+
<id>build-shaded-jar</id>
620+
<build>
621+
<plugins>
622+
<plugin>
623+
<groupId>org.apache.maven.plugins</groupId>
624+
<artifactId>maven-shade-plugin</artifactId>
625+
<version>3.5.1</version>
626+
<executions>
627+
<execution>
628+
<goals>
629+
<goal>shade</goal>
630+
</goals>
631+
<phase>package</phase>
632+
<configuration>
633+
<shadedClassifierName>shaded</shadedClassifierName>
634+
</configuration>
635+
</execution>
636+
</executions>
637+
</plugin>
638+
</plugins>
639+
</build>
640+
</profile>
617641
</profiles>
618642
</project>

rpm/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/target

rpm/rpm.pom.xml

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<packaging>rpm</packaging>
6+
<modelVersion>4.0.0</modelVersion>
7+
<artifactId>pth_10</artifactId>
8+
<version>${revision}${sha1}${changelist}</version>
9+
<name>pth_10</name>
10+
<description>pth_10</description>
11+
<groupId>com.teragrep</groupId>
12+
<properties>
13+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
14+
<maven.compiler.source>1.8</maven.compiler.source>
15+
<maven.compiler.target>1.8</maven.compiler.target>
16+
<java.version>1.8</java.version>
17+
<revision>0.0.1</revision>
18+
<changelist>-SNAPSHOT</changelist>
19+
<sha1/>
20+
</properties>
21+
<build>
22+
<directory>${project.basedir}/target</directory>
23+
<plugins>
24+
<plugin>
25+
<groupId>org.apache.maven.plugins</groupId>
26+
<artifactId>maven-surefire-plugin</artifactId>
27+
<configuration>
28+
<skipTests>true</skipTests>
29+
</configuration>
30+
</plugin>
31+
<plugin>
32+
<groupId>org.codehaus.mojo</groupId>
33+
<artifactId>rpm-maven-plugin</artifactId>
34+
<version>2.2.0</version>
35+
<extensions>true</extensions>
36+
<executions>
37+
<execution>
38+
<id>default-rpm</id>
39+
<goals>
40+
<goal>rpm</goal>
41+
</goals>
42+
<phase>package</phase>
43+
</execution>
44+
</executions>
45+
<configuration>
46+
<summary>${project.groupId}-${project.artifactId}</summary>
47+
<name>${project.groupId}-${project.artifactId}</name>
48+
<version>${project.version}</version>
49+
<release>${env.BUILD_ID}</release>
50+
<license>Proprietary</license>
51+
<distribution>teragrep Log Management Suite</distribution>
52+
<vendor>https://teragrep.com/</vendor>
53+
<packager>teragrep &lt;[email protected]&gt;</packager>
54+
<group>teragrep/LogManagementSuite</group>
55+
<needarch>false</needarch>
56+
<defaultUsername>root</defaultUsername>
57+
<defaultGroupname>root</defaultGroupname>
58+
<defaultFilemode>0644</defaultFilemode>
59+
<defaultDirmode>0755</defaultDirmode>
60+
<defineStatements>
61+
<defineStatement>_build_id_links none</defineStatement>
62+
<defineStatement>__provides_exclude ^osgi\\(.*$</defineStatement>
63+
<defineStatement>__requires_exclude ^osgi\\(.*$</defineStatement>
64+
</defineStatements>
65+
<mappings>
66+
<mapping>
67+
<directory>/opt/teragrep/${project.artifactId}/lib</directory>
68+
<directoryIncluded>true</directoryIncluded>
69+
<filemode>755</filemode>
70+
<dirmode>755</dirmode>
71+
<username>root</username>
72+
<groupname>root</groupname>
73+
<recurseDirectories>true</recurseDirectories>
74+
<sources>
75+
<source>
76+
<location>${project.basedir}/../target/pth_10.jar</location>
77+
<destination>pth_10-shaded.jar</destination>
78+
</source>
79+
</sources>
80+
</mapping>
81+
</mappings>
82+
</configuration>
83+
</plugin>
84+
<plugin>
85+
<groupId>org.apache.maven.plugins</groupId>
86+
<artifactId>maven-deploy-plugin</artifactId>
87+
<version>2.8.2</version>
88+
<configuration>
89+
<skip>true</skip>
90+
</configuration>
91+
</plugin>
92+
<plugin>
93+
<groupId>org.apache.maven.plugins</groupId>
94+
<artifactId>maven-compiler-plugin</artifactId>
95+
<executions>
96+
<execution>
97+
<id>default-compile</id>
98+
<phase>compile</phase>
99+
<goals>
100+
<goal>compile</goal>
101+
</goals>
102+
<configuration>
103+
<skipMain>true</skipMain>
104+
</configuration>
105+
</execution>
106+
</executions>
107+
</plugin>
108+
</plugins>
109+
</build>
110+
</project>

0 commit comments

Comments
 (0)