Skip to content

Commit 598ced9

Browse files
add compliance report and authorized publisher
1 parent 465ffd9 commit 598ced9

File tree

3 files changed

+167
-23
lines changed

3 files changed

+167
-23
lines changed
Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,23 @@
11
name: Compress and Sign
22
description: 'Compresses package and signs with garasign'
33

4-
inputs:
5-
aws_role_arn:
6-
description: 'AWS role input for drivers-github-tools/gpg-sign@v2'
7-
required: true
8-
aws_region_name:
9-
description: 'AWS region name input for drivers-github-tools/gpg-sign@v2'
10-
required: true
11-
aws_secret_id:
12-
description: 'AWS secret id input for drivers-github-tools/gpg-sign@v2'
13-
required: true
14-
npm_package_name:
15-
description: 'The name for the npm package this repository represents'
16-
required: true
4+
inputs:
5+
aws_role_arn:
6+
description: 'AWS role input for drivers-github-tools/gpg-sign@v2'
7+
required: true
8+
aws_region_name:
9+
description: 'AWS region name input for drivers-github-tools/gpg-sign@v2'
10+
required: true
11+
aws_secret_id:
12+
description: 'AWS secret id input for drivers-github-tools/gpg-sign@v2'
13+
required: true
14+
npm_package_name:
15+
description: 'The name for the npm package this repository represents'
16+
required: true
17+
dry_run:
18+
description: 'Should we upload files to the release?'
19+
required: false
20+
default: 'true'
1721

1822
runs:
1923
using: composite
@@ -31,24 +35,25 @@ runs:
3135
3236
- name: Set up drivers-github-tools
3337
uses: mongodb-labs/drivers-github-tools/setup@v2
34-
with:
38+
with:
3539
aws_region_name: ${{ inputs.aws_region_name }}
3640
aws_role_arn: ${{ inputs.aws_role_arn }}
3741
aws_secret_id: ${{ inputs.aws_secret_id }}
3842

3943
- name: Create detached signature
4044
uses: mongodb-labs/drivers-github-tools/gpg-sign@v2
41-
with:
45+
with:
4246
filenames: ${{ steps.get_vars.outputs.package_file }}
43-
env:
47+
env:
4448
RELEASE_ASSETS: ${{ steps.get_vars.outputs.package_file }}.temp.sig
4549

46-
- name: Name release asset correctly
50+
- name: Name release asset correctly
4751
run: mv ${{ steps.get_vars.outputs.package_file }}.temp.sig ${{ steps.get_vars.outputs.package_file }}.sig
4852
shell: bash
4953

5054
- name: "Upload release artifacts"
55+
if: ${{ inputs.dry_run == false }}
5156
run: gh release upload v${{ steps.get_vars.outputs.package_version }} ${{ steps.get_vars.outputs.package_file }}.sig
5257
shell: bash
5358
env:
54-
GH_TOKEN: ${{ github.token }}
59+
GH_TOKEN: ${{ github.token }}

.github/workflows/release-5.x.yml

Lines changed: 72 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,21 +23,48 @@ jobs:
2323

