Skip to content

Commit 55008c5

Browse files
authored
Merge pull request #75 from yunionio/fix-maven-release
fix(ci): publish to maven
2 parents c033ce9 + 13e4b90 commit 55008c5

2 files changed

Lines changed: 64 additions & 91 deletions

File tree

.github/workflows/maven.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,15 @@ jobs:
1616
with:
1717
distribution: 'temurin'
1818
java-version: 8
19-
server-id: ossrh
19+
server-id: central
2020
server-username: MAVEN_USERNAME
21-
server-password: MAVEN_PASSWORD
21+
server-password: MAVEN_CENTRAL_TOKEN
2222
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
2323
gpg-passphrase: MAVEN_GPG_PASSPHRASE
24+
2425
- name: Deploy with Maven
25-
run: mvn -B clean deploy -DskipTests -Pci-cd
26+
run: mvn -B clean deploy -DskipTests -PsonatypeDeploy
2627
env:
27-
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
28-
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
28+
MAVEN_USERNAME: ${{ secrets.NEXUS_USERNAME }}
29+
MAVEN_CENTRAL_TOKEN: ${{ secrets.NEXUS_PASSWORD }}
2930
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}

pom.xml

Lines changed: 58 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -76,94 +76,68 @@
7676
</dependencies>
7777

7878

79-
<distributionManagement>
80-
<snapshotRepository>
81-
<id>ossrh</id>
82-
<url>https://s01.oss.sonatype.org/content/repositories/snapshots/</url>
83-
</snapshotRepository>
84-
</distributionManagement>
85-
86-
<build>
87-
<plugins>
88-
<plugin>
89-
<groupId>org.sonatype.plugins</groupId>
90-
<artifactId>nexus-staging-maven-plugin</artifactId>
91-
<version>1.6.7</version>
92-
<extensions>true</extensions>
93-
<configuration>
94-
<serverId>ossrh</serverId>
95-
<nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
96-
<autoReleaseAfterClose>true</autoReleaseAfterClose>
97-
</configuration>
98-
</plugin>
99-
<plugin>
100-
<groupId>org.apache.maven.plugins</groupId>
101-
<artifactId>maven-source-plugin</artifactId>
102-
<version>3.3.0</version>
103-
<executions>
104-
<execution>
105-
<id>attach-sources</id>
106-
<goals>
107-
<goal>jar-no-fork</goal>
108-
</goals>
109-
</execution>
110-
</executions>
111-
</plugin>
112-
<plugin>
113-
<groupId>org.apache.maven.plugins</groupId>
114-
<artifactId>maven-javadoc-plugin</artifactId>
115-
<version>3.5.0</version>
116-
<executions>
117-
<execution>
118-
<id>attach-javadocs</id>
119-
<goals>
120-
<goal>jar</goal>
121-
</goals>
122-
<configuration>
123-
<show>public</show>
124-
<failOnError>false</failOnError>
125-
<detectOfflineLinks>false</detectOfflineLinks>
126-
<doclint>all,-missing</doclint>
127-
<nohelp>true</nohelp>
128-
<excludePackageNames>*.internal.*,testutil,demo</excludePackageNames>
129-
</configuration>
130-
</execution>
131-
</executions>
132-
<configuration>
133-
<failOnError>false</failOnError>
134-
<tags>
135-
<tag>
136-
<name>date</name>
137-
<placement>a</placement>
138-
<head>Written date:</head>
139-
</tag>
140-
</tags>
141-
</configuration>
142-
</plugin>
143-
<plugin>
144-
<groupId>org.apache.maven.plugins</groupId>
145-
<artifactId>maven-surefire-plugin</artifactId>
146-
<version>3.1.2</version>
147-
<configuration>
148-
<systemPropertyVariables>
149-
<testEnv>/opt/test_conf.properties</testEnv>
150-
</systemPropertyVariables>
151-
</configuration>
152-
</plugin>
153-
<plugin>
154-
<artifactId>maven-release-plugin</artifactId>
155-
<configuration>
156-
<tagNameFormat>v@{project.version}</tagNameFormat>
157-
</configuration>
158-
</plugin>
159-
</plugins>
160-
</build>
161-
16279
<profiles>
16380
<profile>
164-
<id>ci-cd</id>
81+
<!-- required, used in .github/workflows/sonatype-publish.yml -->
82+
<id>sonatypeDeploy</id>
16583
<build>
16684
<plugins>
85+
<plugin>
86+
<groupId>org.sonatype.central</groupId>
87+
<artifactId>central-publishing-maven-plugin</artifactId>
88+
<version>0.3.0</version>
89+
<extensions>true</extensions>
90+
<configuration>
91+
<publishingServerId>central</publishingServerId>
92+
<tokenAuth>true</tokenAuth>
93+
<autoPublish>true</autoPublish>
94+
<waitUntil>published</waitUntil>
95+
</configuration>
96+
</plugin>
97+
<plugin>
98+
<groupId>org.apache.maven.plugins</groupId>
99+
<artifactId>maven-source-plugin</artifactId>
100+
<version>3.3.0</version>
101+
<executions>
102+
<execution>
103+
<id>attach-sources</id>
104+
<goals>
105+
<goal>jar-no-fork</goal>
106+
</goals>
107+
</execution>
108+
</executions>
109+
</plugin>
110+
<plugin>
111+
<groupId>org.apache.maven.plugins</groupId>
112+
<artifactId>maven-javadoc-plugin</artifactId>
113+
<version>3.6.3</version>
114+
<executions>
115+
<execution>
116+
<id>attach-javadocs</id>
117+
<goals>
118+
<goal>jar</goal>
119+
</goals>
120+
<configuration>
121+
<show>public</show>
122+
<failOnError>false</failOnError>
123+
<detectOfflineLinks>false</detectOfflineLinks>
124+
<doclint>all,-missing</doclint>
125+
<nohelp>true</nohelp>
126+
<excludePackageNames>*.internal.*,testutil,demo</excludePackageNames>
127+
</configuration>
128+
</execution>
129+
</executions>
130+
<configuration>
131+
<failOnError>false</failOnError>
132+
<tags>
133+
<tag>
134+
<name>date</name>
135+
<placement>a</placement>
136+
<head>Written data:</head>
137+
</tag>
138+
</tags>
139+
</configuration>
140+
</plugin>
167141
<plugin>
168142
<groupId>org.apache.maven.plugins</groupId>
169143
<artifactId>maven-gpg-plugin</artifactId>
@@ -176,8 +150,6 @@
176150
<goal>sign</goal>
177151
</goals>
178152
<configuration>
179-
<!-- Prevent gpg from using pinentry programs. Fixes:
180-
gpg: signing failed: Inappropriate ioctl for device -->
181153
<gpgArguments>
182154
<arg>--pinentry-mode</arg>
183155
<arg>loopback</arg>

0 commit comments

Comments
 (0)