Skip to content

Commit e288521

Browse files
committed
ci: setup publish
1 parent 52580a2 commit e288521

File tree

3 files changed

+111
-25
lines changed

3 files changed

+111
-25
lines changed

.github/workflows/ci.yml

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,25 @@ jobs:
1818
steps:
1919
- uses: actions/checkout@v2
2020

21-
- name: Install Maven 3.8.x (instead of 3.9.x)
22-
run: |
23-
MAVEN_VERSION=3.8.9
24-
wget https://downloads.apache.org/maven/maven-3/$MAVEN_VERSION/binaries/apache-maven-$MAVEN_VERSION-bin.tar.gz
25-
tar xzvf apache-maven-$MAVEN_VERSION-bin.tar.gz
26-
sudo mv apache-maven-$MAVEN_VERSION /opt/maven
27-
sudo rm -f /usr/bin/mvn # Remove existing symbolic link if it exists
28-
sudo ln -s /opt/maven/bin/mvn /usr/bin/mvn # Create new symbolic link
29-
21+
# - name: Install Maven 3.8.x (instead of 3.9.x)
22+
# run: |
23+
# MAVEN_VERSION=3.8.9
24+
# wget https://downloads.apache.org/maven/maven-3/$MAVEN_VERSION/binaries/apache-maven-$MAVEN_VERSION-bin.tar.gz
25+
# tar xzvf apache-maven-$MAVEN_VERSION-bin.tar.gz
26+
# sudo mv apache-maven-$MAVEN_VERSION /opt/maven
27+
# sudo rm -f /usr/bin/mvn # Remove existing symbolic link if it exists
28+
# sudo ln -s /opt/maven/bin/mvn /usr/bin/mvn # Create new symbolic link
29+
30+
# - name: Setup java
31+
# uses: actions/setup-java@v1
32+
# with:
33+
# java-version: ${{ matrix.java }}
3034
- name: Setup java
31-
uses: actions/setup-java@v1
35+
uses: actions/setup-java@v4
3236
with:
3337
java-version: ${{ matrix.java }}
38+
distribution: 'zulu'
39+
cache: 'maven'
3440

3541
- name: Cache Maven packages
3642
uses: actions/cache@v4
@@ -45,4 +51,4 @@ jobs:
4551
node-version: 14.x
4652

4753
- name: Run the Maven verify phase
48-
run: mvn verify -Dgpg.skip=true
54+
run: mvn verify -Dgpg.skip=true --no-transfer-progress

.github/workflows/publish.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Publish to Maven Central
2+
3+
on:
4+
release:
5+
types: [created]
6+
workflow_dispatch:
7+
inputs:
8+
version:
9+
description: 'Version to publish'
10+
required: false
11+
12+
jobs:
13+
publish:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v4
19+
20+
- name: Set up JDK 8
21+
uses: actions/setup-java@v4
22+
with:
23+
java-version: '8'
24+
distribution: 'zulu'
25+
cache: 'maven'
26+
server-id: central
27+
server-username: MAVEN_USERNAME
28+
server-password: MAVEN_PASSWORD
29+
gpg-private-key: ${{ secrets.SIGNING_KEY }}
30+
gpg-passphrase: SIGNING_PASSWORD
31+
32+
- name: Set version (if provided)
33+
if: github.event.inputs.version != ''
34+
run: |
35+
mvn versions:set -DnewVersion=${{ github.event.inputs.version }} -DgenerateBackupPoms=false
36+
37+
- name: Build and publish
38+
env:
39+
MAVEN_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
40+
MAVEN_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
41+
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
42+
run: |
43+
mvn clean deploy \
44+
--no-transfer-progress \
45+
--batch-mode \
46+
# -DskipTests \
47+
# -Dgpg.keyname=${{ secrets.SIGNING_KEY_ID }} \
48+
# -Dgpg.passphrase=${{ secrets.SIGNING_PASSWORD }} \
49+
# -Dgpg.pinentry-mode=loopback \

pom.xml

Lines changed: 45 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
1-
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
1+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
23
<modelVersion>4.0.0</modelVersion>
3-
<groupId>io.socket</groupId>
4+
<groupId>io.github.robinpcrd</groupId>
45
<artifactId>socket.io-client</artifactId>
5-
<version>2.2.0-SNAPSHOT</version>
6+
<version>2.2.0</version>
67
<packaging>jar</packaging>
78
<name>socket.io-client</name>
8-
<description>Socket.IO Client Library for Java</description>
9-
<url>https://github.com/socketio/socket.io-client-java</url>
9+
<description>Socket.IO Client Library for Java (Fork)</description>
10+
<url>https://github.com/RobinPcrd/socket.io-client-java</url>
1011

