Skip to content

Commit 553d76e

Browse files
authored
config auto deploy workflow (#25)
1 parent 8ee9310 commit 553d76e

File tree

6 files changed

+154
-19
lines changed

6 files changed

+154
-19
lines changed

.github/workflows/deploy_release.yml

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# This workflow will build a Java project with Maven
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
3+
4+
name: release
5+
6+
on:
7+
release:
8+
types: published
9+
10+
jobs:
11+
build:
12+
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v2
17+
- name: Set up JDK 1.8
18+
uses: actions/setup-java@v1
19+
with:
20+
java-version: 1.8
21+
22+
- name: Cache the Maven packages to speed up build
23+
uses: actions/cache@v2
24+
with:
25+
path: ~/.m2/repository
26+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
27+
restore-keys: ${{ runner.os }}-maven-
28+
29+
- name: Deploy SNAPSHOT to Sonatype
30+
uses: samuelmeuli/action-maven-publish@v1
31+
with:
32+
gpg_private_key: ${{ secrets.JAVA_GPG_PRIVATE_KEY }}
33+
gpg_passphrase: ${{ secrets.JAVA_GPG_PASSPHRASE }}
34+
nexus_username: ${{ secrets.OSSRH_USERNAME }}
35+
nexus_password: ${{ secrets.OSSRH_TOKEN }}

.github/workflows/deploy_snapshot.yml

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# This workflow will build a Java project with Maven
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
3+
4+
name: snapshot
5+
6+
on:
7+
push:
8+
branches: [ master ]
9+
schedule:
10+
- cron: '0 6 * * *'
11+
12+
jobs:
13+
build:
14+
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- uses: actions/checkout@v2
19+
- name: Set up JDK 1.8
20+
uses: actions/setup-java@v1
21+
with:
22+
java-version: 1.8
23+
24+
- name: Cache the Maven packages to speed up build
25+
uses: actions/cache@v2
26+
with:
27+
path: ~/.m2/repository
28+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
29+
restore-keys: ${{ runner.os }}-maven-
30+
31+
- name: Deploy SNAPSHOT to Sonatype
32+
uses: samuelmeuli/action-maven-publish@v1
33+
with:
34+
gpg_private_key: ${{ secrets.JAVA_GPG_PRIVATE_KEY }}
35+
gpg_passphrase: ${{ secrets.JAVA_GPG_PASSPHRASE }}
36+
nexus_username: ${{ secrets.OSSRH_USERNAME }}
37+
nexus_password: ${{ secrets.OSSRH_TOKEN }}

.github/workflows/maven.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# This workflow will build a Java project with Maven
22
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
33

4-
name: Java CI with Maven
4+
name: pull_request
55

66
on:
77
push:

example/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
44
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
55
<parent>
6-
<artifactId>nebula-spark</artifactId>
6+
<artifactId>algorithm</artifactId>
77
<groupId>com.vesoft</groupId>
88
<version>2.5-SNAPSHOT</version>
99
<relativePath>../pom.xml</relativePath>

nebula-algorithm/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
55
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
66
<parent>
7-
<artifactId>nebula-spark</artifactId>
7+
<artifactId>algorithm</artifactId>
88
<groupId>com.vesoft</groupId>
99
<version>2.5-SNAPSHOT</version>
1010
<relativePath>../pom.xml</relativePath>

pom.xml

+79-16
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<modelVersion>4.0.0</modelVersion>
66

77
<groupId>com.vesoft</groupId>
8-
<artifactId>nebula-spark</artifactId>
8+
<artifactId>algorithm</artifactId>
99
<packaging>pom</packaging>
1010
<version>2.5-SNAPSHOT</version>
1111

@@ -51,29 +51,92 @@
5151

5252
<distributionManagement>
5353
<repository>
54-
<id>release</id>
55-
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
54+
<id>ossrh</id>
55+
<name>Nexus Release Repository</name>
56+
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2</url>
5657
</repository>
5758
<snapshotRepository>
58-
<id>snapshots</id>
59-
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
59+
<id>ossrh</id>
60+
<name>Nexus Snapshot Repository</name>
61+
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
6062
</snapshotRepository>
6163
</distributionManagement>
6264

65+
<profiles>
66+
<!-- Deployment profile (required so these plugins are only used when deploying) -->
67+
<profile>
68+
<id>deploy</id>
69+
<build>
70+
<plugins>
71+
<!-- Source plugin -->
72+
<plugin>
73+
<groupId>org.apache.maven.plugins</groupId>
74+
<artifactId>maven-source-plugin</artifactId>
75+
<version>3.2.0</version>
76+
<executions>
77+
<execution>
78+
<id>attach-sources</id>
79+
<goals>
80+
<goal>jar-no-fork</goal>
81+
</goals>
82+
</execution>
83+
</executions>
84+
</plugin>
85+
<!-- Javadoc plugin -->
86+
<plugin>
87+
<groupId>org.apache.maven.plugins</groupId>
88+
<artifactId>maven-javadoc-plugin</artifactId>
89+
<version>3.2.0</version>
90+
<executions>
91+
<execution>
92+
<id>attach-javadocs</id>
93+
<goals>
94+
<goal>jar</goal>
95+
</goals>
96+
</execution>
97+
</executions>
98+
</plugin>
99+
100+
<!-- GPG plugin -->
101+
<plugin>
102+
<groupId>org.apache.maven.plugins</groupId>
103+
<artifactId>maven-gpg-plugin</artifactId>
104+
<version>1.6</version>
105+
<executions>
106+
<execution>
107+
<id>sign-artifacts</id>
108+
<phase>verify</phase>
109+
<goals>
110+
<goal>sign</goal>
111+
</goals>
112+
<configuration>
113+
<!-- Prevent `gpg` from using pinentry programs -->
114+
<gpgArguments>
115+
<arg>--pinentry-mode</arg>
116+
<arg>loopback</arg>
117+
</gpgArguments>
118+
</configuration>
119+
</execution>
120+
</executions>
121+
</plugin>
122+
</plugins>
123+
</build>
124+
</profile>
125+
</profiles>
126+
63127
<build>
64128
<plugins>
129+
<!-- Nexus Staging Plugin -->
65130
<plugin>
66-
<groupId>org.apache.maven.plugins</groupId>
67-
<artifactId>maven-gpg-plugin</artifactId>
68-
<version>1.6</version>
69-
<executions>
70-
<execution>
71-
<phase>verify</phase>
72-
<goals>
73-
<goal>sign</goal>
74-
</goals>
75-
</execution>
76-
</executions>
131+
<groupId>org.sonatype.plugins</groupId>
132+
<artifactId>nexus-staging-maven-plugin</artifactId>
133+
<version>1.6.8</version>
134+
<extensions>true</extensions>
135+
<configuration>
136+
<serverId>ossrh</serverId>
137+
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
138+
<autoReleaseAfterClose>true</autoReleaseAfterClose>
139+
</configuration>
77140
</plugin>
78141
</plugins>
79142
</build>

0 commit comments

Comments
 (0)