Skip to content

Commit 6d19962

Browse files
authored
Merge pull request #12 from reeyur/feature/release-to-central
Feature/release to central
2 parents a4c49fa + 3801a4b commit 6d19962

File tree

3 files changed

+148
-42
lines changed

3 files changed

+148
-42
lines changed

.github/workflows/release.yml

+10-5
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,21 @@ on:
77

88
jobs:
99
deploy:
10-
runs-on: ubuntu-latest
10+
runs-on: ubuntu-18.04
1111

1212
steps:
1313
- uses: actions/checkout@v1
1414
- name: Set up JDK 1.8
1515
uses: actions/setup-java@v1
1616
with:
1717
java-version: 1.8
18-
- name: Deploy to Github Package Registry
18+
- name: Deploy to The Central Respository
1919
env:
20-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
21-
run:
22-
mvn --settings settings.xml deploy
20+
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
21+
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
22+
GPG_EXECUTABLE: ${{ secrets.GPG_EXECUTABLE }}
23+
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
24+
GPG_SECRET_KEYS: ${{ secrets.GPG_SECRET_KEYS }}
25+
run: |
26+
echo "${GPG_SECRET_KEYS}" | gpg --batch --import
27+
mvn --settings settings.xml deploy -B -U -P release

pom.xml

+122-8
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,50 @@
55

66
<groupId>com.meituan.lyrebird.sdk</groupId>
77
<artifactId>lyrebird-java-client</artifactId>
8-
<version>1.0.1</version>
8+
<version>1.0.2</version>
9+
10+
<name>lyrebird-java-client</name>
11+
<url>https://github.com/Meituan-Dianping/lyrebird-java-client</url>
12+
<description>lyrebird java client is a Java SDK of Lyrebird</description>
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>hbqa</name>
24+
<email>[email protected]</email>
25+
<organization>Meituan-Dianping</organization>
26+
<organizationUrl>https://tech.meituan.com/</organizationUrl>
27+
</developer>
28+
</developers>
29+
30+
<scm>
31+
<connection>scm:git:git://github.com/Meituan-Dianping/lyrebird-java-client.git</connection>
32+
<developerConnection>scm:git:ssh://github.com:Meituan-Dianping/lyrebird-java-client.git</developerConnection>
33+
<url>https://github.com/Meituan-Dianping/lyrebird-java-client/tree/master</url>
34+
</scm>
35+
36+
<distributionManagement>
37+
<snapshotRepository>
38+
<id>ossrh</id>
39+
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
40+
</snapshotRepository>
41+
<repository>
42+
<id>ossrh</id>
43+
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2</url>
44+
</repository>
45+
</distributionManagement>
46+
47+
<properties>
48+
<java.version>1.8</java.version>
49+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
50+
</properties>
51+
952
<build>
1053
<plugins>
1154
<plugin>
@@ -19,13 +62,84 @@
1962
</plugins>
2063
</build>
2164

