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