Skip to content

Commit 67dffc2

Browse files
steveseguinclaude
andcommitted
Add GitHub Actions workflow for automated builds
- Windows and Linux builds on tag push - Optional VirusTotal submission (requires VIRUSTOTAL_API_KEY secret) - Automatic upload to GitHub Release - Manual workflow_dispatch trigger option 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent d22c742 commit 67dffc2

File tree

1 file changed

+128
-0
lines changed

1 file changed

+128
-0
lines changed
Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
name: Build and Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
workflow_dispatch:
8+
inputs:
9+
version:
10+
description: 'Version tag (e.g., v2.23.1)'
11+
required: true
12+
13+
jobs:
14+
build-windows:
15+
runs-on: windows-latest
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
with:
20+
submodules: recursive
21+
ssh-key: ${{ secrets.SUBMODULE_SSH_KEY }}
22+
23+
- name: Setup Node.js
24+
uses: actions/setup-node@v4
25+
with:
26+
node-version: '20'
27+
cache: 'npm'
28+
29+
- name: Install dependencies
30+
run: npm ci
31+
env:
32+
# Skip native module build if submodule not available
33+
WINDOW_AUDIO_CAPTURE_SKIP: ${{ secrets.SUBMODULE_SSH_KEY == '' && '1' || '0' }}
34+
35+
- name: Build Windows
36+
run: npm run build:win32
37+
38+
- name: Get version
39+
id: version
40+
shell: bash
41+
run: |
42+
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
43+
echo "tag=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT
44+
else
45+
echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
46+
fi
47+
48+
- name: Upload to Release
49+
if: startsWith(github.ref, 'refs/tags/')
50+
uses: softprops/action-gh-release@v1
51+
with:
52+
files: |
53+
dist/elecap_win_*_portable.zip
54+
dist/elecap_win_*_installer.zip
55+
dist/elecap-*.exe
56+
env:
57+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
58+
59+
- name: Upload artifacts (for workflow_dispatch)
60+
if: github.event_name == 'workflow_dispatch'
61+
uses: actions/upload-artifact@v4
62+
with:
63+
name: windows-builds
64+
path: |
65+
dist/elecap_win_*_portable.zip
66+
dist/elecap_win_*_installer.zip
67+
dist/elecap-*.exe
68+
69+
- name: Submit to VirusTotal
70+
if: secrets.VIRUSTOTAL_API_KEY != ''
71+
shell: bash
72+
run: |
73+
# Find the portable exe
74+
EXE_FILE=$(ls dist/elecap.exe 2>/dev/null || echo "")
75+
if [ -n "$EXE_FILE" ]; then
76+
echo "Submitting $EXE_FILE to VirusTotal..."
77+
RESPONSE=$(curl -s --request POST \
78+
--url 'https://www.virustotal.com/api/v3/files' \
79+
--header "x-apikey: ${{ secrets.VIRUSTOTAL_API_KEY }}" \
80+
--form "file=@$EXE_FILE")
81+
ANALYSIS_ID=$(echo "$RESPONSE" | jq -r '.data.id // empty')
82+
if [ -n "$ANALYSIS_ID" ]; then
83+
echo "VirusTotal analysis submitted: https://www.virustotal.com/gui/file-analysis/$ANALYSIS_ID"
84+
else
85+
echo "VirusTotal submission response: $RESPONSE"
86+
fi
87+
fi
88+
env:
89+
VIRUSTOTAL_API_KEY: ${{ secrets.VIRUSTOTAL_API_KEY }}
90+
91+
build-linux:
92+
runs-on: ubuntu-latest
93+
steps:
94+
- name: Checkout
95+
uses: actions/checkout@v4
96+
97+
- name: Setup Node.js
98+
uses: actions/setup-node@v4
99+
with:
100+
node-version: '20'
101+
cache: 'npm'
102+
103+
- name: Install dependencies
104+
run: npm ci
105+
env:
106+
WINDOW_AUDIO_CAPTURE_SKIP: '1'
107+
108+
- name: Build Linux
109+
run: npm run build:linux
110+
111+
- name: Upload to Release
112+
if: startsWith(github.ref, 'refs/tags/')
113+
uses: softprops/action-gh-release@v1
114+
with:
115+
files: |
116+
dist/*.AppImage
117+
dist/*.deb
118+
env:
119+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
120+
121+
- name: Upload artifacts (for workflow_dispatch)
122+
if: github.event_name == 'workflow_dispatch'
123+
uses: actions/upload-artifact@v4
124+
with:
125+
name: linux-builds
126+
path: |
127+
dist/*.AppImage
128+
dist/*.deb

0 commit comments

Comments
 (0)