Skip to content

Commit 7ffc17c

Browse files
committed
Release v1.1.0: year/limit filters and unified release workflow
1 parent a6e6ba8 commit 7ffc17c

4 files changed

Lines changed: 314 additions & 107 deletions

File tree

.github/workflows/release.yml

Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
name: Release
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
tags:
7+
- "v*"
8+
9+
permissions:
10+
contents: write
11+
12+
jobs:
13+
build:
14+
name: Build (${{ matrix.asset_suffix }})
15+
runs-on: ${{ matrix.runs_on }}
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
include:
20+
- runs_on: windows-latest
21+
asset_suffix: windows-x64
22+
add_data: "VERSION;."
23+
exe_name: cvecli.exe
24+
- runs_on: ubuntu-latest
25+
asset_suffix: linux-x64
26+
add_data: "VERSION:."
27+
exe_name: cvecli
28+
- runs_on: macos-13
29+
asset_suffix: macos-x64
30+
add_data: "VERSION:."
31+
exe_name: cvecli
32+
- runs_on: macos-14
33+
asset_suffix: macos-arm64
34+
add_data: "VERSION:."
35+
exe_name: cvecli
36+
37+
steps:
38+
- name: Checkout
39+
uses: actions/checkout@v4
40+
41+
- name: Derive version
42+
id: version
43+
shell: bash
44+
run: |
45+
tag="${GITHUB_REF_NAME}"
46+
version="${tag#v}"
47+
echo "version=$version" >> "$GITHUB_OUTPUT"
48+
printf '%s\n' "$version" > VERSION
49+
50+
- name: Set up Python
51+
uses: actions/setup-python@v5
52+
with:
53+
python-version: "3.12"
54+
55+
- name: Install dependencies
56+
shell: bash
57+
run: |
58+
python -m pip install --upgrade pip
59+
python -m pip install -r requirements.txt
60+
python -m pip install pyinstaller
61+
62+
- name: Build binary (PyInstaller)
63+
shell: bash
64+
run: |
65+
pyinstaller --noconfirm --clean --onefile --name cvecli --add-data "${{ matrix.add_data }}" cve_search_cli.py
66+
67+
- name: Package + checksums
68+
shell: bash
69+
run: |
70+
python - <<'PY'
71+
import hashlib
72+
import os
73+
import pathlib
74+
import zipfile
75+
from datetime import datetime
76+
77+
version = os.environ["VERSION"]
78+
suffix = os.environ["ASSET_SUFFIX"]
79+
exe_name = os.environ["EXE_NAME"]
80+
81+
repo = pathlib.Path(".").resolve()
82+
dist = repo / "dist"
83+
exe_path = dist / exe_name
84+
if not exe_path.exists():
85+
raise SystemExit(f"missing built binary: {exe_path}")
86+
87+
zip_name = f"cvecli-{version}-{suffix}.zip"
88+
sha_name = f"SHA256SUMS-{suffix}.txt"
89+
90+
def sha256_file(path: pathlib.Path) -> str:
91+
h = hashlib.sha256()
92+
with path.open("rb") as f:
93+
for chunk in iter(lambda: f.read(1024 * 1024), b""):
94+
h.update(chunk)
95+
return h.hexdigest()
96+
97+
files_for_zip = [
98+
(exe_path, exe_name),
99+
(repo / "LICENSE", "LICENSE"),
100+
(repo / "README.md", "README.md"),
101+
]
102+
103+
with zipfile.ZipFile(zip_name, "w", compression=zipfile.ZIP_DEFLATED) as zf:
104+
for src, arc in files_for_zip:
105+
zf.write(src, arcname=arc)
106+
107+
lines = []
108+
lines.append(f"{sha256_file(exe_path)} {exe_name}")
109+
lines.append(f"{sha256_file(pathlib.Path(zip_name))} {zip_name}")
110+
pathlib.Path(sha_name).write_text("\n".join(lines) + "\n", encoding="ascii")
111+
print(f"Wrote {zip_name} and {sha_name} at {datetime.utcnow().isoformat()}Z")
112+
PY
113+
env:
114+
VERSION: ${{ steps.version.outputs.version }}
115+
ASSET_SUFFIX: ${{ matrix.asset_suffix }}
116+
EXE_NAME: ${{ matrix.exe_name }}
117+
118+
- name: Upload artifacts
119+
uses: actions/upload-artifact@v4
120+
with:
121+
name: release-${{ matrix.asset_suffix }}
122+
path: |
123+
dist/${{ matrix.exe_name }}
124+
cvecli-${{ steps.version.outputs.version }}-${{ matrix.asset_suffix }}.zip
125+
SHA256SUMS-${{ matrix.asset_suffix }}.txt
126+
127+
release:
128+
name: Create GitHub Release
129+
runs-on: ubuntu-latest
130+
needs: build
131+
steps:
132+
- name: Download artifacts
133+
uses: actions/download-artifact@v4
134+
with:
135+
path: release_assets
136+
137+
- name: Consolidate checksums
138+
shell: bash
139+
run: |
140+
set -euo pipefail
141+
find release_assets -type f -name "SHA256SUMS-*.txt" -print0 | sort -z | xargs -0 cat > SHA256SUMS.txt
142+
143+
- name: Publish GitHub Release assets
144+
uses: softprops/action-gh-release@v2
145+
with:
146+
files: |
147+
release_assets/**/cvecli*
148+
release_assets/**/SHA256SUMS-*.txt
149+
SHA256SUMS.txt

.github/workflows/windows-release.yml

Lines changed: 0 additions & 73 deletions
This file was deleted.

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ A command-line tool to search for CVEs (Common Vulnerabilities and Exposures) us
1616
## Features
1717
- Search CVEs by ID (using cve.circl.lu)
1818
- Search CVEs by keyword in description (using NVD)
19+
- Filter keyword searches by published year
1920
- Prints formatted CVE details (ID, published/modified date, CVSS score, severity, description, references)
2021
- Interactive menu or command-line arguments
2122

@@ -104,6 +105,7 @@ Or pass arguments directly:
104105
```bash
105106
docker run --rm cvecli --id CVE-2025-55184
106107
docker run --rm cvecli --keyword wordpress
108+
docker run --rm cvecli --keyword apache --year 2026
107109
```
108110

109111
## Usage
@@ -123,6 +125,16 @@ cvecli --id CVE-2025-55184
123125
cvecli --keyword wordpress
124126
```
125127

128+
### Search by Keyword with Limit
129+
```bash
130+
cvecli --keyword kernel --limit 10
131+
```
132+
133+
### Search by Keyword and Year
134+
```bash
135+
cvecli --keyword apache --year 2026
136+
```
137+
126138
## Output Example
127139
Results are shown in the terminal with color formatting for better readability.
128140

@@ -136,6 +148,7 @@ Results are shown in the terminal with color formatting for better readability.
136148

137149
- CVE ID search uses the cve.circl.lu API.
138150
- Keyword search uses the NVD API and returns up to 5 results per search.
151+
- Year filtering applies to keyword searches and matches the CVE ID year.
139152

140153
## Disclaimer
141154
This tool is provided for educational and informational purposes only. The owner and contributors are not responsible for any misuse, damage, or legal issues resulting from the use of this software. Use at your own risk.

0 commit comments

Comments
 (0)