Skip to content

Commit 5a619db

Browse files
committed
add virustotal scan to CI release workflow (#580)
* add virustotal scan to CI release workflow * use analysis output from virustotal action to put links in release body * refactor release body (use dropdown: less confusing for the user)
1 parent 9003048 commit 5a619db

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

.github/workflows/release.yml

+23-1
Original file line numberDiff line numberDiff line change
@@ -410,14 +410,36 @@ jobs:
410410
rm -v release/._ArduinoCreateAgent*.dmg
411411
mv -v ArduinoCreateAgent-windows*/* release/
412412
413+
- name: VirusTotal Scan
414+
id: virustotal_step
415+
uses: crazy-max/ghaction-virustotal@v2
416+
with:
417+
vt_api_key: ${{ secrets.VIRUSTOTAL_API_KEY }}
418+
update_release_body: false # `true` won't work becasue trigger type is not release
419+
files: |
420+
release/*.exe
421+
arduino-create-agent-windows-2019-386/arduino-create-agent.exe
422+
arduino-create-agent-windows-2019-amd64/arduino-create-agent.exe
423+
424+
- name: Organize release body message #use sed to clean and format the output markdown style
425+
id: release_body
426+
run: |
427+
vt_title_pre="<details close>\n<summary>VirusTotal analysis 🛡</summary>\n\n"
428+
vt_links="$(echo ${{ steps.virustotal_step.outputs.analysis}} | sed 's/release\///g' | sed 's/,/\n/g' | sed 's/^/- [/' | sed 's/=/](/' | sed 's/$/)/')"
429+
vt_title_post="\n</details>"
430+
vt_title_pre="${vt_title_pre//'\n'/'%0A'}"
431+
vt_links="${vt_links//$'\n'/'%0A'}" # replace \n with a special character -> generates a single lines, \n will be reintroduced later
432+
vt_title_post="${vt_title_post//'\n'/'%0A'}"
433+
echo "::set-output name=RBODY::$vt_title_pre$vt_links$vt_title_post"
434+
413435
- name: Create Github Release
414436
uses: actions/create-release@v1
415437
env:
416438
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
417439
with:
418440
tag_name: ${{ github.ref }}
419441
release_name: ${{ github.ref }}
420-
body: ""
442+
body: ${{ steps.release_body.outputs.RBODY}}
421443
draft: false
422444
prerelease: ${{ steps.prerelease.outputs.IS_PRE }}
423445

0 commit comments

Comments
 (0)