2424
compress_sign_and_upload:
2525
needs: [release_please]
26-
if: ${{ needs.release_please.outputs.release_created }}
2726
environment: release
2827
runs-on: ubuntu-latest
2928
steps:
3029
- uses: actions/checkout@v4
3130
- name: actions/setup
3231
uses: ./.github/actions/setup
32+
- name: Get release version and release package file name
33+
id: get_vars
34+
shell: bash
35+
run: |
36+
package_version=$(jq --raw-output '.version' package.json)
37+
echo "package_version=${package_version}" >> "$GITHUB_OUTPUT"
38+
echo "package_file=mongodb-${package_version}.tgz" >> "$GITHUB_OUTPUT"
39+
3340
- name: actions/compress_sign_and_upload
3441
uses: ./.github/actions/compress_sign_and_upload
3542
with:
3643
aws_role_arn: ${{ secrets.AWS_ROLE_ARN }}
3744
aws_region_name: 'us-east-1'
3845
aws_secret_id: ${{ secrets.AWS_SECRET_ID }}
3946
npm_package_name: 'mongodb'
47+
dry_run: ${{ needs.release_please.outputs.release_created == '' }}
48+
49+
- name: Generate authorized pub report
50+
uses: mongodb-labs/drivers-github-tools/authorized-pub@v2
51+
with:
52+
release_version: ${{ steps.get_version.outputs.package_version }}
53+
product_name: node-mongodb-native
54+
# <package> and <package>.sig
55+
filenames: ${{ steps.get_vars.outputs.package_file }}*
56+
token: ${{ github.token }}
57+
58+
- name: actions/publish_asset_to_s3
59+
uses: mongodb-labs/drivers-github-tools/node/publish_asset_to_s3@v2
60+
with:
61+
version: ${{ steps.get_version.outputs.package_version }}
62+
product_name: node-mongodb-native
63+
file: ${{env.S3_ASSETS}}/authorized-publication.txt
64+
dry_run: ${{ needs.release_please.outputs.release_created == '' }}
65+
4066
- run: npm publish --provenance --tag=5x
67+
if: ${{ needs.release_please.outputs.release_created }}
4168
env:
4269
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
4370

@@ -73,7 +100,7 @@ jobs:
73100
package_version=$(jq --raw-output '.version' package.json)
74101
echo "package_version=${package_version}" >> "$GITHUB_OUTPUT"
75102
- name: actions/publish_asset_to_s3
76-
uses: mongodb-labs/drivers-github-tools/node/publish_asset_to_s3@main
103+
uses: mongodb-labs/drivers-github-tools/node/publish_asset_to_s3@v2
77104
with:
78105
version: ${{ steps.get_version.outputs.package_version }}
79106
product_name: node-mongodb-native
@@ -113,3 +140,46 @@ jobs:
113140
product_name: node-mongodb-native
114141
file: sbom.json
115142
dry_run: ${{ needs.release_please.outputs.release_created == '' }}
143+
144+
generate_compliance_report:
145+
environment: release
146+
runs-on: ubuntu-latest
147+
needs: [release_please]
148+
permissions:
149+
# required for all workflows
150+
security-events: write
151+
id-token: write
152+
contents: write
153+
154+
steps:
155+
- uses: actions/checkout@v4
156+
- name: Set up drivers-github-tools
157+
uses: mongodb-labs/drivers-github-tools/setup@v2
158+
with:
159+
aws_region_name: us-east-1
160+
aws_role_arn: ${{ secrets.aws_role_arn }}
161+
aws_secret_id: ${{ secrets.aws_secret_id }}
162+
163+
- name: Get release version and release package file name
164+
id: get_version
165+
shell: bash
166+
run: |
167+
package_version=$(jq --raw-output '.version' package.json)
168+
echo "package_version=${package_version}" >> "$GITHUB_OUTPUT"
169+
170+
- name: Generate compliance report
171+
uses: mongodb-labs/drivers-github-tools/compliance-report@v2
172+
with:
173+
sbom_name: sbom.json
174+
sarif_name: sarif-report.json
175+
security_report_location: tbd
176+
release_version: ${{ steps.get_version.outputs.package_version }}
177+
token: ${{ github.token }}
178+
179+
- name: actions/publish_asset_to_s3
180+
uses: mongodb-labs/drivers-github-tools/node/publish_asset_to_s3@v2
181+
with:
182+
version: ${{ steps.get_version.outputs.package_version }}
183+
product_name: node-mongodb-native
184+
file: ${{env.S3_ASSETS}}/ssdlc_compliance_report.txt
185+
dry_run: ${{ needs.release_please.outputs.release_created == '' }}

.github/workflows/release.yml

Lines changed: 72 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,48 @@ jobs:
2121

