Skip to content

Commit e74aa10

Browse files
authored
Merge pull request #2 from wtx-labs/feature/release-1
Feature/release 1
2 parents 77b89f0 + 716d5a1 commit e74aa10

File tree

3 files changed

+212
-3
lines changed

3 files changed

+212
-3
lines changed

.github/workflows/maven-central.yml

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
name: Publish to Maven Central
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
branches:
8+
- 'feature/release-*'
9+
10+
jobs:
11+
publish:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v4
16+
with:
17+
fetch-depth: 0
18+
19+
- name: Set up JDK 8
20+
uses: actions/setup-java@v4
21+
with:
22+
java-version: '8'
23+
distribution: 'temurin'
24+
cache: maven
25+
26+
- name: Setup GPG
27+
run: |
28+
echo "Setting up GPG..."
29+
mkdir -p ~/.gnupg
30+
chmod 700 ~/.gnupg
31+
32+
# Import private key
33+
echo "${{ secrets.GPG_PRIVATE_KEY }}" > private.key
34+
echo "Importing GPG key..."
35+
gpg --batch --import private.key
36+
rm private.key
37+
38+
# Configure GPG
39+
echo "Configuring GPG..."
40+
cat > ~/.gnupg/gpg.conf << EOF
41+
default-key ${{ secrets.GPG_KEYNAME }}
42+
use-agent
43+
pinentry-mode loopback
44+
EOF
45+
46+
# Debug information
47+
echo "=== GPG Keys ==="
48+
gpg --list-secret-keys --keyid-format LONG
49+
gpg --list-keys --keyid-format LONG
50+
51+
- name: Configure Maven
52+
run: |
53+
mkdir -p ~/.m2
54+
cat > ~/.m2/settings.xml << EOF
55+
<settings>
56+
<servers>
57+
<server>
58+
<id>central</id>
59+
<username>${{ secrets.OSSRH_USERNAME_TOKEN }}</username>
60+
<password>${{ secrets.OSSRH_PASSWORD_TOKEN }}</password>
61+
</server>
62+
</servers>
63+
<profiles>
64+
<profile>
65+
<id>central</id>
66+
<activation>
67+
<activeByDefault>true</activeByDefault>
68+
</activation>
69+
<properties>
70+
<gpg.executable>gpg</gpg.executable>
71+
<gpg.passphrase>${{ secrets.GPG_PASSPHRASE }}</gpg.passphrase>
72+
</properties>
73+
</profile>
74+
</profiles>
75+
</settings>
76+
EOF
77+
78+
- name: Build and Publish
79+
env:
80+
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME_TOKEN }}
81+
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD_TOKEN }}
82+
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
83+
run: |
84+
echo "Starting Maven build and deploy..."
85+
mvn clean deploy -P release \
86+
-Dmaven.javadoc.skip=false \
87+
-Dmaven.deploy.skip=false \
88+
-Dgpg.keyname=${{ secrets.GPG_KEYNAME }} \
89+
-Dgpg.useagent=true \
90+
-Dmaven.test.failure.ignore=false \
91+
-DaltDeploymentRepository=ossrh::default::https://central.sonatype.com/api/v1/publisher/upload \
92+
-DrepositoryId=ossrh \
93+
-Dusername=${{ secrets.OSSRH_USERNAME_TOKEN }} \
94+
-Dpassword=${{ secrets.OSSRH_PASSWORD_TOKEN }}

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ This API client provides a type-safe Java interface for WooCommerce REST API v3,
6363
6464
## 📦 Version information
6565

66-
- **Current version**: `0.9.4`
66+
- **Current version**: `0.9.5`
6767
- **Supported WooCommerce API version**: `v3`
6868
- **Java compatibility**: Java 8+
6969

