Skip to content

Commit 401c09a

Browse files
author
Advait Patel
committed
fixing the results folder structure for exporting the outputs
- fixing the results folder structure for exporting the outputs - adding github actions for PYPI
1 parent 751c998 commit 401c09a

7 files changed

Lines changed: 88 additions & 14 deletions

File tree

.DS_Store

6 KB
Binary file not shown.
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: Publish to PyPI
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*.*.*' # Triggers on version tags like v0.0.21, v1.0.0, etc.
7+
8+
jobs:
9+
publish:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: read
13+
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v4
17+
18+
- name: Set up Python
19+
uses: actions/setup-python@v4
20+
with:
21+
python-version: '3.12'
22+
23+
- name: Install build dependencies
24+
run: |
25+
python -m pip install --upgrade pip
26+
pip install build twine
27+
28+
- name: Extract version from tag
29+
id: get_version
30+
run: |
31+
# Get the tag name (e.g., v0.0.21)
32+
TAG=${GITHUB_REF#refs/tags/v}
33+
echo "VERSION=$TAG" >> $GITHUB_OUTPUT
34+
echo "Publishing version: $TAG"
35+
36+
- name: Verify version matches setup.py
37+
run: |
38+
SETUP_VERSION=$(python -c "import re; content=open('setup.py').read(); print(re.search(r'version=\"([^\"]+)\"', content).group(1))")
39+
TAG_VERSION="${{ steps.get_version.outputs.VERSION }}"
40+
echo "setup.py version: $SETUP_VERSION"
41+
echo "Git tag version: $TAG_VERSION"
42+
if [ "$SETUP_VERSION" != "$TAG_VERSION" ]; then
43+
echo "ERROR: Version mismatch!"
44+
echo "setup.py has version $SETUP_VERSION but git tag is v$TAG_VERSION"
45+
exit 1
46+
fi
47+
echo "✅ Versions match!"
48+
49+
- name: Build package
50+
run: python -m build
51+
52+
- name: Check distribution files
53+
run: |
54+
ls -lh dist/
55+
twine check dist/*
56+
57+
- name: Publish to PyPI
58+
env:
59+
TWINE_USERNAME: __token__
60+
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
61+
run: |
62+
twine upload dist/*
63+
64+
- name: Create GitHub Release
65+
uses: softprops/action-gh-release@v1
66+
with:
67+
generate_release_notes: true
68+
files: |
69+
dist/*.tar.gz
70+
dist/*.whl

.gitignore

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -193,12 +193,3 @@ SESSION_SUMMARY.md
193193
CURSOR_CONFIGURATION.md
194194

195195
# Internal/maintainer documentation (not for public repository)
196-
PUBLISHING_GUIDE.md
197-
RELEASE_CHECKLIST.md
198-
IMPLEMENTATION_SUMMARY.md
199-
COMMIT_GUIDE.md
200-
PYPI_UPLOAD_READY.md
201-
REDDIT_POSTS.md
202-
CLEANUP_PLAN.md
203-
CLEANUP_SUMMARY.md
204-
CLEANUP_COMPLETE.md

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,10 @@ Quick links:
199199
**"Python version not supported"**
200200
→ DockSec requires Python 3.12+. Use `pyenv install 3.12` to upgrade.
201201

202+
**"Where are my scan results?"**
203+
→ Results are saved to `results/` directory in your DockSec installation
204+
→ Customize location: `export DOCKSEC_RESULTS_DIR=/custom/path`
205+
202206
For more issues, see [Troubleshooting Guide](docs/CONTRIBUTING.md#troubleshooting).
203207

204208
## License

config.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,13 @@ def get_openai_api_key() -> str:
5252

5353
BASE_DIR: str = os.path.abspath(os.path.dirname(__file__))
5454

55-
# RESULTS_DIR = os.path.join(BASE_DIR, "results")
56-
RESULTS_DIR: str = os.path.join(os.getcwd(), "results")
55+
# Results directory configuration
56+
# Priority: 1. Environment variable, 2. DockSec installation directory (default)
57+
# Users can customize by setting: export DOCKSEC_RESULTS_DIR=/custom/path
58+
RESULTS_DIR: str = os.getenv("DOCKSEC_RESULTS_DIR", os.path.join(BASE_DIR, "results"))
5759

58-
os.makedirs(os.path.dirname(RESULTS_DIR), exist_ok=True)
60+
# Create results directory if it doesn't exist
61+
os.makedirs(RESULTS_DIR, exist_ok=True)
5962

6063

6164

docker_scanner.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -944,7 +944,13 @@ def generate_all_reports(self, results: Dict) -> Dict:
944944
report_paths['html'] = html_path
945945
progress.update(html_task, advance=1)
946946

947-
print("\n[SUCCESS] All reports generated successfully!")
947+
print("[SUCCESS] All reports generated successfully!")
948+
print(f"Results location: {self.RESULTS_DIR}")
949+
print(f"\nGenerated files:")
950+
for report_type, path in report_paths.items():
951+
if path:
952+
print(f" • {report_type.upper()}: {os.path.basename(path)}")
953+
948954
return report_paths
949955

950956
def get_security_score(self, results: Dict) -> float:

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import glob
44
setup(
55
name="docksec",
6-
version="0.0.20",
6+
version="2026.1.24",
77
description="AI-Powered Docker Security Analyzer",
88
long_description=open("README.md").read(),
99
long_description_content_type="text/markdown",

0 commit comments

Comments
 (0)