Update build-maven.yml #31
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: | |
- garjib | |
permissions: | |
actions: read # for detecting the GitHub Actions environment. | |
id-token: write # for creating OIDC tokens for signing. | |
packages: write # for uploading attestation. | |
contents: read | |
security-events: write | |
jobs: | |
build-publish-maven: | |
runs-on: ubuntu-latest | |
env: | |
DOCKER_REPO: optum-main-docker-virtual | |
IMAGE_NAME: 'my-very-cool-image:${{ github.run_number }}' | |
JF_URL: https://psazuse.jfrog.io/ | |
DOCKER_CLI_EXPERIMENTAL: enabled | |
JFROG_PLATFORM_REPO: optum-main-maven-virtual | |
JF_PROJECT: optum-main | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
- name: Setup JFrog CLI | |
id: setup-cli | |
uses: jfrog/setup-jfrog-cli@v4 | |
env: | |
JF_URL: https://${{ vars.JF_URL }}/ | |
JF_PROJECT: ${{ vars.JF_PROJECT }} | |
JF_ACCESS_TOKEN: ${{ vars.JF_ACCESS_TOKEN }} | |
- name: Verify JFrog CLI Installation | |
run: jf -v | |
- name: Configure JFrog CLI | |
run: | | |
jf rt ping | |
jf mvnc --repo-deploy-releases=$JFROG_PLATFORM_REPO --repo-deploy-snapshots=$JFROG_PLATFORM_REPO --repo-resolve-releases=$JFROG_PLATFORM_REPO --repo-resolve-snapshots=$JFROG_PLATFORM_REPO | |
- name: Build and Upload JAR to Artifactory | |
run: jf mvn clean package deploy | |
- name: Audit with JFrog Xray | |
run: jf audit . | |
- name: Scan with JFrog Xray | |
run: jf scan **/* | |
- name: Authenticate Docker | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ vars.JF_URL }} | |
username: [email protected] | |
password: ${{ vars.JF_ACCESS_TOKEN }} | |
- name: Build Docker image | |
run: | | |
jf docker --version | |
jf docker build --tag ${{ vars.JF_URL }}/${{ env.DOCKER_REPO }}/${{ env.IMAGE_NAME }} --metadata-file metadata.json --push . | |
- name: Scan Docker image | |
run: | | |
jf docker pull ${{ vars.JF_URL }}/${{ env.DOCKER_REPO }}/${{ env.IMAGE_NAME }} | |
jf docker scan ${{ vars.JF_URL }}/${{ env.DOCKER_REPO }}/${{ env.IMAGE_NAME }} | |