Skip to content

Commit 3d64ea7

Browse files
committed
Added deploy workflow
1 parent 23a6dc9 commit 3d64ea7

File tree

4 files changed

+104
-2
lines changed

4 files changed

+104
-2
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@ jobs:
2828
${{ runner.os }}-maven-
2929
3030
- name: Build
31-
run: mvn -B package --file pom.xml
31+
run: mvn -B clean package --file pom.xml

.github/workflows/deploy.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Deploy
2+
3+
on:
4+
release:
5+
types: [created]
6+
7+
jobs:
8+
deploy:
9+
runs-on: ubuntu-latest
10+
steps:
11+
12+
- name: Checkout
13+
uses: actions/checkout@v2
14+
15+
- name: Set up Java
16+
uses: actions/setup-java@v1
17+
with:
18+
java-version: 1.8
19+
server-id: ossrh
20+
server-username: MAVEN_USERNAME
21+
server-password: MAVEN_PASSWORD
22+
23+
- name: Cache
24+
uses: actions/cache@v2
25+
with:
26+
path: ~/.m2/repository
27+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
28+
restore-keys: |
29+
${{ runner.os }}-maven-
30+
31+
- name: Set up GPG secret key
32+
run: cat <(echo -e "${{ secrets.OSSRH_GPG_SECRET_KEY }}") | gpg --batch --import
33+
34+
- name: Build
35+
run: mvn -B package --file pom.xml
36+
37+
- name: Publish
38+
run: mvn -Dgpg.passphrase=${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }} clean deploy
39+
env:
40+
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
41+
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}

example/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
</executions>
6767
<dependencies>
6868
<dependency>
69-
<groupId>com.github.hectorbst.jsonschema2pojo</groupId>
69+
<groupId>io.github.hectorbst</groupId>
7070
<artifactId>jsonschema2pojo-spring-data-couchbase</artifactId>
7171
<version>${jsonschema2pojo-spring-data-couchbase.version}</version>
7272
</dependency>

pom.xml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@
4444
<spring-boot.version>2.3.4.RELEASE</spring-boot.version>
4545
<junit.version>5.7.0</junit.version>
4646
<assertj.version>3.17.2</assertj.version>
47+
<maven-source-plugin.version>3.2.1</maven-source-plugin.version>
48+
<maven-javadoc-plugin.version>3.2.0</maven-javadoc-plugin.version>
49+
<maven-gpg-plugin.version>1.6</maven-gpg-plugin.version>
4750
</properties>
4851

4952
<dependencies>
@@ -139,6 +142,64 @@
139142
</execution>
140143
</executions>
141144
</plugin>
145+
146+
<plugin>
147+
<groupId>org.apache.maven.plugins</groupId>
148+
<artifactId>maven-source-plugin</artifactId>
149+
<version>${maven-source-plugin.version}</version>
150+
<executions>
151+
<execution>
152+
<id>attach-sources</id>
153+
<goals>
154+
<goal>jar-no-fork</goal>
155+
</goals>
156+
</execution>
157+
</executions>
158+
</plugin>
159+
<plugin>
160+
<groupId>org.apache.maven.plugins</groupId>
161+
<artifactId>maven-javadoc-plugin</artifactId>
162+
<version>${maven-javadoc-plugin.version}</version>
163+
<executions>
164+
<execution>
165+
<id>attach-javadocs</id>
166+
<goals>
167+
<goal>jar</goal>
168+
</goals>
169+
</execution>
170+
</executions>
171+
</plugin>
172+
<plugin>
173+
<groupId>org.apache.maven.plugins</groupId>
174+
<artifactId>maven-gpg-plugin</artifactId>
175+
<version>${maven-gpg-plugin.version}</version>
176+
<executions>
177+
<execution>
178+
<id>sign-artifacts</id>
179+
<phase>verify</phase>
180+
<goals>
181+
<goal>sign</goal>
182+
</goals>
183+
<configuration>
184+
<gpgArguments>
185+
<arg>--pinentry-mode</arg>
186+
<arg>loopback</arg>
187+
</gpgArguments>
188+
</configuration>
189+
</execution>
190+
</executions>
191+
</plugin>
142192
</plugins>
143193
</build>
194+
195+
<distributionManagement>
196+
<snapshotRepository>
197+
<id>ossrh</id>
198+
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
199+
</snapshotRepository>
200+
<repository>
201+
<id>ossrh</id>
202+
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2</url>
203+
</repository>
204+
</distributionManagement>
144205
</project>

0 commit comments

Comments
 (0)