Skip to content

Commit 6641879

Browse files
committed
update CI
1 parent 42ab196 commit 6641879

3 files changed

Lines changed: 220 additions & 16 deletions

File tree

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Build and Deploy SNAPSHOT
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
# Allows you to run this workflow manually from the Actions tab
9+
workflow_dispatch:
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout Source
16+
uses: actions/checkout@v4
17+
18+
- name: Cache maven repository
19+
uses: actions/cache@v4
20+
with:
21+
path: |
22+
~/.m2/repository
23+
~/.sonar/cache
24+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
25+
restore-keys: ${{ runner.os }}-maven
26+
27+
- name: Set up JDK and Caching
28+
uses: actions/setup-java@v4
29+
with:
30+
distribution: 'temurin'
31+
java-version: 17
32+
cache: 'maven'
33+
cache-dependency-path: 'pom.xml'
34+
server-id: central
35+
server-username: MAVEN_USERNAME
36+
server-password: MAVEN_PASSWORD
37+
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
38+
gpg-passphrase: MAVEN_GPG_PASSPHRASE
39+
40+
- name: Build with Maven
41+
run: |
42+
mvn verify -P ci -B
43+
44+
- name: Set env variables
45+
run: |
46+
echo "Exporting Variables"
47+
export version=$(mvn -Dexec.executable='echo' -Dexec.args='${project.version}' --non-recursive exec:exec -q)
48+
echo "VERSION=${version}" >> $GITHUB_ENV
49+
50+
- name: Deploy SNAPSHOTS
51+
if: ${{ endsWith(env.VERSION, '-SNAPSHOT') }}
52+
env:
53+
MAVEN_USERNAME: ${{ secrets.CENTRAL_SONATYPE_TOKEN_USERNAME }}
54+
MAVEN_PASSWORD: ${{ secrets.CENTRAL_SONATYPE_TOKEN_PASSWORD }}
55+
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
56+
run: mvn clean deploy -P release -B
Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
name: Build
1+
name: Build Pull Request
22

33
on:
4-
push:
5-
branches:
6-
- main
7-
pull_request:
8-
branches:
9-
- "*"
4+
pull_request_target:
5+
types:
6+
- opened
7+
- synchronize
108

119
# Allows you to run this workflow manually from the Actions tab
1210
workflow_dispatch:
@@ -15,8 +13,17 @@ jobs:
1513
build:
1614
runs-on: ubuntu-latest
1715
steps:
18-
- name: Checkout Source
16+
17+
# Checkout the base repository's code
18+
- name: Checkout base repository
19+
uses: actions/checkout@v4
20+
21+
# Explicitly check out the pull request's head branch
22+
- name: Checkout pull request code
1923
uses: actions/checkout@v4
24+
with:
25+
ref: ${{ github.event.pull_request.head.ref }}
26+
repository: ${{ github.event.pull_request.head.repo.full_name }}
2027

2128
- name: Cache maven repository
2229
uses: actions/cache@v4
@@ -37,4 +44,4 @@ jobs:
3744

3845
- name: Build with Maven
3946
run: |
40-
mvn verify -B
47+
mvn verify -P ci -B

pom.xml

