-
Notifications
You must be signed in to change notification settings - Fork 25
164 lines (133 loc) · 4.9 KB
/
Copy pathrelease.yml
File metadata and controls
164 lines (133 loc) · 4.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
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.15.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