mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2026-02-06 14:21:11 +00:00
87 lines
No EOL
3 KiB
YAML
87 lines
No EOL
3 KiB
YAML
name: CI Pipeline (Simplified)
|
|
on:
|
|
push:
|
|
branches: [ "main" ]
|
|
pull_request:
|
|
branches: [ "main" ]
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
#################################################
|
|
# 1) Check out the repository
|
|
#################################################
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
|
|
#################################################
|
|
# 2) Set up Java
|
|
#################################################
|
|
- name: Set up JDK 17
|
|
uses: actions/setup-java@v3
|
|
with:
|
|
java-version: '17'
|
|
distribution: 'temurin'
|
|
|
|
#################################################
|
|
# 3) Install JFrog CLI
|
|
#################################################
|
|
- name: Install JFrog CLI
|
|
run: |
|
|
curl -fL https://getcli.jfrog.io | bash
|
|
chmod +x jfrog
|
|
mv jfrog /usr/local/bin/
|
|
|
|
#################################################
|
|
# 4) Clear the local Maven cache
|
|
#################################################
|
|
- name: Clear local Maven cache
|
|
run: rm -rf ~/.m2/repository
|
|
|
|
#################################################
|
|
# 5) Build with JFrog CLI wrapped around Maven
|
|
#################################################
|
|
- name: Build with JFrog CLI
|
|
run: |
|
|
jfrog rt mvn clean package \
|
|
--build-name="spring-petclinic" \
|
|
--build-number="${{ github.run_id }}"
|
|
|
|
#################################################
|
|
# 6) Upload the built artifact with JFrog CLI
|
|
#################################################
|
|
- name: Upload Maven Artifact to Artifactory
|
|
run: |
|
|
jfrog rt upload \
|
|
"target/*.jar" \
|
|
"maven-libs-release-local/spring-petclinic/" \
|
|
--flat=false \
|
|
--build-name="spring-petclinic" \
|
|
--build-number="${{ github.run_id }}"
|
|
|
|
#################################################
|
|
# 7) Build Docker image with local Docker
|
|
#################################################
|
|
- name: Build Docker Image
|
|
run: |
|
|
docker build -t trialt0zppb.jfrog.io/onboarding-docker-local/spring-petclinic:${{ github.run_id }} .
|
|
|
|
#################################################
|
|
# 8) Push Docker image using JFrog CLI
|
|
#################################################
|
|
- name: Push Docker Image to Artifactory
|
|
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 }}"
|
|
|
|
#################################################
|
|
# 9) Collect & Publish Build Info
|
|
#################################################
|
|
- name: Publish Build Info
|
|
run: |
|
|
jfrog rt build-publish \
|
|
"spring-petclinic" \
|
|
"${{ github.run_id }}" |