From 58733050780b1a6986a6f08f20306c8334640063 Mon Sep 17 00:00:00 2001 From: kdaud Date: Wed, 25 Sep 2024 15:39:15 +0300 Subject: [PATCH 1/2] INFRA-411: Use shared GA workflows to build and publish. --- .github/workflows/build-publish.yml | 31 ++++++++++++++++++ .github/workflows/build-test-publish.yml | 41 ------------------------ .github/workflows/build-test.yml | 27 ---------------- 3 files changed, 31 insertions(+), 68 deletions(-) create mode 100644 .github/workflows/build-publish.yml delete mode 100644 .github/workflows/build-test-publish.yml delete mode 100644 .github/workflows/build-test.yml diff --git a/.github/workflows/build-publish.yml b/.github/workflows/build-publish.yml new file mode 100644 index 00000000..b9529ed2 --- /dev/null +++ b/.github/workflows/build-publish.yml @@ -0,0 +1,31 @@ +name: Build and Publish + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + release: + types: [published] + +jobs: + build: + strategy: + matrix: + java: [ '8', '11'] + uses: mekomsolutions/shared-github-workflow/.github/workflows/maven-build-test.yml@main + with: + java-version: ${{ matrix.Java }} + maven-args: "-Pvalidator" + secrets: + NEXUS_USERNAME: ${{ secrets.NEXUS_USERNAME }} + NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }} + + publish: + if: ${{ (github.event_name == 'push' && github.ref == 'refs/heads/main') || github.event_name == 'release' }} + needs: build + uses: mekomsolutions/shared-github-workflow/.github/workflows/maven-publish.yml@main + secrets: + NEXUS_USERNAME: ${{ secrets.NEXUS_USERNAME }} + NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }} + diff --git a/.github/workflows/build-test-publish.yml b/.github/workflows/build-test-publish.yml deleted file mode 100644 index 978e6f00..00000000 --- a/.github/workflows/build-test-publish.yml +++ /dev/null @@ -1,41 +0,0 @@ -name: Build and Publish - -on: - push: - branches: [main] - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - - name: Set up JDK 8 - uses: actions/setup-java@v2 - with: - distribution: 'temurin' - java-version: '8' - - - name: Build and Test - run: mvn --batch-mode --update-snapshots clean package -P validator - - - name: Set settings.xml - uses: s4u/maven-settings-action@v2.6.0 - with: - servers: | - [{ - "id": "mks-repo", - "username": "${{ secrets.NEXUS_USERNAME }}", - "password": "${{ secrets.NEXUS_PASSWORD }}" - }, - { - "id": "mks-repo-snapshots", - "username": "${{ secrets.NEXUS_USERNAME }}", - "password": "${{ secrets.NEXUS_PASSWORD }}" - }] - if: ${{ github.ref == 'refs/heads/main' && github.repository_owner == 'mekomsolutions' }} - - - name: Publish - run: mvn --batch-mode clean deploy -P validator - if: ${{ github.ref == 'refs/heads/main' && github.repository_owner == 'mekomsolutions' }} diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml deleted file mode 100644 index 606d87ea..00000000 --- a/.github/workflows/build-test.yml +++ /dev/null @@ -1,27 +0,0 @@ -name: Build and Test - -on: - pull_request: - branches: [main] - - push: - branches-ignore: [main] - -jobs: - build: - runs-on: ubuntu-latest - strategy: - matrix: - java: [ '8', '11'] - - steps: - - uses: actions/checkout@v2 - - - name: Set up JDK ${{ matrix.java }} - uses: actions/setup-java@v2 - with: - distribution: 'temurin' - java-version: ${{ matrix.java }} - - - name: Build and Test - run: mvn --batch-mode --update-snapshots clean package -P validator From 0570dbaf52e5a072f660e898a288b2147981f681 Mon Sep 17 00:00:00 2001 From: kdaud Date: Thu, 26 Sep 2024 16:17:18 +0300 Subject: [PATCH 2/2] Apply suggestion --- .github/workflows/{build-publish.yml => ci.yml} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename .github/workflows/{build-publish.yml => ci.yml} (97%) diff --git a/.github/workflows/build-publish.yml b/.github/workflows/ci.yml similarity index 97% rename from .github/workflows/build-publish.yml rename to .github/workflows/ci.yml index b9529ed2..38d62e74 100644 --- a/.github/workflows/build-publish.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,4 @@ -name: Build and Publish +name: CI on: push: