Update dotnet-build.yml #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: ASP.NET Build and Veracode Scan | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: windows-latest | |
env: | |
solution: 'Verademo-dotnet.sln' | |
buildPlatform: 'Any CPU' | |
buildConfiguration: 'Release' | |
steps: | |
# Checkout the code | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
# Install Visual Studio Build Tools | |
- name: Install Visual Studio Build Tools | |
uses: microsoft/setup-msbuild@v2 | |
# Setup NuGet | |
- name: Setup NuGet | |
uses: NuGet/setup-nuget@v1 | |
# Restore NuGet packages (using the .sln file) | |
- name: Restore NuGet Packages | |
run: nuget restore ${{ env.solution }} | |
# Build the solution | |
- name: Build Solution | |
run: | | |
msbuild ${{ env.solution }} /p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="${{ github.workspace }}/artifacts" /p:Platform="${{ env.buildPlatform }}" /p:Configuration="${{ env.buildConfiguration }}" | |
# Download and run Veracode Static Pipeline Scanner | |
- name: Veracode Static Pipeline Scanner | |
run: | | |
curl -sSO https://downloads.veracode.com/securityscan/pipeline-scan-LATEST.zip | |
unzip -o pipeline-scan-LATEST.zip | |
java -jar pipeline-scan.jar -vid ${{ secrets.VERACODE_API_ID }} -vkey ${{ secrets.VERACODE_API_KEY }} -f "${{ github.workspace }}/artifacts/Verademo-dotnet.zip" || true | |
# Publish artifacts | |
- name: Upload build artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: veracode-scan-results | |
path: results.json |