Skip to content

Commit 0ecc529

Browse files
authored
UID2-5248 Run vulnerability scan before publishing to nuget.org (#173)
* Change vul scan logic for nuget * Chaneg continue-on-error to false * Update description for vulnerability_severity
1 parent b744c67 commit 0ecc529

File tree

1 file changed

+20
-11
lines changed

1 file changed

+20
-11
lines changed

.github/workflows/shared-publish-to-nuget-versioned.yaml

+20-11
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ on:
66
description: The type of version number to return. Must be one of [Patch, Minor or Major]
77
required: true
88
type: string
9-
vulnerability_failure_severity:
10-
description: The severity to fail the workflow if such vulnerability is detected. DO NOT override it unless a Jira ticket is raised. Must be one of ['CRITICAL', 'CRITICAL,HIGH' or 'CRITICAL,HIGH,MEDIUM'] (without space in between).
9+
vulnerability_severity:
10+
description: The severity that will cause the action to fail if a vulnerability at that level is detected. DO NOT override it unless a Jira ticket is raised. Must be one of ['CRITICAL', 'CRITICAL,HIGH' or 'CRITICAL,HIGH,MEDIUM'] (without space in between).
11+
default: CRITICAL,HIGH
1112
type: string
12-
default: 'CRITICAL,HIGH'
1313
dotnet_version:
1414
type: string
1515
default: "6.0"
@@ -58,13 +58,6 @@ jobs:
5858
with:
5959
dotnet-version: ${{ inputs.dotnet_version }}
6060

61-
- name: Vulnerability Scan
62-
uses: IABTechLab/uid2-shared-actions/actions/vulnerability_scan_filesystem@v3
63-
with:
64-
scan_severity: HIGH,CRITICAL
65-
failure_severity: ${{ inputs.vulnerability_failure_severity }}
66-
publish_vulnerabilities: ${{ inputs.publish_vulnerabilities }}
67-
6861
- name: Set version number
6962
id: version
7063
uses: IABTechLab/uid2-shared-actions/actions/version_number@v2
@@ -80,11 +73,25 @@ jobs:
8073
sed -i "s/$current_version/$new_version/g" ${{ inputs.working_dir }}/UID2.Client.nuspec
8174
echo "Version number updated from $current_version to $new_version"
8275
83-
- name: Build, Test and Publish to nuget.org
76+
- name: Build and test
8477
run: |
8578
cd ./${{ inputs.working_dir }}
8679
dotnet test --configuration=Release
8780
dotnet pack -p:NuspecFile=../../UID2.Client.nuspec --configuration Release
81+
82+
- name: Vulnerability Scan
83+
id: vulnerability-scan
84+
uses: IABTechLab/uid2-shared-actions/actions/vulnerability_scan@v3
85+
with:
86+
scan_severity: ${{ inputs.vulnerability_severity }}
87+
failure_severity: ${{ inputs.vulnerability_severity }}
88+
publish_vulnerabilities: ${{ inputs.publish_vulnerabilities }}
89+
scan_type: fs
90+
continue-on-error: false
91+
92+
- name: Publish to nuget.org
93+
if: ${{ steps.checkRelease.outputs.is_release == 'true' }}
94+
run: |
8895
dotnet nuget push ./src/UID2.Client/bin/Release/UID2.Client.${{ steps.version.outputs.new_version }}.nupkg -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json
8996
9097
- name: Commit UID2.Client.nuspec, version.json and set tag
@@ -95,6 +102,7 @@ jobs:
95102
tag: v${{ steps.version.outputs.new_version }}
96103

97104
- name: Build Changelog
105+
if: ${{ steps.checkRelease.outputs.is_release == 'true' }}
98106
id: github_release
99107
uses: mikepenz/release-changelog-builder-action@v4
100108
with:
@@ -108,6 +116,7 @@ jobs:
108116
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
109117

110118
- name: Create Release
119+
if: ${{ steps.checkRelease.outputs.is_release == 'true' }}
111120
uses: softprops/action-gh-release@v2
112121
with:
113122
name: v${{ steps.version.outputs.new_version }}

0 commit comments

Comments
 (0)