Skip to content

Commit

Permalink
Merge pull request #1444 from Badgerati/virustotal
Browse files Browse the repository at this point in the history
Adds VirusTotal package scanning Action
  • Loading branch information
Badgerati authored Nov 3, 2024
2 parents a37f33b + 128abab commit 312654b
Show file tree
Hide file tree
Showing 3 changed files with 96 additions and 5 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/VirusTotal-Releases.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: VirusTotal Scan - Releases

on:
release:
types: [published]

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Run VirusTotal Scan
uses: crazy-max/ghaction-virustotal@v4
with:
vt_api_key: ${{ secrets.VIRUSTOTAL_API_KEY }}
github_token: ${{ secrets.GITHUB_TOKEN }}
update_release_body: true
request_rate: 4
files: |
.zip$
58 changes: 58 additions & 0 deletions .github/workflows/VirusTotal.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: VirusTotal Scan

on:
push:
branches:
- '*'
- '!gh-pages'
paths:
- 'src/**'
- 'pode.build.ps1'
- '.github/workflows/VirusTotal.yml'
pull_request:
branches:
- '*'
paths:
- 'src/**'
- 'pode.build.ps1'
- '.github/workflows/VirusTotal.yml'

env:
INVOKE_BUILD_VERSION: '5.11.1'
POWERSHELL_VERSION: 'lts'

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x

- name: Setup Powershell
shell: pwsh
run: |
Install-Module -Name InvokeBuild -RequiredVersion $env:INVOKE_BUILD_VERSION -Force
Invoke-Build SetupPowerShell -PowerShellVersion $env:POWERSHELL_VERSION
- name: Install Invoke-Build
shell: pwsh
run: |
Install-Module -Name InvokeBuild -RequiredVersion $env:INVOKE_BUILD_VERSION -Force
- name: Build Zip Package
shell: pwsh
run: |
Invoke-Build Compress
- name: Run VirusTotal Scan
uses: crazy-max/ghaction-virustotal@v4
with:
vt_api_key: ${{ secrets.VIRUSTOTAL_API_KEY }}
request_rate: 4
files: |
./deliverable/*.zip
23 changes: 18 additions & 5 deletions pode.build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -413,9 +413,19 @@ Task 7Zip -If (Test-PodeBuildIsWindows) PackDeps, StampVersion, {
exec { & 7z -tzip a $Version-Binaries.zip ./pkg/* }
}, PrintChecksum

#Synopsis: Create the Deliverable folder
Task DeliverableFolder {
$path = './deliverable'
if (Test-Path $path) {
Remove-Item -Path $path -Recurse -Force | Out-Null
}

# create the deliverable dir
New-Item -Path $path -ItemType Directory -Force | Out-Null
}

# Synopsis: Creates a Zip of the Module
Task Compress StampVersion, {
Task Compress PackageFolder, StampVersion, DeliverableFolder, {
$path = './deliverable'
if (Test-Path $path) {
Remove-Item -Path $path -Recurse -Force | Out-Null
Expand All @@ -426,13 +436,13 @@ Task Compress StampVersion, {
}, PrintChecksum

# Synopsis: Creates a Chocolately package of the Module
Task ChocoPack -If (Test-PodeBuildIsWindows) PackDeps, StampVersion, {
Task ChocoPack -If (Test-PodeBuildIsWindows) PackDeps, PackageFolder, StampVersion, DeliverableFolder, {
exec { choco pack ./packers/choco/pode.nuspec }
Move-Item -Path "pode.$Version.nupkg" -Destination './deliverable'
}

# Synopsis: Create docker tags
Task DockerPack {
Task DockerPack PackageFolder, StampVersion, {
# check if github and windows, and output warning
if ((Test-PodeBuildIsGitHub) -and (Test-PodeBuildIsWindows)) {
Write-Warning 'Docker images are not built on GitHub Windows runners, and Docker is in Windows container only mode. Exiting task.'
Expand Down Expand Up @@ -464,7 +474,10 @@ Task DockerPack {
}

# Synopsis: Package up the Module
Task Pack Build, {
Task Pack Compress, ChocoPack, DockerPack

# Synopsis: Package up the Module into a /pkg folder
Task PackageFolder Build, {
$path = './pkg'
if (Test-Path $path) {
Remove-Item -Path $path -Recurse -Force | Out-Null
Expand Down Expand Up @@ -492,7 +505,7 @@ Task Pack Build, {
$files | ForEach-Object {
Copy-Item -Path "./$($_)" -Destination $path -Force | Out-Null
}
}, StampVersion, Compress, ChocoPack, DockerPack
}


<#
Expand Down

0 comments on commit 312654b

Please sign in to comment.