Skip to content

Commit

Permalink
Create maven_deploy_cicd.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
RAJABIBRAZ authored Jan 3, 2024
1 parent 03063c5 commit a17877a
Showing 1 changed file with 61 additions and 0 deletions.
61 changes: 61 additions & 0 deletions .github/workflows/maven_deploy_cicd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Deploy to Nexus

on:
# Manually triggered workflow using the "Run workflow" button
workflow_dispatch:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:
runs-on: ubuntu-latest

#set up the build enviroment
steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Set up JDK 8
uses: actions/setup-java@v4
with:
java-version: '8'
distribution: 'temurin'
cache: maven

# Build with Maven
- name: Build with Maven
run: mvn -B package -DskipTests


publish:
runs-on: ubuntu-latest
# Define dependencies, this job depends on the completion of the "build" job
needs: build

# Specify conditions for when this job should run
if: ${{ github.event_name == 'push' || github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch' }}

# Set up enviroment for Publish

steps:
#set up the build enviroment
- name: Checkout Repository
uses: actions/checkout@v4
# Step 2: Set up JDK 8 for Publish
- name: Set up JDK 8 for Publish
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '8'
server-id: mks-nexus
server-username: $MAVEN_USERNAME
server-password: $MAVEN_TOKEN

- name: Publish to Nexus repository
run: mvn -B deploy

env:
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
MAVEN_TOKEN: ${{ secrets.MAVEN_TOKEN }}

0 comments on commit a17877a

Please sign in to comment.