Skip to content

Commit 2c579fa

Browse files
committed
Added GitHub Packages publishing workflow.
1 parent 82286c7 commit 2c579fa

File tree

3 files changed

+38
-2
lines changed

3 files changed

+38
-2
lines changed

.github/settings.xml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
5+
https://maven.apache.org/xsd/settings-1.0.0.xsd">
6+
<servers>
7+
<server>
8+
<id>github</id>
9+
<username>${env.GITHUB_ACTOR}</username>
10+
<password>${env.GITHUB_TOKEN}</password>
11+
</server>
12+
</servers>
13+
</settings>

.github/workflows/maven.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build
1+
name: Build and Publish
22

33
on:
44
push:
@@ -9,6 +9,9 @@ on:
99
jobs:
1010
build:
1111
runs-on: ubuntu-latest
12+
permissions:
13+
contents: read
14+
packages: write
1215
steps:
1316
- uses: actions/checkout@v4
1417
- name: Set up JDK 8
@@ -17,4 +20,10 @@ jobs:
1720
java-version: '8'
1821
distribution: 'temurin'
1922
- name: Build
20-
run: mvn clean verify -Dmaven.javadoc.skip=true
23+
run: mvn clean verify -Dmaven.javadoc.skip=true
24+
- name: Publish Package
25+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
26+
run: mvn deploy -Dmaven.javadoc.skip=true -s .github/settings.xml
27+
env:
28+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
29+
GITHUB_ACTOR: ${{ github.actor }}

pom.xml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,12 @@
151151
</executions>
152152
</plugin>
153153

154+
<plugin>
155+
<groupId>org.apache.maven.plugins</groupId>
156+
<artifactId>maven-deploy-plugin</artifactId>
157+
<version>3.1.1</version>
158+
</plugin>
159+
154160
<plugin>
155161
<groupId>org.apache.maven.plugins</groupId>
156162
<artifactId>maven-javadoc-plugin</artifactId>
@@ -197,4 +203,12 @@
197203
</developer>
198204
</developers>
199205

206+
<distributionManagement>
207+
<repository>
208+
<id>github</id>
209+
<name>GitHub Packages</name>
210+
<url>https://maven.pkg.github.com/wtx-labs/woocommerce-api-client-java</url>
211+
</repository>
212+
</distributionManagement>
213+
200214
</project>

0 commit comments

Comments
 (0)