22-
<distributionManagement>
23-
<repository>
24-
<id>github</id>
25-
<name>GitHub Meituan-Dianping Apache Maven Packages</name>
26-
<url>https://maven.pkg.github.com/Meituan-Dianping/lyrebird-java-client</url>
27-
</repository>
28-
</distributionManagement>
65+
<profiles>
66+
<!-- Activate using the release property: mvn clean install -Prelease -->
67+
<profile>
68+
<id>release</id>
69+
<activation>
70+
<property>
71+
<name>release</name>
72+
</property>
73+
</activation>
74+
<build>
75+
<plugins>
76+
<plugin>
77+
<groupId>org.apache.maven.plugins</groupId>
78+
<artifactId>maven-source-plugin</artifactId>
79+
<version>2.2.1</version>
80+
<executions>
81+
<execution>
82+
<id>attach-sources</id>
83+
<goals>
84+
<goal>jar-no-fork</goal>
85+
</goals>
86+
</execution>
87+
</executions>
88+
</plugin>
89+
<plugin>
90+
<groupId>org.apache.maven.plugins</groupId>
91+
<artifactId>maven-javadoc-plugin</artifactId>
92+
<version>2.9.1</version>
93+
<executions>
94+
<execution>
95+
<id>attach-javadocs</id>
96+
<goals>
97+
<goal>jar</goal>
98+
</goals>
99+
</execution>
100+
</executions>
101+
</plugin>
102+
<plugin>
103+
<groupId>org.apache.maven.plugins</groupId>
104+
<artifactId>maven-gpg-plugin</artifactId>
105+
<version>1.5</version>
106+
<executions>
107+
<execution>
108+
<id>sign-artifacts</id>
109+
<phase>verify</phase>
110+
<goals>
111+
<goal>sign</goal>
112+
</goals>
113+
<!-- gpg: signing failed: No such file or directory -->
114+
<configuration>
115+
<gpgArguments>
116+
<arg>--pinentry-mode</arg>
117+
<arg>loopback</arg>
118+
</gpgArguments>
119+
</configuration>
120+
</execution>
121+
</executions>
122+
</plugin>
123+
<plugin>
124+
<groupId>org.sonatype.plugins</groupId>
125+
<artifactId>nexus-staging-maven-plugin</artifactId>
126+
<version>1.6.7</version>
127+
<extensions>true</extensions>
128+
<configuration>
129+
<serverId>ossrh</serverId>
130+
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
131+
<autoReleaseAfterClose>true</autoReleaseAfterClose>
132+
</configuration>
133+
</plugin>
134+
<plugin>
135+
<groupId>org.apache.maven.plugins</groupId>
136+
<artifactId>maven-release-plugin</artifactId>
137+
<version>2.4.2</version>
138+
</plugin>
139+
</plugins>
140+
</build>
141+
</profile>
142+
</profiles>
29143

30144
<dependencies>
31145
<dependency>

settings.xml

+16-29
Original file line numberDiff line numberDiff line change
@@ -2,38 +2,25 @@
22
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
33
http://maven.apache.org/xsd/settings-1.0.0.xsd">
44

5-
<activeProfiles>
6-
<activeProfile>github</activeProfile>
7-
</activeProfiles>
5+
<servers>
6+
<server>
7+
<!-- Maven Central Deployment -->
8+
<id>ossrh</id>
9+
<username>${env.SONATYPE_USERNAME}</username>
10+
<password>${env.SONATYPE_PASSWORD}</password>
11+
</server>
12+
</servers>
813

914
<profiles>
1015
<profile>
11-
<id>github</id>
12-
<repositories>
13-
<repository>
14-
<id>central</id>
15-
<url>https://repo1.maven.org/maven2</url>
16-
<releases>
17-
<enabled>true</enabled>
18-
</releases>
19-
<snapshots>
20-
<enabled>true</enabled>
21-
</snapshots>
22-
</repository>
23-
<repository>
24-
<id>github</id>
25-
<name>GitHub Meituan-Dianping Apache Maven Packages</name>
26-
<url>https://maven.pkg.github.com/Meituan-Dianping</url>
27-
</repository>
28-
</repositories>
16+
<id>ossrh</id>
17+
<activation>
18+
<activeByDefault>true</activeByDefault>
19+
</activation>
20+
<properties>
21+
<gpg.executable>${env.GPG_EXECUTABLE}</gpg.executable>
22+
<gpg.passphrase>${env.GPG_PASSPHRASE}</gpg.passphrase>
23+
</properties>
2924
</profile>
3025
</profiles>
31-
32-
<servers>
33-
<server>
34-
<id>github</id>
35-
<username>X-Auth-Token</username>
36-
<password>${env.GITHUB_TOKEN}</password>
37-
</server>
38-
</servers>
3926
</settings>

0 commit comments

Comments
 (0)