From 577fda370830a6ceeb3301f79b2a8a8d0d883f00 Mon Sep 17 00:00:00 2001 From: Jesse Houldsworth Date: Thu, 13 Mar 2025 13:09:37 -0700 Subject: [PATCH] adding ci file --- .github/workflows/ci-pipeline.yml | 48 +++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 .github/workflows/ci-pipeline.yml diff --git a/.github/workflows/ci-pipeline.yml b/.github/workflows/ci-pipeline.yml new file mode 100644 index 000000000..a47cd458c --- /dev/null +++ b/.github/workflows/ci-pipeline.yml @@ -0,0 +1,48 @@ +name: CI Pipeline with JFrog Artifactory + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: '17' + + - name: Cache Maven dependencies + uses: actions/cache@v3 + with: + path: ~/.m2 + key: maven-${{ runner.os }}-${{ hashFiles('**/pom.xml') }} + restore-keys: maven-${{ runner.os }}- + + - name: Compile the code + run: mvn clean compile + + - name: Run tests + run: mvn test + + - name: Build Docker image + run: | + docker build -t trialt0zppb.jfrog.io/onboarding-docker-local/spring-petclinic:latest . + + - name: Log in to JFrog Artifactory using Identity Token + run: echo ${{ secrets.ARTIFACTORY_IDENTITY_TOKEN }} | docker login trialt0zppb.jfrog.io -u ${{ secrets.ARTIFACTORY_USERNAME }} --password-stdin + + - name: Push Docker image to JFrog Artifactory + run: | + docker push trialt0zppb.jfrog.io/onboarding-docker-local/spring-petclinic:latest +