Skip to content

Commit eb9b7e6

Browse files
authored
Update build-windows.yml
1 parent fab0827 commit eb9b7e6

1 file changed

Lines changed: 46 additions & 11 deletions

File tree

Lines changed: 46 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,64 @@
1-
name: Build masscan for Windows
1+
name: Build and Release masscan for Windows (x64)
22

33
on:
44
push:
55
branches: [ master ]
6-
workflow_dispatch:
6+
tags:
7+
- 'v*' # triggers a release on tags like v1.0.0
8+
workflow_dispatch: # manual trigger from the Actions tab
79

810
jobs:
9-
build:
11+
build-and-release:
1012
runs-on: windows-latest
11-
defaults:
12-
run:
13-
shell: cmd
13+
1414
steps:
15-
- uses: actions/checkout@v4
15+
# 1. Checkout your source code
16+
- name: Checkout code
17+
uses: actions/checkout@v4
18+
19+
# 2. Download and extract the Npcap SDK (WinPcap-compatible)
20+
- name: Setup Npcap SDK
21+
run: |
22+
curl -L -o npcap-sdk.zip https://npcap.com/dist/npcap-sdk-1.13.zip
23+
mkdir npcap-sdk
24+
tar -xf npcap-sdk.zip -C npcap-sdk
25+
echo "PCAP_DIR=$env:GITHUB_WORKSPACE\npcap-sdk" >> $env:GITHUB_ENV
26+
shell: pwsh
1627

17-
- name: Setup MSBuild
18-
uses: microsoft/setup-msbuild@v1
28+
# 3. Configure MSVC x64 environment
29+
- name: Setup MSVC Developer Command Prompt
30+
uses: ilammy/msvc-dev-cmd@v1
31+
with:
32+
arch: x64
1933

34+
# 4. Build masscan.exe using the provided Makefile.msvc
2035
- name: Build masscan
2136
run: |
22-
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\VsDevCmd.bat" -arch=x64 -host_arch=x64
23-
nmake -f Makefile.msvc all
37+
nmake -f Makefile.msvc
38+
shell: cmd
2439

40+
# 5. Verify the executable was created
41+
- name: Check binary
42+
run: |
43+
if not exist "bin\masscan.exe" exit /b 1
44+
shell: cmd
45+
46+
# 6. Upload the exe as an artifact (useful for testing on every push)
2547
- name: Upload artifact
2648
uses: actions/upload-artifact@v4
2749
with:
2850
name: masscan-win64
2951
path: bin\masscan.exe
52+
53+
# 7. Create a GitHub Release and attach the exe (only on tag pushes)
54+
- name: Create Release
55+
if: startsWith(github.ref, 'refs/tags/')
56+
uses: softprops/action-gh-release@v2
57+
with:
58+
files: bin\masscan.exe
59+
name: ${{ github.ref_name }}
60+
body: |
61+
Automated masscan Windows 64-bit build.
62+
Commit: ${{ github.sha }}
63+
env:
64+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)