Skip to content

Commit 4ec9aa2

Browse files
ci(NODE-6212): generate sarif report and upload sbom lite file on releases (#39)
1 parent 0e007f5 commit 4ec9aa2

File tree

1 file changed

+74
-1
lines changed

1 file changed

+74
-1
lines changed

.github/workflows/release.yml

+74-1
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,84 @@ jobs:
3030
uses: ./.github/actions/setup
3131
- name: actions/compress_sign_and_upload
3232
uses: ./.github/actions/compress_sign_and_upload
33-
with:
33+
with:
3434
aws_role_arn: ${{ secrets.AWS_ROLE_ARN }}
3535
aws_region_name: 'us-east-1'
3636
aws_secret_id: ${{ secrets.AWS_SECRET_ID }}
3737
npm_package_name: 'mongodb-legacy'
3838
- run: npm publish --provenance
3939
env:
4040
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
41+
42+
generate_sarif_report:
43+
environment: release
44+
runs-on: ubuntu-latest
45+
needs: [release_please]
46+
permissions:
47+
# required for all workflows
48+
security-events: write
49+
id-token: write
50+
contents: write
51+
52+
steps:
53+
- uses: actions/checkout@v4
54+
- name: Set up drivers-github-tools
55+
uses: mongodb-labs/drivers-github-tools/setup@v2
56+
with:
57+
aws_region_name: us-east-1
58+
aws_role_arn: ${{ secrets.aws_role_arn }}
59+
aws_secret_id: ${{ secrets.aws_secret_id }}
60+
61+
- name: "Generate Sarif Report"
62+
uses: mongodb-labs/drivers-github-tools/code-scanning-export@v2
63+
with:
64+
ref: main
65+
output-file: sarif-report.json
66+
67+
- name: Get release version and release package file name
68+
id: get_version
69+
shell: bash
70+
run: |
71+
package_version=$(jq --raw-output '.version' package.json)
72+
echo "package_version=${package_version}" >> "$GITHUB_OUTPUT"
73+
- name: actions/publish_asset_to_s3
74+
uses: mongodb-labs/drivers-github-tools/node/publish_asset_to_s3@v2
75+
with:
76+
version: ${{ steps.get_version.outputs.package_version }}
77+
product_name: mongodb-legacy
78+
file: sarif-report.json
79+
dry_run: ${{ needs.release_please.outputs.release_created == '' }}
80+
81+
upload_sbom_lite:
82+
environment: release
83+
runs-on: ubuntu-latest
84+
needs: [release_please]
85+
permissions:
86+
# required for all workflows
87+
security-events: write
88+
id-token: write
89+
contents: write
90+
91+
steps:
92+
- uses: actions/checkout@v4
93+
- name: Set up drivers-github-tools
94+
uses: mongodb-labs/drivers-github-tools/setup@v2
95+
with:
96+
aws_region_name: us-east-1
97+
aws_role_arn: ${{ secrets.aws_role_arn }}
98+
aws_secret_id: ${{ secrets.aws_secret_id }}
99+
100+
- name: Get release version and release package file name
101+
id: get_version
102+
shell: bash
103+
run: |
104+
package_version=$(jq --raw-output '.version' package.json)
105+
echo "package_version=${package_version}" >> "$GITHUB_OUTPUT"
106+
107+
- name: actions/publish_asset_to_s3
108+
uses: mongodb-labs/drivers-github-tools/node/publish_asset_to_s3@v2
109+
with:
110+
version: ${{ steps.get_version.outputs.package_version }}
111+
product_name: mongodb-legacy
112+
file: sbom.json
113+
dry_run: ${{ needs.release_please.outputs.release_created == '' }}

0 commit comments

Comments
 (0)