name: Release
on:
push:
tags: ['v*.*.*']
permissions:
contents: write
jobs:
create-release:
name: Create GitHub release
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.release.outputs.upload_url }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Verify tag matches Cargo.toml version
run: |
tag="${GITHUB_REF_NAME#v}"
crate="$(grep -m1 '^version' Cargo.toml | sed -E 's/.*"([^"]+)".*/\1/')"
if [ "$tag" != "$crate" ]; then
echo "::error::Tag ${GITHUB_REF_NAME} does not match Cargo.toml version ${crate}. Tag the release commit, not an earlier one." >&2
exit 1
fi
echo "OK: tag ${GITHUB_REF_NAME} matches Cargo.toml ${crate}"
- name: Create release
id: release
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release create "${GITHUB_REF_NAME}" \
--title "${GITHUB_REF_NAME}" \
--generate-notes \
--verify-tag
upload-binaries:
name: ${{ matrix.target }}
needs: create-release
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
- target: aarch64-unknown-linux-gnu
os: ubuntu-24.04-arm
- target: x86_64-apple-darwin
os: macos-latest
- target: aarch64-apple-darwin
os: macos-latest
- target: x86_64-pc-windows-msvc
os: windows-latest
steps:
- uses: actions/checkout@v4
- name: Install libpcap-dev (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y libpcap-dev
- name: Install Npcap SDK (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
$ErrorActionPreference = 'Stop'
Invoke-WebRequest -Uri 'https://npcap.com/dist/npcap-sdk-1.13.zip' -OutFile 'npcap-sdk.zip'
Expand-Archive -Path 'npcap-sdk.zip' -DestinationPath 'C:\npcap-sdk'
Add-Content -Path $env:GITHUB_ENV -Value "LIB=C:\npcap-sdk\Lib\x64"
- uses: taiki-e/upload-rust-binary-action@v1
with:
bin: seehandshake
target: ${{ matrix.target }}
token: ${{ secrets.GITHUB_TOKEN }}
checksum: sha256
debian-package:
name: Debian package (${{ matrix.arch }})
needs: create-release
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- arch: amd64
os: ubuntu-latest
- arch: arm64
os: ubuntu-24.04-arm
steps:
- uses: actions/checkout@v4
- name: Install build dependencies
run: |
sudo apt-get update
sudo apt-get install -y libpcap-dev
- name: Install cargo-deb
run: cargo install cargo-deb --locked
- name: Build .deb
run: cargo deb
- name: Attach .deb to release
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release upload "${GITHUB_REF_NAME}" target/debian/*.deb --clobber