From 32dffa686969e1dea94fce23b7434c8dd1462710 Mon Sep 17 00:00:00 2001 From: Rahul Sharma Date: Tue, 30 Apr 2024 20:10:05 +0100 Subject: [PATCH] uploaded workflow files --- .github/workflows/cd.yml | 29 ++++++++++++++++++++++ .github/workflows/ci.yml | 37 ++++++++++++++++++++++++++++ .github/workflows/maven-publish.yml | 38 ----------------------------- 3 files changed, 66 insertions(+), 38 deletions(-) create mode 100644 .github/workflows/cd.yml create mode 100644 .github/workflows/ci.yml delete mode 100644 .github/workflows/maven-publish.yml diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml new file mode 100644 index 0000000..05a6460 --- /dev/null +++ b/.github/workflows/cd.yml @@ -0,0 +1,29 @@ +name: CD + +on: + push: + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: checkout code + uses: actions/checkout@v4 + + - name: Set up JDK 11 + uses: actions/setup-java@v4 + with: + java-version: '11' + distribution: 'temurin' + cache: 'maven' + + - name: Build with Maven + run: | + mvn -B -P github package -file pom.xml + mkdir staging && cp target/*.jar staging + + - name: upload artifact + uses: actions/upload-artifact@v4 + with: + name: Package + path: staging \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..c3fb581 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,37 @@ +name: CI + +on: + pull_request: + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: checkout code + uses: actions/checkout@v4 + + - name: Set up JDK 11 + uses: actions/setup-java@v4 + with: + java-version: '11' + distribution: 'temurin' + cache: 'maven' + + - name: Test dependency + run: mvn test + + - name: Build with Maven + run: | + mvn -B -P github package -file pom.xml + mkdir staging && cp target/*.jar staging + + - name: upload artifact + uses: actions/upload-artifact@v4 + with: + name: Package + path: staging + + + + + diff --git a/.github/workflows/maven-publish.yml b/.github/workflows/maven-publish.yml deleted file mode 100644 index a646184..0000000 --- a/.github/workflows/maven-publish.yml +++ /dev/null @@ -1,38 +0,0 @@ -# This workflow will build a package using Maven and then publish it to GitHub packages when a release is created -# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#apache-maven-with-a-settings-path - -name: Maven Package - -on: - push: - branches: - - master - -jobs: - build: - - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - - steps: - - uses: actions/checkout@v4 - - name: Set up JDK 11 - uses: actions/setup-java@v3 - with: - java-version: '11' - distribution: 'temurin' - server-id: github # Value of the distributionManagement/repository/id field of the pom.xml - settings-path: ${{ github.workspace }} # location for the settings.xml file - server-username: GITHUB_USER_REF # env variable name for username - server-password: GITHUB_TOKEN_REF # env variable name for GitHub Personal Access Token - - - name: Build with Maven - run: mvn -B -Pgithub package --file pom.xml - - - name: Publish to GitHub Packages Apache Maven - run: mvn deploy -s $GITHUB_WORKSPACE/settings.xml - env: - GITHUB_USER_REF: ${{ secrets.GH_PACKAGE_REPO_USERNAME }} - GITHUB_TOKEN_REF: ${{ secrets.GH_PACKAGE_REPO_PASSWORD }} \ No newline at end of file