|
| 1 | +name: Veracode Build |
| 2 | +on: |
| 3 | + workflow_call: |
| 4 | + inputs: |
| 5 | + repository: |
| 6 | + required: true |
| 7 | + type: string |
| 8 | + ref: |
| 9 | + required: true |
| 10 | + type: string |
| 11 | + token: |
| 12 | + required: true |
| 13 | + type: string |
| 14 | +jobs: |
| 15 | + build: |
| 16 | + runs-on: ubuntu-latest |
| 17 | + container: |
| 18 | + image: veracode/scm-packaging:latest |
| 19 | + env: |
| 20 | + VERACODE_API_KEY_ID: '${{ secrets.VERACODE_API_ID }}' |
| 21 | + VERACODE_API_KEY_SECRET: '${{ secrets.VERACODE_API_KEY }}' |
| 22 | + steps: |
| 23 | + - uses: actions/checkout@v4 |
| 24 | + with: |
| 25 | + repository: ${{ inputs.repository }} |
| 26 | + ref: ${{ inputs.ref }} |
| 27 | + token: ${{ inputs.token }} |
| 28 | + |
| 29 | + - uses: actions/checkout@v4 |
| 30 | + with: |
| 31 | + path: 'veracode-helper' |
| 32 | + |
| 33 | + - name: Package the application |
| 34 | + id: application_package |
| 35 | + env: |
| 36 | + VERACODE_API_KEY_ID: '${{ secrets.VERACODE_API_ID }}' |
| 37 | + VERACODE_API_KEY_SECRET: '${{ secrets.VERACODE_API_KEY }}' |
| 38 | + run: | |
| 39 | + cd veracode-helper/helper/cli |
| 40 | + cliFile=$(ls -1 . | head -n 1) |
| 41 | + cliFileName=$(echo "$cliFile" | cut -c 1-$((${#cliFile}-7))) |
| 42 | + tar -zxvf $cliFile |
| 43 | + cd $cliFileName |
| 44 | + export PATH="veracode-helper/helper/cli/$cliFileName:$PATH" |
| 45 | + cd /__w/veracode/veracode |
| 46 | + veracode package --source . --output veracode-artifacts --trust |
| 47 | + zip veracode-artifact.zip veracode-artifacts/* -x .zip .tar .tar.gz .gz |
| 48 | +
|
| 49 | + - name: Package error |
| 50 | + if: failure() && steps.application_package.outcome == 'failure' |
| 51 | + run: | |
| 52 | + echo "::error::Veracode static scan faced a problem. Please contact your Veracode administrator for more information." |
| 53 | +
|
| 54 | + - uses: actions/upload-artifact@v4 |
| 55 | + with: |
| 56 | + name: veracode-artifact |
| 57 | + path: /__w/veracode/veracode/veracode-artifact.zip |
| 58 | + if-no-files-found: error |
0 commit comments