spring-petclinic/.github/workflows/ci-pipeline.yml
2025-03-14 09:44:44 -07:00

70 lines
2.2 KiB
YAML

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: Install JFrog CLI
run: |
curl -fL https://getcli.jfrog.io | bash
chmod +x jfrog
mv jfrog /usr/local/bin/
- name: Configure JFrog CLI
run: |
jfrog config add my-artifactory \
--artifactory-url=https://trialt0zppb.jfrog.io/artifactory \
--user=${{ secrets.ARTIFACTORY_USERNAME }} \
--password=${{ secrets.ARTIFACTORY_IDENTITY_TOKEN }} \
--interactive=false
- name: Configure JFrog CLI for Maven
run: |
jfrog rt mvnc --server-id-resolve=my-artifactory \
--repo-resolve-releases=maven-maven-remote \
--repo-resolve-snapshots=maven-maven-remote \
--server-id-deploy=my-artifactory \
--repo-deploy-releases=maven-libs-release-local \
--repo-deploy-snapshots=maven-libs-snapshot-local
- name: Compile and Package the Application
run: |
mvn clean package -DskipTests
- name: Publish Maven Artifact to JFrog Artifactory
run: |
jfrog rt mvn clean install --config my-artifactory \
--build-name=spring-petclinic \
--build-number=${{ github.run_id }}
- name: Build Docker Image
run: |
docker build -t trialt0zppb.jfrog.io/onboarding-docker-local/spring-petclinic:${{ github.run_id }} .
- name: Push Docker Image to JFrog Artifactory using JFrog CLI
run: |
jfrog rt docker-push trialt0zppb.jfrog.io/onboarding-docker-local/spring-petclinic:${{ github.run_id }} onboarding-docker-local \
--build-name=spring-petclinic \
--build-number=${{ github.run_id }}
- name: Publish Build Info to JFrog Artifactory
run: |
jfrog rt build-publish spring-petclinic ${{ github.run_id }}