2222
compress_sign_and_upload:
2323
needs: [release_please]
24-
if: ${{ needs.release_please.outputs.release_created }}
2524
environment: release
2625
runs-on: ubuntu-latest
2726
steps:
2827
- uses: actions/checkout@v4
2928
- name: actions/setup
3029
uses: ./.github/actions/setup
30+
- name: Get release version and release package file name
31+
id: get_vars
32+
shell: bash
33+
run: |
34+
package_version=$(jq --raw-output '.version' package.json)
35+
echo "package_version=${package_version}" >> "$GITHUB_OUTPUT"
36+
echo "package_file=mongodb-${package_version}.tgz" >> "$GITHUB_OUTPUT"
37+
3138
- name: actions/compress_sign_and_upload
3239
uses: ./.github/actions/compress_sign_and_upload
3340
with:
3441
aws_role_arn: ${{ secrets.AWS_ROLE_ARN }}
3542
aws_region_name: 'us-east-1'
3643
aws_secret_id: ${{ secrets.AWS_SECRET_ID }}
3744
npm_package_name: 'mongodb'
38-
- run: npm publish --provenance
45+
dry_run: ${{ needs.release_please.outputs.release_created == '' }}
46+
47+
- name: Generate authorized pub report
48+
uses: mongodb-labs/drivers-github-tools/authorized-pub@v2
49+
with:
50+
release_version: ${{ steps.get_version.outputs.package_version }}
51+
product_name: node-mongodb-native
52+
# <package> and <package>.sig
53+
filenames: ${{ steps.get_vars.outputs.package_file }}*
54+
token: ${{ github.token }}
55+
56+
- name: actions/publish_asset_to_s3
57+
uses: mongodb-labs/drivers-github-tools/node/publish_asset_to_s3@v2
58+
with:
59+
version: ${{ steps.get_version.outputs.package_version }}
60+
product_name: node-mongodb-native
61+
file: ${{env.S3_ASSETS}}/authorized-publication.txt
62+
dry_run: ${{ needs.release_please.outputs.release_created == '' }}
63+
64+
- run: npm publish --provenance --tag=latest
65+
if: ${{ needs.release_please.outputs.release_created }}
3966
env:
4067
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
4168

@@ -78,7 +105,6 @@ jobs:
78105
file: sarif-report.json
79106
dry_run: ${{ needs.release_please.outputs.release_created == '' }}
80107

81-
82108
upload_sbom_lite:
83109
environment: release
84110
runs-on: ubuntu-latest
@@ -112,3 +138,46 @@ jobs:
112138
product_name: node-mongodb-native
113139
file: sbom.json
114140
dry_run: ${{ needs.release_please.outputs.release_created == '' }}
141+
142+
generate_compliance_report:
143+
environment: release
144+
runs-on: ubuntu-latest
145+
needs: [release_please]
146+
permissions:
147+
# required for all workflows
148+
security-events: write
149+
id-token: write
150+
contents: write
151+
152+
steps:
153+
- uses: actions/checkout@v4
154+
- name: Set up drivers-github-tools
155+
uses: mongodb-labs/drivers-github-tools/setup@v2
156+
with:
157+
aws_region_name: us-east-1
158+
aws_role_arn: ${{ secrets.aws_role_arn }}
159+
aws_secret_id: ${{ secrets.aws_secret_id }}
160+
161+
- name: Get release version and release package file name
162+
id: get_version
163+
shell: bash
164+
run: |
165+
package_version=$(jq --raw-output '.version' package.json)
166+
echo "package_version=${package_version}" >> "$GITHUB_OUTPUT"
167+
168+
- name: Generate compliance report
169+
uses: mongodb-labs/drivers-github-tools/compliance-report@v2
170+
with:
171+
sbom_name: sbom.json
172+
sarif_name: sarif-report.json
173+
security_report_location: tbd
174+
release_version: ${{ steps.get_version.outputs.package_version }}
175+
token: ${{ github.token }}
176+
177+
- name: actions/publish_asset_to_s3
178+
uses: mongodb-labs/drivers-github-tools/node/publish_asset_to_s3@v2
179+
with:
180+
version: ${{ steps.get_version.outputs.package_version }}
181+
product_name: node-mongodb-native
182+
file: ${{env.S3_ASSETS}}/ssdlc_compliance_report.txt
183+
dry_run: ${{ needs.release_please.outputs.release_created == '' }}

0 commit comments

Comments
 (0)