@@ -93,7 +93,7 @@ Then add the locally built artifact to your project:
9393
<dependency>
9494
<groupId>pl.wtx.woocommerce</groupId>
9595
<artifactId>woocommerce-api-client</artifactId>
96-
<version>0.9.4</version>
96+
<version>0.9.5</version>
9797
</dependency>
9898
```
9999

pom.xml

Lines changed: 116 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>pl.wtx.woocommerce</groupId>
88
<artifactId>woocommerce-api-client</artifactId>
9-
<version>0.9.4</version>
9+
<version>0.9.5</version>
1010
<packaging>jar</packaging>
1111

1212
<name>WooCommerce REST API Client</name>
@@ -24,8 +24,20 @@
2424
<gsonfire.version>1.9.0</gsonfire.version>
2525
<jsr305.version>3.0.2</jsr305.version>
2626
<javax.annotation.version>1.3.2</javax.annotation.version>
27+
<maven.deploy.skip>true</maven.deploy.skip>
2728
</properties>
2829

30+
<distributionManagement>
31+
<snapshotRepository>
32+
<id>ossrh</id>
33+
<url>https://central.sonatype.com/api/v1/publisher/upload</url>
34+
</snapshotRepository>
35+
<repository>
36+
<id>ossrh</id>
37+
<url>https://central.sonatype.com/api/v1/publisher/upload</url>
38+
</repository>
39+
</distributionManagement>
40+
2941
<dependencies>
3042

3143
<dependency>
@@ -164,6 +176,54 @@
164176
</executions>
165177
</plugin>
166178

179+
<plugin>
180+
<groupId>org.apache.maven.plugins</groupId>
181+
<artifactId>maven-gpg-plugin</artifactId>
182+
<version>3.0.1</version>
183+
<executions>
184+
<execution>
185+
<id>sign-artifacts</id>
186+
<phase>verify</phase>
187+
<goals>
188+
<goal>sign</goal>
189+
</goals>
190+
<configuration>
191+
<keyname>${gpg.keyname}</keyname>
192+
<passphrase>${gpg.passphrase}</passphrase>
193+
<gpgArguments>
194+
<arg>--batch</arg>
195+
<arg>--yes</arg>
196+
<arg>--pinentry-mode</arg>
197+
<arg>loopback</arg>
198+
</gpgArguments>
199+
</configuration>
200+
</execution>
201+
</executions>
202+
</plugin>
203+
204+
<plugin>
205+
<groupId>org.sonatype.central</groupId>
206+
<artifactId>central-publishing-maven-plugin</artifactId>
207+
<version>0.7.0</version>
208+
<extensions>true</extensions>
209+
<configuration>
210+
<serverId>central</serverId>
211+
<centralBaseUrl>https://central.sonatype.com</centralBaseUrl>
212+
<deploymentName>WooCommerce API Client - ${project.version}</deploymentName>
213+
<checksums>required</checksums>
214+
<skipPublishing>false</skipPublishing>
215+
</configuration>
216+
</plugin>
217+
218+
<plugin>
219+
<groupId>org.apache.maven.plugins</groupId>
220+
<artifactId>maven-deploy-plugin</artifactId>
221+
<version>3.1.1</version>
222+
<configuration>
223+
<altDeploymentRepository>ossrh::default::https://central.sonatype.com/api/v1/publisher/upload</altDeploymentRepository>
224+
</configuration>
225+
</plugin>
226+
167227
</plugins>
168228
</build>
169229

@@ -201,4 +261,59 @@
201261
</developer>
202262
</developers>
203263

264+
<profiles>
265+
<profile>
266+
<id>release</id>
267+
<build>
268+
<plugins>
269+
<plugin>
270+
<groupId>org.apache.maven.plugins</groupId>
271+
<artifactId>maven-source-plugin</artifactId>
272+
<executions>
273+
<execution>
274+
<id>attach-sources</id>
275+
<goals>
276+
<goal>jar-no-fork</goal>
277+
</goals>
278+
</execution>
279+
</executions>
280+
</plugin>
281+
<plugin>
282+
<groupId>org.apache.maven.plugins</groupId>
283+
<artifactId>maven-javadoc-plugin</artifactId>
284+
<executions>
285+
<execution>
286+
<id>attach-javadocs</id>
287+
<goals>
288+
<goal>jar</goal>
289+
</goals>
290+
</execution>
291+
</executions>
292+
</plugin>
293+
<plugin>
294+
<groupId>org.apache.maven.plugins</groupId>
295+
<artifactId>maven-gpg-plugin</artifactId>
296+
<executions>
297+
<execution>
298+
<id>sign-artifacts</id>
299+
<phase>verify</phase>
300+
<goals>
301+
<goal>sign</goal>
302+
</goals>
303+
</execution>
304+
</executions>
305+
</plugin>
306+
</plugins>
307+
</build>
308+
</profile>
309+
</profiles>
310+
311+
<licenses>
312+
<license>
313+
<name>MIT License</name>
314+
<url>https://opensource.org/licenses/MIT</url>
315+
<distribution>repo</distribution>
316+
</license>
317+
</licenses>
318+
204319
</project>

0 commit comments

Comments
 (0)