Lines changed: 148 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@
2121
</licenses>
2222
<developers>
2323
<developer>
24-
<name>Maximilian Kühn</name>
25-
<email>maximilian.kuehn@iosb.fraunhofer.de</email>
26-
<organization>Fraunhofer IOSB</organization>
24+
<name>Michael Jacoby</name>
25+
<email>michael.jacoby@iosb.fraunhofer.de</email>
26+
<organization>Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V.</organization>
2727
<organizationUrl>https://www.iosb.fraunhofer.de</organizationUrl>
2828
</developer>
2929
<developer>
30-
<name>Michael Jacoby</name>
31-
<email>michael.jacoby@iosb.fraunhofer.de</email>
32-
<organization>Fraunhofer IOSB</organization>
30+
<name>Maximilian Kühn</name>
31+
<email>maximilian.kuehn@iosb.fraunhofer.de</email>
32+
<organization>Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V.</organization>
3333
<organizationUrl>https://www.iosb.fraunhofer.de</organizationUrl>
3434
</developer>
3535
</developers>
@@ -43,7 +43,6 @@
4343
<system>GitHub</system>
4444
<url>https://github.com/eclipse-fa3st/fa3st-client/issues</url>
4545
</issueManagement>
46-
<properties></properties>
4746
<dependencies>
4847
<dependency>
4948
<groupId>commons-fileupload</groupId>
@@ -82,4 +81,146 @@
8281
<artifactId>wiremock-jetty12</artifactId>
8382
</dependency>
8483
</dependencies>
84+
<repositories>
85+
<repository>
86+
<releases>
87+
<enabled>true</enabled>
88+
</releases>
89+
<snapshots>
90+
<enabled>false</enabled>
91+
</snapshots>
92+
<id>bintray</id>
93+
<url>https://jcenter.bintray.com</url>
94+
</repository>
95+
<repository>
96+
<snapshots>
97+
<enabled>true</enabled>
98+
</snapshots>
99+
<id>central</id>
100+
<url>https://central.sonatype.com/repository/maven-snapshots/</url>
101+
</repository>
102+
</repositories>
103+
<pluginRepositories>
104+
<pluginRepository>
105+
<snapshots>
106+
<enabled>true</enabled>
107+
</snapshots>
108+
<id>dash-licenses-snapshots</id>
109+
<url>https://repo.eclipse.org/content/repositories/dash-licenses-snapshots/</url>
110+
</pluginRepository>
111+
<pluginRepository>
112+
<snapshots>
113+
<enabled>true</enabled>
114+
</snapshots>
115+
<id>maven-central</id>
116+
<url>https://repo.maven.apache.org/maven2</url>
117+
</pluginRepository>
118+
</pluginRepositories>
119+
<profiles>
120+
<profile>
121+
<id>ci</id>
122+
<build>
123+
<plugins>
124+
<plugin>
125+
<groupId>org.eclipse.dash</groupId>
126+
<artifactId>license-tool-plugin</artifactId>
127+
<version>${maven.plugin.dash.version}</version>
128+
<executions>
129+
<execution>
130+
<id>license-check</id>
131+
<goals>
132+
<goal>license-check</goal>
133+
</goals>
134+
</execution>
135+
</executions>
136+
</plugin>
137+
</plugins>
138+
</build>
139+
</profile>
140+
<profile>
141+
<id>release</id>
142+
<properties>
143+
<maven.javadoc.skip>false</maven.javadoc.skip>
144+
<maven.test.skip>true</maven.test.skip>
145+
</properties>
146+
<build>
147+
<plugins>
148+
<plugin>
149+
<groupId>org.apache.maven.plugins</groupId>
150+
<artifactId>maven-source-plugin</artifactId>
151+
<version>${maven.plugin.source.version}</version>
152+
<executions>
153+
<execution>
154+
<id>attach-sources</id>
155+
<goals>
156+
<goal>jar-no-fork</goal>
157+
</goals>
158+
<phase>verify</phase>
159+
</execution>
160+
</executions>
161+
</plugin>
162+
<plugin>
163+
<groupId>org.apache.maven.plugins</groupId>
164+
<artifactId>maven-javadoc-plugin</artifactId>
165+
<version>${maven.plugin.javadoc.version}</version>
166+
<inherited>false</inherited>
167+
<configuration>
168+
<quiet>true</quiet>
169+
<sourceFileExcludes>**/generated-sources/*</sourceFileExcludes>
170+
<sourcepath>${project.build.directory}/target</sourcepath>
171+
</configuration>
172+
<executions>
173+
<execution>
174+
<id>attach-javadocs</id>
175+
<goals>
176+
<goal>aggregate-jar</goal>
177+
</goals>
178+
</execution>
179+
</executions>
180+
</plugin>
181+
<plugin>
182+
<groupId>org.apache.maven.plugins</groupId>
183+
<artifactId>maven-gpg-plugin</artifactId>
184+
<version>${maven.plugin.gpg.version}</version>
185+
<executions>
186+
<execution>
187+
<id>sign-artifacts</id>
188+
<goals>
189+
<goal>sign</goal>
190+
</goals>
191+
<phase>verify</phase>
192+
</execution>
193+
</executions>
194+
</plugin>
195+
<plugin>
196+
<groupId>org.sonatype.central</groupId>
197+
<artifactId>central-publishing-maven-plugin</artifactId>
198+
<version>${maven.plugin.central-publishing.version}</version>
199+
<extensions>true</extensions>
200+
<configuration>
201+
<publishingServerId>central</publishingServerId>
202+
<autoPublish>true</autoPublish>
203+
<waitUntil>published</waitUntil>
204+
<centralSnapshotsUrl>https://central.sonatype.com/repository/maven-snapshots/</centralSnapshotsUrl>
205+
</configuration>
206+
</plugin>
207+
</plugins>
208+
</build>
209+
</profile>
210+
<profile>
211+
<id>owasp</id>
212+
<properties>
213+
<maven.javadoc.skip>true</maven.javadoc.skip>
214+
<maven.test.skip>true</maven.test.skip>
215+
</properties>
216+
<build>
217+
<plugins>
218+
<plugin>
219+
<groupId>org.owasp</groupId>
220+
<artifactId>dependency-check-maven</artifactId>
221+
</plugin>
222+
</plugins>
223+
</build>
224+
</profile>
225+
</profiles>
85226
</project>

0 commit comments

Comments
 (0)