|
| 1 | +# This is the build workflow to help maintain the project |
| 2 | +name: Build CI |
| 3 | + |
| 4 | +# Controls when the workflow will run |
| 5 | +on: |
| 6 | + # Triggers the workflow on push or pull request events but only for the "master" branch |
| 7 | + push: |
| 8 | + branches: ["main", "dev"] |
| 9 | + pull_request: |
| 10 | + branches: ["main", "dev"] |
| 11 | + |
| 12 | + # Allows you to run this workflow manually from the Actions tab |
| 13 | + workflow_dispatch: |
| 14 | + |
| 15 | +# These permissions are needed to interact with GitHub's OIDC Token endpoint. |
| 16 | +permissions: |
| 17 | + id-token: write # This is required for requesting the JWT |
| 18 | + contents: read # This is required for actions/checkout |
| 19 | + security-events: write |
| 20 | + |
| 21 | +# A workflow run is made up of one or more jobs that can run sequentially or in parallel |
| 22 | +jobs: |
| 23 | + iac-scan: |
| 24 | + # The type of runner that the job will run on |
| 25 | + runs-on: ubuntu-latest |
| 26 | + |
| 27 | + # Steps represent a sequence of tasks that will be executed as part of the job |
| 28 | + steps: |
| 29 | + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it |
| 30 | + - name: Git Checkout |
| 31 | + uses: actions/checkout@v4.1.7 |
| 32 | + |
| 33 | + - name: Build Docker image |
| 34 | + uses: docker/build-push-action@v6.6.1 |
| 35 | + with: |
| 36 | + context: . |
| 37 | + file: Dockerfile |
| 38 | + push: false |
| 39 | + sbom: true |
| 40 | + tags: georgedavisibexlabs/publish-sarif-to-jira:build |
| 41 | + |
| 42 | + - name: Run Trivy in GitHub SBOM mode and submit results to Dependency Graph |
| 43 | + uses: aquasecurity/trivy-action@0.24.0 |
| 44 | + with: |
| 45 | + scan-type: 'fs' |
| 46 | + format: 'github' |
| 47 | + output: 'dependency-results.sbom.json' |
| 48 | + image-ref: '.' |
| 49 | + github-pat: ${{ secrets.GITHUB_TOKEN }} |
| 50 | + |
| 51 | + - name: Upload trivy SBOM as a Github artifact |
| 52 | + uses: actions/upload-artifact@v4.3.6 |
| 53 | + with: |
| 54 | + name: trivy-sbom-report |
| 55 | + path: trivy-dependency-results.sbom.json |
| 56 | + retention-days: 30 |
| 57 | + |
| 58 | + - name: Run Trivy Image scanner |
| 59 | + uses: aquasecurity/trivy-action@0.24.0 |
| 60 | + with: |
| 61 | + scan-type: 'image' |
| 62 | + image-ref: 'georgedavisibexlabs/publish-sarif-to-jira:build' |
| 63 | + limit-severities-for-sarif: true |
| 64 | + trivy-config: .github/config/trivy-sarif.yaml |
| 65 | + |
| 66 | + - name: Upload Trivy Image scan results |
| 67 | + uses: actions/upload-artifact@v4.3.6 |
| 68 | + with: |
| 69 | + name: trivy-image-scan-results |
| 70 | + path: trivy-image-scan-results.sarif |
| 71 | + retention-days: 30 |
| 72 | + |
| 73 | + - name: Upload Trivy scan results to GitHub Security tab |
| 74 | + uses: github/codeql-action/upload-sarif@v3 |
| 75 | + with: |
| 76 | + sarif_file: 'trivy-image-scan-results.sarif' |
0 commit comments