Create Petclinic2Artifactory

Signed-off-by: nirpel-sys <nirpel@jfrog.com>
This commit is contained in:
nirpel-sys 2026-01-21 12:13:19 +02:00 committed by GitHub
parent 18388c7fc9
commit fb49bb063d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

64
.github/workflows/Petclinic2Artifactory vendored Normal file
View file

@ -0,0 +1,64 @@
name: PetClinic to Artifactory
on:
push:
branches: [ "main" ]
pull_request: # Added to allow Frogbot to scan incoming PRs
workflow_dispatch:
jobs:
build-and-publish:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
pull-requests: write # Required for Frogbot to comment on PRs
security-events: write
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: 'maven'
- name: Set up JFrog CLI
uses: jfrog/setup-jfrog-cli@v4
env:
JF_URL: ${{ secrets.JF_URL }}
with:
version: latest
oidc-provider-name: github-oidc
oidc-audience: jfrog-github
# --- START FROGBOT SCAN ---
- name: Frogbot Scan
uses: jfrog/frogbot@v2
env:
JF_URL: ${{ secrets.JF_URL }}
# Frogbot uses the OIDC configuration from the setup-jfrog-cli step
JF_GIT_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# --- END FROGBOT SCAN ---
- name: Build and Test
run: ./mvnw clean test
- name: Build Docker Image
run: |
./mvnw spring-boot:build-image \
-Dspring-boot.build-image.imageName=petclinic-app:${{ github.run_number }}
- name: Publish to JFrog
run: |
JF_HOST=$(echo "${{ secrets.JF_URL }}" | sed 's|https://||' | sed 's|/||g')
DOCKER_REPO="docker-local"
IMAGE_NAME="petclinic-app:${{ github.run_number }}"
REMOTE_TAG="$JF_HOST/$DOCKER_REPO/$IMAGE_NAME"
docker tag "$IMAGE_NAME" "$REMOTE_TAG"
jf docker push "$REMOTE_TAG" --build-name=petclinic-trial --build-number=${{ github.run_number }}
jf rt bp petclinic-trial ${{ github.run_number }}