Skip to content

Commit 7985130

Browse files
authored
Merge pull request #4 from tejas-warake/feature/ci-cd
Configure Maven Central metadata and GitHub Actions workflows
2 parents ef66f60 + dedc069 commit 7985130

File tree

3 files changed

+143
-0
lines changed

3 files changed

+143
-0
lines changed

.github/workflows/ci.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: JAVA CI
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v3
15+
- name: Set up JDK 17
16+
uses: actions/setup-java@v3
17+
with:
18+
java-version: '17'
19+
distribution: 'temurin'
20+
cache: maven
21+
- name: Build with Maven
22+
run: mvn -B verify --file pom.xml

.github/workflows/publish.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Publish to Maven Central
2+
3+
on:
4+
release:
5+
types: [created]
6+
7+
jobs:
8+
publish:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v3
12+
- name: Set up JDK 17
13+
uses: actions/setup-java@v3
14+
with:
15+
java-version: '17'
16+
distribution: 'temurin'
17+
server-id: central
18+
server-username: MAVEN_USERNAME
19+
server-password: MAVEN_PASSWORD
20+
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
21+
gpg-passphrase: ${{ secrets.GPG_PASSPHRASE }}
22+
23+
- name: Publish to Maven Central
24+
run: mvn -B deploy -P release --file pom.xml
25+
env:
26+
MAVEN_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
27+
MAVEN_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}

pom.xml

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,35 @@
55
<artifactId>java-preprocessing-lib-parent</artifactId>
66
<packaging>pom</packaging>
77
<version>1.0.0-SNAPSHOT</version>
8+
9+
810
<name>Java Preprocessing Library Parent</name>
11+
<description>A lightweight Java library and Maven plugin for C++ style preprocessor directives.</description>
12+
<url>https://github.com/tejas-warake/java-preprocessing-lib</url>
13+
14+
<licenses>
15+
<license>
16+
<name>MIT License</name>
17+
<url>http://www.opensource.org/licenses/mit-license.php</url>
18+
</license>
19+
</licenses>
20+
21+
<developers>
22+
<developer>
23+
<name>Tejas Warake</name>
24+
<email>tejaswarake@example.com</email>
25+
<organization>Open Source</organization>
26+
<organizationUrl>https://github.com/tejas-warake</organizationUrl>
27+
</developer>
28+
</developers>
29+
30+
<scm>
31+
<connection>scm:git:git://github.com/tejas-warake/java-preprocessing-lib.git</connection>
32+
<developerConnection>scm:git:ssh://github.com:tejas-warake/java-preprocessing-lib.git</developerConnection>
33+
<url>https://github.com/tejas-warake/java-preprocessing-lib/tree/main</url>
34+
</scm>
35+
36+
937

1038
<modules>
1139
<module>preprocessor-core</module>
@@ -18,6 +46,72 @@
1846
<maven.compiler.target>1.8</maven.compiler.target>
1947
</properties>
2048

49+
<build>
50+
<plugins>
51+
<plugin>
52+
<groupId>org.sonatype.central</groupId>
53+
<artifactId>central-publishing-maven-plugin</artifactId>
54+
<version>0.1.2</version>
55+
<extensions>true</extensions>
56+
<configuration>
57+
<publishingServerId>central</publishingServerId>
58+
<tokenAuth>true</tokenAuth>
59+
<autoPublish>true</autoPublish>
60+
</configuration>
61+
</plugin>
62+
</plugins>
63+
</build>
64+
65+
<profiles>
66+
<profile>
67+
<id>release</id>
68+
<build>
69+
<plugins>
70+
<plugin>
71+
<groupId>org.apache.maven.plugins</groupId>
72+
<artifactId>maven-source-plugin</artifactId>
73+
<version>2.2.1</version>
74+
<executions>
75+
<execution>
76+
<id>attach-sources</id>
77+
<goals>
78+
<goal>jar-no-fork</goal>
79+
</goals>
80+
</execution>
81+
</executions>
82+
</plugin>
83+
<plugin>
84+
<groupId>org.apache.maven.plugins</groupId>
85+
<artifactId>maven-javadoc-plugin</artifactId>
86+
<version>2.9.1</version>
87+
<executions>
88+
<execution>
89+
<id>attach-javadocs</id>
90+
<goals>
91+
<goal>jar</goal>
92+
</goals>
93+
</execution>
94+
</executions>
95+
</plugin>
96+
<plugin>
97+
<groupId>org.apache.maven.plugins</groupId>
98+
<artifactId>maven-gpg-plugin</artifactId>
99+
<version>1.5</version>
100+
<executions>
101+
<execution>
102+
<id>sign-artifacts</id>
103+
<phase>verify</phase>
104+
<goals>
105+
<goal>sign</goal>
106+
</goals>
107+
</execution>
108+
</executions>
109+
</plugin>
110+
</plugins>
111+
</build>
112+
</profile>
113+
</profiles>
114+
21115
<dependencyManagement>
22116
<dependencies>
23117
<dependency>

0 commit comments

Comments
 (0)