Skip to content

Commit fe07518

Browse files
Merge pull request #19 from OmOmofonmwan/feature/IAT-848-Build-POC
Added Build Pipeline POC
2 parents 47f2b8b + f6d1eaf commit fe07518

1 file changed

Lines changed: 55 additions & 0 deletions

File tree

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Build Pipeline
2+
3+
run-name: 'Build Pipeline For ${{github.ref_name}}'
4+
5+
on:
6+
push:
7+
8+
jobs:
9+
build-job:
10+
name: Build Job
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout Code Repository
14+
uses: actions/checkout@v4
15+
- name: Downloading Java
16+
uses: actions/setup-java@v4
17+
with:
18+
java-version: '11'
19+
distribution: 'temurin'
20+
- name: Maven Build
21+
if: github.ref == 'refs/heads/main'
22+
run: |
23+
echo 'Running in main branch'
24+
mvn clean install
25+
- name: Maven Build -- Feature Branch
26+
if: github.ref != 'refs/heads/main'
27+
run: |
28+
echo 'Running in ${{github.ref_name}} branch'
29+
mvn clean install
30+
publish-to-artifact-repositories:
31+
name: Publish To Nexus & OSSRH
32+
runs-on: ubuntu-latest
33+
needs: build-job
34+
env:
35+
REPOSITORY_ID: "maven-snapshots"
36+
steps:
37+
- name: Checkout Code Repository
38+
uses: actions/checkout@v4
39+
- name: Downloading Java
40+
uses: actions/setup-java@v4
41+
with:
42+
java-version: '11'
43+
distribution: 'temurin'
44+
- name: Get Version
45+
run: echo "POM_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV
46+
- name: Print Current Version
47+
run: echo "Current Version Is - ${{env.POM_VERSION}}"
48+
- name: Check If Release Version
49+
if: ${{ !contains(env.POM_VERSION, '-SNAPSHOT') }}
50+
run: echo "REPOSITORY_ID=maven-release" >> $GITHUB_ENV
51+
- name: Deploy To Nexus
52+
run: echo "Deploy artifact to nexus - ${{env.REPOSITORY_ID}}"
53+
- name: Deploy To OSSRH
54+
if: ${{ env.REPOSITORY_ID == 'maven-release'}}
55+
run: echo "Deploy aftifacts to OSSRH"

0 commit comments

Comments
 (0)