Skip to content

Commit 5890b2a

Browse files
authored
Update CI to deploy SNAPSHOTs (#4)
Update CI to deploy -SNAPSHOTs from main branch
1 parent c699df6 commit 5890b2a

3 files changed

Lines changed: 172 additions & 41 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 -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

.github/workflows/maven-build.yml

Lines changed: 0 additions & 40 deletions
This file was deleted.

pom.xml

Lines changed: 116 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,47 @@
55
<artifactId>fa3st-codestyle</artifactId>
66
<version>1.0.0-SNAPSHOT</version>
77
<name>FA³ST Codestyle</name>
8-
<description>Codestyle for FA³ST.</description>
8+
<description>Codestyle for Eclipse FA³ST.</description>
9+
<url>https://github.com/eclipse-fa3st/fa3st-codestyle</url>
10+
<inceptionYear>2024</inceptionYear>
11+
<licenses>
12+
<license>
13+
<name>Apache License, Version 2.0</name>
14+
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
15+
<distribution>repo</distribution>
16+
</license>
17+
</licenses>
18+
<developers>
19+
<developer>
20+
<id>mjacoby</id>
21+
<name>Michael Jacoby</name>
22+
<email>michael.jacoby@iosb.fraunhofer.de</email>
23+
<organization>Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V.</organization>
24+
<organizationUrl>https://www.iosb.fraunhofer.de/</organizationUrl>
25+
</developer>
26+
</developers>
27+
<scm>
28+
<connection>scm:git:git://github.com/eclipse-fa3st/fa3st-codestyle.git</connection>
29+
<developerConnection>scm:git:ssh://github.com:eclipse-fa3st/fa3st-codestyle.git</developerConnection>
30+
<tag>HEAD</tag>
31+
<url>https://github.com/eclipse-fa3st/fa3st-codestyle/tree/main</url>
32+
</scm>
33+
<issueManagement>
34+
<system>GitHub</system>
35+
<url>https://github.com/eclipse-fa3st/fa3st-codestyle/issues</url>
36+
</issueManagement>
937
<properties>
1038
<checkstyle.version>10.25.0</checkstyle.version>
39+
<maven.compiler.source>17</maven.compiler.source>
40+
<maven.compiler.target>17</maven.compiler.target>
41+
<maven.plugin.central-publishing.version>0.7.0</maven.plugin.central-publishing.version>
42+
<maven.plugin.compiler.version>3.13.0</maven.plugin.compiler.version>
43+
<maven.plugin.eclipse-jarsigner.version>1.5.2</maven.plugin.eclipse-jarsigner.version>
44+
<maven.plugin.gpg.version>3.2.7</maven.plugin.gpg.version>
45+
<maven.plugin.javadoc.version>3.11.2</maven.plugin.javadoc.version>
46+
<maven.plugin.source.version>3.3.1</maven.plugin.source.version>
1147
<maven.plugin.spotless.version>2.44.5</maven.plugin.spotless.version>
48+
<maven.plugin.spotless.version>2.44.4</maven.plugin.spotless.version>
1249
<resources.dir>${basedir}/src/main/resources</resources.dir>
1350
<sonar.skip>true</sonar.skip>
1451
</properties>
@@ -23,6 +60,11 @@
2360
<build>
2461
<pluginManagement>
2562
<plugins>
63+
<plugin>
64+
<groupId>org.apache.maven.plugins</groupId>
65+
<artifactId>maven-compiler-plugin</artifactId>
66+
<version>${maven.plugin.compiler.version}</version>
67+
</plugin>
2668
<plugin>
2769
<groupId>com.diffplug.spotless</groupId>
2870
<artifactId>spotless-maven-plugin</artifactId>
@@ -92,10 +134,83 @@
92134
</plugins>
93135
</pluginManagement>
94136
<plugins>
137+
<plugin>
138+
<groupId>org.apache.maven.plugins</groupId>
139+
<artifactId>maven-compiler-plugin</artifactId>
140+
</plugin>
95141
<plugin>
96142
<groupId>com.diffplug.spotless</groupId>
97143
<artifactId>spotless-maven-plugin</artifactId>
98144
</plugin>
99145
</plugins>
100146
</build>
147+
<profiles>
148+
<profile>
149+
<id>release</id>
150+
<properties>
151+
<maven.javadoc.skip>false</maven.javadoc.skip>
152+
<maven.test.skip>true</maven.test.skip>
153+
</properties>
154+
<build>
155+
<plugins>
156+
<plugin>
157+
<groupId>org.apache.maven.plugins</groupId>
158+
<artifactId>maven-source-plugin</artifactId>
159+
<version>${maven.plugin.source.version}</version>
160+
<executions>
161+
<execution>
162+
<id>attach-sources</id>
163+
<goals>
164+
<goal>jar-no-fork</goal>
165+
</goals>
166+
<phase>verify</phase>
167+
</execution>
168+
</executions>
169+
</plugin>
170+
<plugin>
171+
<groupId>org.apache.maven.plugins</groupId>
172+
<artifactId>maven-javadoc-plugin</artifactId>
173+
<version>${maven.plugin.javadoc.version}</version>
174+
<configuration>
175+
<quiet>true</quiet>
176+
</configuration>
177+
<executions>
178+
<execution>
179+
<id>attach-javadocs</id>
180+
<goals>
181+
<goal>aggregate-jar</goal>
182+
</goals>
183+
</execution>
184+
</executions>
185+
</plugin>
186+
<plugin>
187+
<groupId>org.apache.maven.plugins</groupId>
188+
<artifactId>maven-gpg-plugin</artifactId>
189+
<version>${maven.plugin.gpg.version}</version>
190+
<executions>
191+
<execution>
192+
<id>sign-artifacts</id>
193+
<goals>
194+
<goal>sign</goal>
195+
</goals>
196+
<phase>verify</phase>
197+
</execution>
198+
</executions>
199+
</plugin>
200+
<plugin>
201+
<groupId>org.sonatype.central</groupId>
202+
<artifactId>central-publishing-maven-plugin</artifactId>
203+
<version>${maven.plugin.central-publishing.version}</version>
204+
<extensions>true</extensions>
205+
<configuration>
206+
<publishingServerId>central</publishingServerId>
207+
<autoPublish>true</autoPublish>
208+
<waitUntil>published</waitUntil>
209+
<centralSnapshotsUrl>https://central.sonatype.com/repository/maven-snapshots/</centralSnapshotsUrl>
210+
</configuration>
211+
</plugin>
212+
</plugins>
213+
</build>
214+
</profile>
215+
</profiles>
101216
</project>

0 commit comments

Comments
 (0)