From 63763b1bcd85ede7d73557efe088344681b0f920 Mon Sep 17 00:00:00 2001 From: jecihjoy Date: Thu, 4 Jan 2024 14:22:05 +0300 Subject: [PATCH] Updates to deployment script --- .github/workflows/maven_deploy_cicd.yml | 60 +++++++++---------------- pom.xml | 4 +- 2 files changed, 24 insertions(+), 40 deletions(-) diff --git a/.github/workflows/maven_deploy_cicd.yml b/.github/workflows/maven_deploy_cicd.yml index 4ccd12d..01d6e52 100644 --- a/.github/workflows/maven_deploy_cicd.yml +++ b/.github/workflows/maven_deploy_cicd.yml @@ -1,4 +1,4 @@ -name: Deploy to Nexus +name: Build and Publish to Nexus on: # Manually triggered workflow using the "Run workflow" button @@ -7,11 +7,11 @@ on: branches: [ master ] pull_request: branches: [ master ] - + jobs: - build: + publish: runs-on: ubuntu-latest - + #set up the build enviroment steps: - name: Checkout Repository @@ -20,42 +20,26 @@ jobs: - name: Set up JDK 8 uses: actions/setup-java@v4 with: - java-version: '8' distribution: 'temurin' - cache: maven + java-version: '8' - # 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 }} + - name: Set settings.xml + uses: s4u/maven-settings-action@v3.0.0 + with: + servers: | + [{ + "id": "mks-repo", + "username": "${{ secrets.MAVEN_USERNAME }}", + "password": "${{ secrets.MAVEN_TOKEN }}" + }, + { + "id": "mks-repo-snapshots", + "username": "${{ secrets.MAVEN_USERNAME }}", + "password": "${{ secrets.MAVEN_TOKEN }}" + }] + + - name: Publish + run: mvn --batch-mode clean deploy -DskipTests diff --git a/pom.xml b/pom.xml index 42c6545..c687962 100644 --- a/pom.xml +++ b/pom.xml @@ -42,8 +42,8 @@ 1.18.0 0.2.14 3.15.0 - 18.0.0 - 3.0.0 + 18.7.0 + 3.0.1 3.0.0 1.2.0