Skip to content

Commit 62bd96c

Browse files
committed
Add github action to publish package
1 parent bb5f748 commit 62bd96c

File tree

2 files changed

+54
-0
lines changed

2 files changed

+54
-0
lines changed

.github/workflows/maven-publish.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Build and Publish to GitHub Packages
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
permissions:
9+
packages: write
10+
contents: read
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout Repository
18+
uses: actions/checkout@v4
19+
20+
- name: Set up JDK 8
21+
uses: actions/setup-java@v3
22+
with:
23+
distribution: 'temurin'
24+
java-version: '8'
25+
server-id: github
26+
settings-path: ${{ github.workspace }}
27+
28+
- name: Create Maven settings.xml
29+
run: |
30+
mkdir -p ~/.m2
31+
echo '<settings>
32+
<servers>
33+
<server>
34+
<id>github</id>
35+
<username>${{ github.actor }}</username>
36+
<password>${{ secrets.GITHUB_TOKEN }}</password>
37+
</server>
38+
</servers>
39+
</settings>' > ~/.m2/settings.xml
40+
41+
- name: Build with Maven
42+
run: mvn clean package
43+
44+
- name: Publish to GitHub Packages
45+
run: mvn deploy -DskipTests --settings ~/.m2/settings.xml
46+
env:
47+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

pom.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,4 +106,11 @@
106106
</plugins>
107107
</build>
108108

109+
<distributionManagement>
110+
<repository>
111+
<id>github</id>
112+
<url>https://maven.pkg.github.com/payment-components/rest-sdk-wrapper</url>
113+
</repository>
114+
</distributionManagement>
115+
109116
</project>

0 commit comments

Comments
 (0)