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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
name: Release
on:
push:
tags:
permissions:
contents: write
jobs:
build:
strategy:
matrix:
include:
- target: aarch64-apple-darwin
os: macos-latest
- target: x86_64-apple-darwin
os: macos-15
- target: x86_64-unknown-linux-musl
os: ubuntu-latest
- target: aarch64-unknown-linux-musl
os: ubuntu-latest
- target: x86_64-pc-windows-msvc
os: windows-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- name: Set version
id: version
shell: bash
run: echo "version=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT"
- uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable
with:
targets: ${{ matrix.target }}
- uses: Swatinem/rust-cache@v2
- name: Install musl tools (Linux)
if: contains(matrix.target, 'musl')
run: |
sudo apt-get update
sudo apt-get install -y musl-tools
if [[ "${{ matrix.target }}" == "aarch64-unknown-linux-musl" ]]; then
sudo apt-get install -y gcc-aarch64-linux-gnu
echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER=aarch64-linux-gnu-gcc" >> $GITHUB_ENV
fi
- name: Build
run: cargo build --release --target ${{ matrix.target }} -p forensicnomicon-cli
- name: Package (Unix)
if: runner.os != 'Windows'
run: |
cd target/${{ matrix.target }}/release
cp ../../../dist/4q .
chmod +x 4q
tar czf ../../../4n6query-${{ steps.version.outputs.version }}-${{ matrix.target }}.tar.gz 4n6query 4q
cd ../../..
- name: Install cargo-wix (Windows)
if: runner.os == 'Windows'
run: cargo install cargo-wix --version 0.3.9 --locked
- name: Build MSI (Windows)
if: runner.os == 'Windows'
run: cargo wix --package forensicnomicon-cli --no-build --target ${{ matrix.target }} --output 4n6query-${{ steps.version.outputs.version }}-${{ matrix.target }}.msi
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: 4n6query-${{ steps.version.outputs.version }}-${{ matrix.target }}
path: 4n6query-${{ steps.version.outputs.version }}-${{ matrix.target }}.*
release:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
path: artifacts
pattern: '4n6query-*'
merge-multiple: true
- name: Generate checksums
run: |
cd artifacts
sha256sum * > checksums.txt
cat checksums.txt
- name: Create GitHub Release
uses: softprops/action-gh-release@153bb8e04406b158c6c84fc1615b65b24149a1fe # v2.6.1
with:
files: |
artifacts/4n6query-*
artifacts/checksums.txt
generate_release_notes: true
- name: Dispatch to Homebrew tap
continue-on-error: true
uses: peter-evans/repository-dispatch@ff45666b9427631e3450c54a1bcbee4d9ff4d7c0 # v3.0.0
with:
token: ${{ secrets.TAP_GITHUB_TOKEN }}
repository: SecurityRonin/homebrew-tap
event-type: update-formula
client-payload: '{"formula": "4n6query", "version": "${{ github.ref_name }}"}'
crate:
needs: release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable
- uses: Swatinem/rust-cache@v2
- name: Publish lib to crates.io
run: |
output=$(cargo publish -p forensicnomicon --allow-dirty 2>&1) && echo "$output" || {
echo "$output"
echo "$output" | grep -q "already exists on crates.io" || exit 1
echo "Version already published to crates.io, skipping"
}
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
# crates.io index takes ~30s to propagate before dependents can publish
- name: Wait for crates.io index
run: sleep 60
- name: Publish CLI to crates.io
run: |
output=$(cargo publish -p forensicnomicon-cli --allow-dirty 2>&1) && echo "$output" || {
echo "$output"
echo "$output" | grep -q "already exists on crates.io" || exit 1
echo "Version already published to crates.io, skipping"
}
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
winget:
needs: release
runs-on: windows-latest
# First-time winget submission requires a manual PR; continue-on-error until registered
continue-on-error: true
steps:
- uses: vedantmgoyal9/winget-releaser@4ffc7888bffd451b357355dc214d43bb9f23917e # v2
with:
identifier: SecurityRonin.4n6query
installers-regex: '\.msi$'
token: ${{ secrets.WINGET_TOKEN }}
fork-user: securityronin-bot
deb:
strategy:
matrix:
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
arch: amd64
- target: aarch64-unknown-linux-gnu
os: ubuntu-latest
arch: arm64
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable
with:
targets: ${{ matrix.target }}
- uses: Swatinem/rust-cache@v2
- name: Install cross-compilation tools
if: matrix.target == 'aarch64-unknown-linux-gnu'
run: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu
echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc" >> $GITHUB_ENV
- name: Install cargo-deb
run: cargo install cargo-deb --version 2.11.2 --locked
- name: Build .deb package
run: cargo deb -p forensicnomicon-cli --target ${{ matrix.target }}
- name: Find .deb file
id: find_deb
run: |
DEB_FILE=$(find target/${{ matrix.target }}/debian -name '*.deb' | head -1)
echo "deb_path=$DEB_FILE" >> $GITHUB_OUTPUT
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: 4n6query-${{ matrix.arch }}.deb
path: ${{ steps.find_deb.outputs.deb_path }}
release-deb:
needs:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
pattern: 4n6query-*.deb
path: debs
merge-multiple: true
- name: Upload .deb to GitHub Release
uses: softprops/action-gh-release@153bb8e04406b158c6c84fc1615b65b24149a1fe # v2.6.1
with:
files: debs/*.deb
cloudsmith:
needs: release-deb
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
pattern: 4n6query-*.deb
path: debs
merge-multiple: true
- name: Install Cloudsmith CLI
run: |
pip install --user cloudsmith-cli==1.16.0
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
- name: Push amd64 to Cloudsmith
env:
CLOUDSMITH_API_KEY: ${{ secrets.CLOUDSMITH_API_KEY }}
run: cloudsmith push deb securityronin/forensicnomicon/any-distro/any-version debs/forensicnomicon-cli_*_amd64.deb
- name: Push arm64 to Cloudsmith
env:
CLOUDSMITH_API_KEY: ${{ secrets.CLOUDSMITH_API_KEY }}
run: cloudsmith push deb securityronin/forensicnomicon/any-distro/any-version debs/forensicnomicon-cli_*_arm64.deb