|
7 | 7 | description: "Release assets upload URL" |
8 | 8 | required: true |
9 | 9 | type: string |
| 10 | + tag: |
| 11 | + description: "The git tag to generate SBOM for - used in scheduled runs" |
| 12 | + required: false |
| 13 | + type: string |
10 | 14 |
|
11 | 15 | jobs: |
12 | 16 | create-sbom: |
13 | | - runs-on: self-hosted |
| 17 | + runs-on: [self-hosted, Linux, X64] |
14 | 18 |
|
15 | 19 | steps: |
| 20 | + - name: Determine release tag and version |
| 21 | + id: vars |
| 22 | + # Uses inputs.tag for scheduled runs, otherwise github.ref_name. |
| 23 | + run: | |
| 24 | + TAG_NAME=${{ inputs.tag || github.ref_name }} |
| 25 | + VERSION=${TAG_NAME#v} |
| 26 | + echo "TAG_NAME=$TAG_NAME" >> $GITHUB_OUTPUT |
| 27 | + echo "VERSION=$VERSION" >> $GITHUB_OUTPUT |
| 28 | +
|
16 | 29 | - name: Checkout |
17 | 30 | uses: actions/checkout@v4 |
18 | 31 | with: |
| 32 | + ref: ${{ steps.vars.outputs.TAG_NAME }} |
19 | 33 | submodules: recursive |
20 | 34 |
|
21 | | - # Store the version, stripping any v-prefix |
22 | | - - name: Write release version |
23 | | - run: | |
24 | | - VERSION=${GITHUB_REF_NAME#v} |
25 | | - echo Version: $VERSION |
26 | | - echo "VERSION=$VERSION" >> $GITHUB_ENV |
27 | | -
|
28 | 35 | - name: Create SBOM with Trivy |
29 | 36 | uses: aquasecurity/trivy-action@0.33.1 |
30 | 37 | with: |
31 | 38 | scan-type: 'fs' |
32 | 39 | format: 'spdx-json' |
33 | | - output: "defguard-proxy-${{ env.VERSION }}.sbom.json" |
| 40 | + output: "defguard-proxy-${{ steps.vars.outputs.VERSION }}.sbom.json" |
34 | 41 | scan-ref: '.' |
35 | 42 | severity: "CRITICAL,HIGH,MEDIUM,LOW" |
36 | 43 | scanners: "vuln" |
37 | 44 |
|
38 | 45 | - name: Create docker image SBOM with Trivy |
39 | 46 | uses: aquasecurity/trivy-action@0.33.1 |
40 | 47 | with: |
41 | | - image-ref: "ghcr.io/defguard/defguard-proxy:${{ env.VERSION }}" |
| 48 | + image-ref: "ghcr.io/defguard/defguard-proxy:${{ steps.vars.outputs.VERSION }}" |
42 | 49 | scan-type: 'image' |
43 | 50 | format: 'spdx-json' |
44 | | - output: "defguard-proxy-${{ env.VERSION }}-docker.sbom.json" |
| 51 | + output: "defguard-proxy-${{ steps.vars.outputs.VERSION }}-docker.sbom.json" |
| 52 | + severity: "CRITICAL,HIGH,MEDIUM,LOW" |
| 53 | + scanners: "vuln" |
| 54 | + |
| 55 | + - name: Create security advisory file with Trivy |
| 56 | + uses: aquasecurity/trivy-action@0.33.1 |
| 57 | + with: |
| 58 | + scan-type: 'fs' |
| 59 | + format: 'json' |
| 60 | + output: "defguard-proxy-${{ steps.vars.outputs.VERSION }}.advisories.json" |
| 61 | + scan-ref: '.' |
| 62 | + severity: "CRITICAL,HIGH,MEDIUM,LOW" |
| 63 | + scanners: "vuln" |
| 64 | + |
| 65 | + - name: Create docker image security advisory file with Trivy |
| 66 | + uses: aquasecurity/trivy-action@0.33.1 |
| 67 | + with: |
| 68 | + image-ref: "ghcr.io/defguard/defguard-proxy:${{ steps.vars.outputs.VERSION }}" |
| 69 | + scan-type: 'image' |
| 70 | + format: 'json' |
| 71 | + output: "defguard-proxy-${{ steps.vars.outputs.VERSION }}-docker.advisories.json" |
45 | 72 | severity: "CRITICAL,HIGH,MEDIUM,LOW" |
46 | 73 | scanners: "vuln" |
47 | 74 |
|
48 | | - - name: Upload SBOM |
| 75 | + - name: Upload SBOMs and advisories |
49 | 76 | uses: shogo82148/actions-upload-release-asset@v1 |
50 | 77 | env: |
51 | 78 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
52 | 79 | with: |
53 | 80 | upload_url: ${{ inputs.upload_url }} |
54 | | - asset_path: "defguard-*.sbom.json" |
| 81 | + asset_path: "defguard-*.json" |
55 | 82 | asset_content_type: application/octet-stream |
| 83 | + overwrite: true |
0 commit comments