12+
<!--
1113
<parent>
1214
<groupId>org.sonatype.oss</groupId>
1315
<artifactId>oss-parent</artifactId>
1416
<version>7</version>
1517
</parent>
18+
-->
1619

1720
<properties>
1821
<github.global.server>github</github.global.server>
@@ -27,9 +30,9 @@
2730
</licenses>
2831

2932
<scm>
30-
<url>https://github.com/socketio/socket.io-client-java</url>
31-
<connection>scm:git:https://github.com/socketio/socket.io-client-java.git</connection>
32-
<developerConnection>scm:git:https://github.com/socketio/socket.io-client-java.git</developerConnection>
33+
<url>https://github.com/RobinPcrd/socket.io-client-java</url>
34+
<connection>scm:git:https://github.com/RobinPcrd/socket.io-client-java.git</connection>
35+
<developerConnection>scm:git:https://github.com/RobinPcrd/socket.io-client-java.git</developerConnection>
3336
<tag>HEAD</tag>
3437
</scm>
3538

@@ -39,8 +42,14 @@
3942
<name>Naoyuki Kanezawa</name>
4043
<email>naoyuki.kanezawa@gmail.com</email>
4144
</developer>
45+
<developer>
46+
<id>robinpcrd</id>
47+
<name>Robin Picard</name>
48+
<email>robin.picard.dev@gmail.com</email>
49+
</developer>
4250
</developers>
4351

52+
<!--
4453
<repositories>
4554
<repository>
4655
<id>sonatype-oss-public</id>
@@ -53,9 +62,10 @@
5362
</snapshots>
5463
</repository>
5564
</repositories>
65+
-->
5666

5767
<prerequisites>
58-
<maven>3.0.4</maven>
68+
<maven>3.6.3</maven>
5969
</prerequisites>
6070

6171
<dependencies>
@@ -89,16 +99,18 @@
8999
</dependency>
90100
</dependencies>
91101

102+
<!--
92103
<distributionManagement>
93104
<snapshotRepository>
94-
<id>ossrh</id>
95-
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
105+
<id>central</id>
106+
<url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
96107
</snapshotRepository>
97108
<repository>
98-
<id>ossrh</id>
99-
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
109+
<id>central</id>
110+
<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
100111
</repository>
101112
</distributionManagement>
113+
-->
102114

103115
<build>
104116
<plugins>
@@ -129,6 +141,12 @@
129141
</goals>
130142
</execution>
131143
</executions>
144+
<configuration>
145+
<gpgArguments>
146+
<arg>--pinentry-mode</arg>
147+
<arg>loopback</arg>
148+
</gpgArguments>
149+
</configuration>
132150
</plugin>
133151
<plugin>
134152
<groupId>org.apache.maven.plugins</groupId>
@@ -167,17 +185,19 @@
167185
<goals>deploy</goals>
168186
</configuration>
169187
</plugin>
188+
<!--
170189
<plugin>
171190
<groupId>org.sonatype.plugins</groupId>
172191
<artifactId>nexus-staging-maven-plugin</artifactId>
173192
<version>1.6.7</version>
174193
<extensions>true</extensions>
175194
<configuration>
176-
<serverId>ossrh</serverId>
195+
<serverId>central</serverId>
177196
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
178197
<autoReleaseAfterClose>true</autoReleaseAfterClose>
179198
</configuration>
180199
</plugin>
200+
-->
181201
<plugin>
182202
<groupId>org.codehaus.mojo</groupId>
183203
<artifactId>exec-maven-plugin</artifactId>
@@ -247,6 +267,17 @@
247267
<showDeprecation>true</showDeprecation>
248268
</configuration>
249269
</plugin>
270+
<plugin>
271+
<groupId>org.sonatype.central</groupId>
272+
<artifactId>central-publishing-maven-plugin</artifactId>
273+
<version>0.6.0</version>
274+
<extensions>true</extensions>
275+
<configuration>
276+
<publishingServerId>central</publishingServerId>
277+
<autoPublish>true</autoPublish>
278+
<waitUntil>uploaded</waitUntil>
279+
</configuration>
280+
</plugin>
250281
</plugins>
251282
</build>
252283
</project>

0 commit comments

Comments
 (0)