Skip to content

Commit 23e364e

Browse files
committed
ci(clamav-release): consume shared build-package; scan extracted bundle; upload bundle
1 parent 4e934c7 commit 23e364e

1 file changed

Lines changed: 11 additions & 40 deletions

File tree

.github/workflows/clam-av-scan.yml

Lines changed: 11 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,13 @@
11
name: av-clamav-release
22
on:
33
workflow_dispatch:
4-
inputs:
5-
tag:
6-
description: 'Git tag to build and scan (e.g., v0.15.16)'
7-
required: false
84
release:
95
types: [published]
106

117
permissions:
128
contents: read
139
actions: read
1410

15-
defaults:
16-
run:
17-
shell: bash
18-
1911
jobs:
2012
clamav-release:
2113
runs-on: ubuntu-latest
@@ -25,53 +17,32 @@ jobs:
2517
uses: actions/checkout@v4
2618
with:
2719
ref: ${{ github.event.release.tag_name }}
28-
- name: Checkout (manual or default)
20+
- name: Checkout (manual/default)
2921
if: github.event_name != 'release'
3022
uses: actions/checkout@v4
3123

32-
- name: Setup Bun
33-
uses: ./.github/actions/setup-bun
34-
35-
- name: Verify Bun
36-
run: bun --version
37-
38-
- name: Install dependencies (Bun)
39-
run: bun install --frozen-lockfile || bun install
40-
41-
- name: Build (Bun)
42-
run: bun run build
43-
44-
- name: Package build outputs
45-
run: |
46-
set -e
47-
rm -rf dist-pr/payload
48-
mkdir -p dist-pr/payload
49-
[ -d dist ] && cp -a dist/. dist-pr/payload/ || true
50-
[ -d build ] && cp -a build/. dist-pr/payload/ || true
51-
if [ -z "$(ls -A dist-pr/payload 2>/dev/null)" ]; then
52-
rsync -a --exclude '.git' --exclude '.github' --exclude 'node_modules' ./ dist-pr/payload/
53-
fi
54-
tar -czf dist-pr/scan.tgz -C dist-pr/payload .
55-
ls -lh dist-pr/scan.tgz
24+
- name: Build and package
25+
id: build
26+
uses: ./.github/actions/build-package
5627

5728
- name: Install & update ClamAV DB
5829
run: |
5930
set -e
6031
sudo apt-get update
61-
sudo apt-get install -y clamav clamav-freshclam
32+
sudo apt-get install -y clamav clamav-freshclam unzip
6233
sudo systemctl stop clamav-freshclam || true
6334
sudo mkdir -p /var/lib/clamav
6435
sudo chown -R clamav:clamav /var/lib/clamav
6536
sudo freshclam --verbose
6637
ls -lh /var/lib/clamav
6738
68-
- name: ClamAV scan (extract and scan all files)
39+
- name: Extract bundle and scan
6940
run: |
7041
set -e
71-
mkdir -p dist-pr/extracted
72-
tar -xzf dist-pr/scan.tgz -C dist-pr/extracted
73-
echo 'File count in payload: '$(find dist-pr/extracted -type f | wc -l)
74-
clamscan -ri --scan-archive=yes dist-pr/extracted | tee clamav.log
42+
rm -rf dist-release/extracted && mkdir -p dist-release/extracted
43+
unzip -q bundle/opencode.zip -d dist-release/extracted
44+
echo "File count in payload: $(find dist-release/extracted -type f | wc -l)"
45+
clamscan -ri --scan-archive=yes dist-release/extracted | tee clamav.log
7546
! grep -q 'Infected files: [1-9]' clamav.log
7647
7748
- name: Upload scan results
@@ -80,4 +51,4 @@ jobs:
8051
name: clamav-release-scan-results
8152
path: |
8253
clamav.log
83-
dist-pr/scan.tgz
54+
bundle/opencode.zip

0 commit comments

Comments
 (0)