|
| 1 | +# This workflow uses actions that are not certified by GitHub. |
| 2 | +# They are provided by a third-party and are governed by |
| 3 | +# separate terms of service, privacy policy, and support |
| 4 | +# documentation. |
| 5 | + |
| 6 | +# GitHub recommends pinning actions to a commit SHA. |
| 7 | +# To get a newer version, you will need to update the SHA. |
| 8 | +# You can also reference a tag or branch, but the action may change without warning. |
| 9 | + |
| 10 | +name: "Supply Chain Security C4PO SBOM Demo" |
| 11 | + |
| 12 | +on: |
| 13 | + pull_request: |
| 14 | + branches: [ "main" ] |
| 15 | + |
| 16 | + |
| 17 | +env: |
| 18 | + REPORTING_PATH: security-c4po-reporting |
| 19 | + CFG_PATH: security-c4po-cfg |
| 20 | + |
| 21 | + |
| 22 | +jobs: |
| 23 | + reporting_job: |
| 24 | + name: "Reportingservice SBOM Job" |
| 25 | + |
| 26 | + runs-on: ubuntu-latest |
| 27 | + |
| 28 | + steps: |
| 29 | + - name: "Check out code" |
| 30 | + uses: actions/checkout@v3 |
| 31 | + |
| 32 | + # Steps required for build process |
| 33 | + - name: "Set up JDK 11" |
| 34 | + uses: actions/setup-java@v3 |
| 35 | + with: |
| 36 | + java-version: '11' |
| 37 | + distribution: 'temurin' |
| 38 | + |
| 39 | + - name: "Setup Gradle" |
| 40 | + uses: gradle/gradle-build-action@v2 |
| 41 | + with: |
| 42 | + gradle-version: 6.5 |
| 43 | + |
| 44 | + - name: "Execute Gradle build" |
| 45 | + run: | |
| 46 | + cd $REPORTING_PATH |
| 47 | + ./gradlew clean build |
| 48 | +
|
| 49 | + # Steps required for SBOM creation |
| 50 | + - name: "Generate Reporting SBOM" |
| 51 | + id: reporting_sbom |
| 52 | + uses: anchore/sbom-action@v0 |
| 53 | + with: |
| 54 | + path: './security-c4po-reporting' |
| 55 | + format: cyclonedx-json |
| 56 | + output-file: "${{ github.event.repository.name }}-reporting-sbom.cyclonedx.json" |
| 57 | + upload-artifact: true |
| 58 | + |
| 59 | + # ToDo: Push SBOM to self-hosted Dependency Track instance |
| 60 | + |
| 61 | + # Working version to generate & analyse SBOMs |
| 62 | + # Might be not good for company data |
| 63 | + - name: "Generate SBOM" |
| 64 | + id: sbom_generation |
| 65 | + uses: codenotary/sbom.sh-create@main |
| 66 | + with: |
| 67 | + scan_type: 'grypefs' |
| 68 | + target: './security-c4po-reporting' # . -> Assuming you want to scan the entire repository |
| 69 | + |
| 70 | + - name: Output SBOM URL |
| 71 | + run: echo "The Reportingservice SBOM can be found at $SBOM_SHARE_URL" |
0 commit comments