Skip to content

Commit c7eff12

Browse files
author
Christopher Eteka
committed
Refine build and release pipelines
1 parent 3978298 commit c7eff12

7 files changed

Lines changed: 78 additions & 105 deletions

File tree

.github/workflows/build.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: PaystackJavaClient Maven CI
2+
3+
on:
4+
push:
5+
workflow_dispatch:
6+
7+
concurrency:
8+
group: ${{ github.workflow }}-${{ github.ref }}
9+
cancel-in-progress: true
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Step 1 - Checkout Branch
17+
uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
21+
- name: Step 2 - Cache local Maven repository
22+
uses: actions/cache@v4
23+
with:
24+
path: ~/.m2/repository
25+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
26+
restore-keys: ${{ runner.os }}-maven-
27+
28+
- name: Step 3 - Setup JDK 17
29+
uses: actions/setup-java@v4
30+
with:
31+
distribution: 'temurin'
32+
java-version: 17
33+
cache: 'maven'
34+
35+
- name: Step 4 - Build Project with Maven
36+
run: mvn -B verify --file pom.xml

.github/workflows/maven-action.yml

Lines changed: 0 additions & 74 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 38 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,67 @@
11
name: PaystackJavaClient Maven CD
22

33
on:
4-
repository_dispatch:
5-
types: [execute-publish]
4+
push:
5+
tags:
6+
- v*
7+
8+
pull_request:
9+
branches: [ main ]
610

711
jobs:
8-
release:
9-
name: Release
12+
publish:
1013
runs-on: ubuntu-latest
11-
1214
steps:
13-
- name: Checkout master
15+
- name: Step 1 - Checkout Branch
1416
uses: actions/checkout@v4
1517
with:
1618
fetch-depth: 0
1719

18-
- name: Cache local Maven repository
20+
- name: Step 2 - Cache local Maven repository
1921
uses: actions/cache@v4
2022
with:
2123
path: ~/.m2/repository
2224
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
2325
restore-keys: ${{ runner.os }}-maven-
2426

25-
- name: Setup JDK 17
27+
- name: Step 3 - Setup JDK 17
2628
uses: actions/setup-java@v4
2729
with:
2830
distribution: 'temurin'
2931
java-version: 17
3032
cache: 'maven'
3133

32-
- name: Configure Maven settings.xml
33-
34+
- name: Step 4 - Build with Maven
35+
run: mvn -B package --file pom.xml
36+
37+
- name: Step 5 - Set up Apache Maven Central
38+
uses: actions/setup-java@v4
3439
with:
35-
githubServer: false
36-
servers: |
37-
[{
38-
"id": "github",
39-
"username": "${{ github.actor }}",
40-
"password": "${{ secrets.GH_PAT }}"
41-
}]
42-
43-
- name: Publish Domain Package
44-
run: mvn versions:set -DnewVersion=${{ github.event.client_payload.version }} versions:commit -pl paystack-domain && mvn -B deploy -pl paystack-domain
40+
distribution: 'temurin'
41+
java-version: '17'
42+
server-id: maven
43+
server-username: MAVEN_USERNAME
44+
server-password: MAVEN_CENTRAL_TOKEN
45+
gpg-private-key: ${{ secrets.GPG_SECRET_KEY }}
46+
gpg-passphrase: MAVEN_GPG_PASSPHRASE
47+
48+
- name: Step 6 - Publish Domain to Apache Maven Central
49+
run: mvn -B -P release deploy -pl paystack-domain
4550
env:
46-
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
51+
MAVEN_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
52+
MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN }}
53+
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
4754

48-
- name: Publish Client Package
49-
run: mvn versions:set -DnewVersion=${{ github.event.client_payload.version }} versions:commit -pl paystack-clients && mvn -B deploy -pl paystack-clients
55+
- name: Step 7 - Publish Clients to Apache Maven Central
56+
run: mvn -B -P release deploy -pl paystack-clients
5057
env:
51-
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
58+
MAVEN_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
59+
MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN }}
60+
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
5261

53-
- name: Publish Client SpringBoot Starter Package
54-
run: mvn versions:set -DnewVersion=${{ github.event.client_payload.version }} versions:commit -pl paystack-clients-spring-boot-starter && mvn -B deploy -pl paystack-clients-spring-boot-starter
62+
- name: Step 8 - Publish Spring-Boot-Starter to Apache Maven Central
63+
run: mvn -B -P release deploy -pl paystack-clients-spring-boot-starter
5564
env:
56-
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
65+
MAVEN_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
66+
MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN }}
67+
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}

paystack-clients-spring-boot-starter/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<groupId>io.github.chriseteka.paystackclient</groupId>
66
<artifactId>paystack-clients-spring-boot-starter</artifactId>
7-
<version>0.0.5-SNAPSHOT</version>
7+
<version>1.0.0</version>
88
<name>paystack-clients-spring-boot-starter</name>
99
<description>paystack-clients-spring-boot-starter</description>
1010

paystack-clients/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<groupId>io.github.chriseteka.paystackclient</groupId>
55
<artifactId>paystack-clients</artifactId>
66
<name>paystack-clients</name>
7-
<version>0.0.5-SNAPSHOT</version>
7+
<version>1.0.0</version>
88

99
<properties>
1010
<maven.compiler.source>17</maven.compiler.source>

paystack-domain/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<groupId>io.github.chriseteka.paystackclient</groupId>
55
<artifactId>paystack-domain</artifactId>
66
<name>paystack-domain</name>
7-
<version>0.0.5-SNAPSHOT</version>
7+
<version>1.0.0</version>
88

99
<properties>
1010
<jackson.version>2.16.1</jackson.version>

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<groupId>io.github.chriseteka.paystackclient</groupId>
66
<artifactId>PaystackJavaClient</artifactId>
7-
<version>0.0.5-SNAPSHOT</version>
7+
<version>1.0.0</version>
88
<packaging>pom</packaging>
99
<modules>
1010
<module>paystack-domain</module>

0 commit comments

Comments
 (0)