move push step to the end, and upload SCA report to GitHub Action

This commit is contained in:
Dan Alima 2023-12-31 13:21:02 +02:00
parent a63d9f2d63
commit 5228352af7

View file

@ -1,7 +1,7 @@
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time # This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven # For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
name: Java CI with Maven name: JFrog - Home Assignment
on: on:
push: push:
@ -42,12 +42,16 @@ jobs:
IMAGE_NAME: danvid.jfrog.io/assignment-docker/spring-petclinic:${{ github.sha }} IMAGE_NAME: danvid.jfrog.io/assignment-docker/spring-petclinic:${{ github.sha }}
run: | run: |
jf docker build -t $IMAGE_NAME . jf docker build -t $IMAGE_NAME .
jf docker push $IMAGE_NAME
- name: Scan the project with your preferred SCA tool - name: Scan the project with your preferred SCA tool
run: | run: |
jf docker scan danvid.jfrog.io/assignment-docker/spring-petclinic:${{ github.sha }} jf docker scan danvid.jfrog.io/assignment-docker/spring-petclinic:${{ github.sha }}
- uses: actions/upload-artifact@v4
with:
name: my-artifact
path: /tmp/jfrog.cli.temp*
- name: Publish Build info With JFrog CLI - name: Publish Build info With JFrog CLI
env: env:
# Generated and maintained by GitHub # Generated and maintained by GitHub
@ -55,6 +59,8 @@ jobs:
# JFrog organization secret # JFrog organization secret
JFROG_CLI_BUILD_NUMBER : ${{ github.run_number }} JFROG_CLI_BUILD_NUMBER : ${{ github.run_number }}
run: | run: |
# Bonus part: Publish the image to JFrog Artifactory in your pipeline (using the SaaS trial)
jf docker push $IMAGE_NAME
# Export the build name and build nuber # Export the build name and build nuber
# Collect environment variables for the build # Collect environment variables for the build
jf rt build-collect-env jf rt build-collect-env