@@ -42,18 +42,99 @@ jobs:
4242 uses : actions/setup-go@v4
4343 with :
4444 go-version : ' 1.23'
45- - name : Run GoReleaser
45+ - name : Build with GoReleaser (no publish)
4646 uses : goreleaser/goreleaser-action@v5
4747 with :
4848 distribution : goreleaser
4949 version : latest
50- args : release --clean
50+ args : build --clean
5151 env :
5252 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
53-
54- publish-versioned-docs :
53+
54+ - name : Upload artifacts for scanning
55+ uses : actions/upload-artifact@v4
56+ with :
57+ name : release-artifacts
58+ path : dist/
59+ retention-days : 1
60+
61+ virus-scan :
5562 needs : release
5663 runs-on : ubuntu-latest
64+ steps :
65+ - name : Download release artifacts
66+ uses : actions/download-artifact@v4
67+ with :
68+ name : release-artifacts
69+ path : dist/
70+
71+ - name : Install ClamAV
72+ run : |
73+ sudo apt-get update
74+ sudo apt-get install -y clamav clamav-daemon
75+ sudo systemctl stop clamav-freshclam
76+ sudo freshclam
77+ sudo systemctl start clamav-daemon
78+ # Wait for daemon to start
79+ sleep 10
80+
81+ - name : Scan release artifacts
82+ run : |
83+ echo "Scanning release artifacts for viruses..."
84+
85+ clamscan --recursive --verbose --infected --bell dist/
86+ scan_result=$?
87+
88+ if [ $scan_result -eq 0 ]; then
89+ echo "✅ All artifacts are clean - no viruses detected"
90+ elif [ $scan_result -eq 1 ]; then
91+ echo "❌ Virus detected in artifacts!"
92+ exit 1
93+ else
94+ echo "⚠️ Scanner error occurred"
95+ exit 1
96+ fi
97+
98+ - name : Upload clean artifacts
99+ if : success()
100+ uses : actions/upload-artifact@v4
101+ with :
102+ name : scanned-artifacts
103+ path : dist/
104+ retention-days : 1
105+
106+ publish-release :
107+ needs : virus-scan
108+ runs-on : ubuntu-latest
109+ steps :
110+ - uses : actions/checkout@v4
111+ with :
112+ fetch-depth : 0
113+ fetch-tags : true
114+
115+ - name : Download scanned artifacts
116+ uses : actions/download-artifact@v4
117+ with :
118+ name : scanned-artifacts
119+ path : dist/
120+
121+ - name : Extract version from tag
122+ id : version
123+ run : echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
124+
125+ - name : Create release with scanned artifacts
126+ run : |
127+ # Create the release with only the tar.gz files
128+ gh release create ${{ steps.version.outputs.VERSION }} \
129+ --title "Release ${{ steps.version.outputs.VERSION }}" \
130+ --generate-notes \
131+ $(find dist/ -name "*.tar.gz" | tr '\n' ' ')
132+ env :
133+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
134+
135+ publish-versioned-docs :
136+ needs : publish-release
137+ runs-on : ubuntu-latest
57138 permissions :
58139 contents : write
59140 pages : write
0 commit comments