Skip to content

Release

Release #83

Workflow file for this run

name: Release
on: workflow_dispatch
permissions:
contents: write
jobs:
build-windows:
name: Build Windows
runs-on: windows-latest
steps:
- name: Checkout Source Code
uses: actions/checkout@v4
- name: Get Rust Toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: Build pktmon version
uses: actions-rs/cargo@v1
with:
command: build
args: --release --features pktmon
- name: Move pktmon exe
run: mv -Force target/release/stardb-exporter.exe target/release/stardb-exporter-pktmon.exe
- name: Get Npcap Sdk
run: |
curl https://npcap.com/dist/npcap-sdk-1.16.zip -o sdk.zip
unzip sdk.zip
- name: Build npcap version
uses: actions-rs/cargo@v1
with:
command: build
args: --release --features pcap
env:
LIB: ${{ github.workspace }}/Lib/x64/
- name: Move pcap exe
run: mv -Force target/release/stardb-exporter.exe target/release/stardb-exporter-pcap.exe
- name: Upload pktmon Artifact
uses: actions/upload-artifact@v4
with:
name: windows-pktmon
path: target/release/stardb-exporter-pktmon.exe
- name: Upload pcap Artifact
uses: actions/upload-artifact@v4
with:
name: windows-pcap
path: target/release/stardb-exporter-pcap.exe
build-linux:
name: Build Linux
runs-on: ubuntu-latest
steps:
- name: Checkout Source Code
uses: actions/checkout@v4
- name: Install libpcap
run: sudo apt-get update && sudo apt-get install -y libpcap-dev
- name: Get Rust Toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: Build
uses: actions-rs/cargo@v1
with:
command: build
args: --release --features pcap
- name: Cap Net Raw
run: sudo setcap CAP_NET_RAW=+ep target/release/stardb-exporter
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: linux
path: target/release/stardb-exporter
build-macos:
name: Build Macos
runs-on: macos-latest
steps:
- name: Checkout Source Code
uses: actions/checkout@v4
- name: Install libpcap
run: brew update && brew install libpcap
- name: Get Rust Toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: Build
uses: actions-rs/cargo@v1
with:
command: build
args: --release --features pcap
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: macos
path: target/release/stardb-exporter
release:
name: Release
needs: [build-windows, build-linux, build-macos]
runs-on: ubuntu-latest
steps:
- name: Checkout Source Code
uses: actions/checkout@v4
- name: Get package version
id: cargo-get
uses: nicolaiunrein/cargo-get@master
with:
subcommand: package.version
- name: Download Artifacts
uses: actions/download-artifact@v4
- name: Rename
run: |
cp windows-pktmon/stardb-exporter-pktmon.exe stardb-exporter-pktmon.exe
zip stardb-exporter-pktmon-v${{ steps.cargo-get.outputs.metadata }}-x86_64-pc-windows-msvc.zip stardb-exporter-pktmon.exe
cp windows-pcap/stardb-exporter-pcap.exe stardb-exporter-pcap.exe
zip stardb-exporter-pcap-v${{ steps.cargo-get.outputs.metadata }}-x86_64-pc-windows-msvc.zip stardb-exporter-pcap.exe
cp linux/stardb-exporter stardb-exporter
cp stardb-exporter stardb-exporter-linux
zip stardb-exporter-v${{ steps.cargo-get.outputs.metadata }}-x86_64-unknown-linux-gnu.zip stardb-exporter
cp macos/stardb-exporter stardb-exporter
cp stardb-exporter stardb-exporter-macos
zip stardb-exporter-v${{ steps.cargo-get.outputs.metadata }}-x86_64-apple-darwin.zip stardb-exporter
- name: Release
uses: marvinpinto/action-automatic-releases@latest
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
automatic_release_tag: v${{ steps.cargo-get.outputs.metadata }}
prerelease: false
title: v${{ steps.cargo-get.outputs.metadata }} Release
files: |
stardb-exporter-pktmon.exe
stardb-exporter-pcap.exe
stardb-exporter-linux
stardb-exporter-macos
stardb-exporter-pktmon-v${{ steps.cargo-get.outputs.metadata }}-x86_64-pc-windows-msvc.zip
stardb-exporter-pcap-v${{ steps.cargo-get.outputs.metadata }}-x86_64-pc-windows-msvc.zip
stardb-exporter-v${{ steps.cargo-get.outputs.metadata }}-x86_64-unknown-linux-gnu.zip
stardb-exporter-v${{ steps.cargo-get.outputs.metadata }}-x86_64-apple-darwin.zip