Update build-windows.yml #4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build and Release masscan for Windows (x64) | |
| on: | |
| push: | |
| branches: [ master ] | |
| tags: | |
| - 'v*' # triggers a release on tags like v1.0.0 | |
| workflow_dispatch: # manual trigger from the Actions tab | |
| jobs: | |
| build-and-release: | |
| runs-on: windows-latest | |
| steps: | |
| # 1. Checkout your source code | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| # 2. Download and extract the Npcap SDK (WinPcap-compatible) | |
| - name: Setup Npcap SDK | |
| run: | | |
| curl -L -o npcap-sdk.zip https://npcap.com/dist/npcap-sdk-1.13.zip | |
| mkdir npcap-sdk | |
| tar -xf npcap-sdk.zip -C npcap-sdk | |
| echo "PCAP_DIR=$env:GITHUB_WORKSPACE\npcap-sdk" >> $env:GITHUB_ENV | |
| shell: pwsh | |
| # 3. Configure MSVC x64 environment | |
| - name: Setup MSVC Developer Command Prompt | |
| uses: ilammy/msvc-dev-cmd@v1 | |
| with: | |
| arch: x64 | |
| # 4. Build masscan.exe using the provided Makefile.msvc | |
| - name: Build masscan | |
| run: | | |
| nmake -f Makefile.msvc | |
| shell: cmd | |
| # 5. Verify the executable was created | |
| - name: Check binary | |
| run: | | |
| if not exist "bin\masscan.exe" exit /b 1 | |
| shell: cmd | |
| # 6. Upload the exe as an artifact (useful for testing on every push) | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: masscan-win64 | |
| path: bin\masscan.exe | |
| # 7. Create a GitHub Release and attach the exe (only on tag pushes) | |
| - name: Create Release | |
| if: startsWith(github.ref, 'refs/tags/') | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: bin\masscan.exe | |
| name: ${{ github.ref_name }} | |
| body: | | |
| Automated masscan Windows 64-bit build. | |
| Commit: ${{ github.sha }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |