Skip to content

Commit 7852f63

Browse files
authored
Merge branch 'Publish' into main
2 parents 6fb9f54 + 5d35dbc commit 7852f63

File tree

2 files changed

+94
-37
lines changed

2 files changed

+94
-37
lines changed

.github/workflows/publish-pypi.yml

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
name: Auto-bump version, release, and publish
2+
3+
on:
4+
push:
5+
branches:
6+
- Publish
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
bump-release-publish:
13+
name: Auto-bump version and publish
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Check out repository
18+
uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0
21+
22+
- name: Set up Python
23+
uses: actions/setup-python@v5
24+
with:
25+
python-version: "3.11"
26+
27+
- name: Install dependencies
28+
run: |
29+
python -m pip install --upgrade pip
30+
python -m pip install build twine toml
31+
32+
- name: Auto-increment version
33+
id: bump
34+
run: |
35+
python - << 'PY'
36+
import toml
37+
from pathlib import Path
38+
39+
path = Path("pyproject.toml")
40+
data = toml.loads(path.read_text())
41+
42+
version = data["project"]["version"]
43+
44+
major, minor, patch = version.split(".")
45+
patch = str(int(patch) + 1)
46+
new_version = ".".join([major, minor, patch])
47+
48+
data["project"]["version"] = new_version
49+
50+
path.write_text(toml.dumps(data))
51+
52+
print(f"Bumped version: {version} -> {new_version}")
53+
54+
# Export for later steps
55+
with open(Path("$GITHUB_OUTPUT"), "a") as f:
56+
f.write(f"new_version={new_version}\n")
57+
PY
58+
59+
- name: Commit updated version
60+
run: |
61+
git config user.name "github-actions"
62+
git config user.email "[email protected]"
63+
git add pyproject.toml
64+
git commit -m "Auto-bump version to ${{ steps.bump.outputs.new_version }}"
65+
git push
66+
67+
- name: Build distributions
68+
run: |
69+
python -m build
70+
71+
- name: Publish to PyPI
72+
env:
73+
TWINE_USERNAME: "__token__"
74+
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
75+
run: |
76+
twine upload dist/*
77+
78+
- name: Create GitHub release
79+
uses: softprops/action-gh-release@v2
80+
with:
81+
tag_name: v${{ steps.bump.outputs.new_version }}
82+
name: nessus-plugin-hosts v${{ steps.bump.outputs.new_version }}
83+
generate_release_notes: true
84+
env:
85+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

pyproject.toml

Lines changed: 9 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -4,47 +4,19 @@ version = "1.0.0"
44
description = "Hunts Jenkins jobs and builds for sensitive information in Jenkins environment variables"
55
readme = "README.md"
66
requires-python = ">=3.7"
7+
keywords = [ "jenkins", "security", "environment-variables", "pentest", "infosec",]
8+
classifiers = [ "Development Status :: 4 - Beta", "Intended Audience :: Information Technology", "Intended Audience :: System Administrators", "Topic :: Security", "Topic :: Software Development :: Testing", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11",]
9+
dependencies = [ "requests", "alive-progress",]
10+
[[project.authors]]
11+
name = "Defensive Origins"
712

8-
authors = [
9-
{ name = "Defensive Origins" }
10-
]
11-
12-
keywords = [
13-
"jenkins",
14-
"security",
15-
"environment-variables",
16-
"pentest",
17-
"infosec"
18-
]
19-
20-
classifiers = [
21-
"Development Status :: 4 - Beta",
22-
"Intended Audience :: Information Technology",
23-
"Intended Audience :: System Administrators",
24-
"Topic :: Security",
25-
"Topic :: Software Development :: Testing",
26-
"Programming Language :: Python :: 3",
27-
"Programming Language :: Python :: 3.7",
28-
"Programming Language :: Python :: 3.8",
29-
"Programming Language :: Python :: 3.9",
30-
"Programming Language :: Python :: 3.10",
31-
"Programming Language :: Python :: 3.11",
32-
]
33-
34-
dependencies = [
35-
"requests",
36-
"alive-progress",
37-
]
13+
[build-system]
14+
requires = [ "setuptools>=61.0",]
15+
build-backend = "setuptools.build_meta"
3816

39-
# These map to CLI commands installed by pip
4017
[project.scripts]
4118
jenkins-env-hunter = "JenkinsEnvHunter:main"
4219
jenkins-check-noauth = "CheckNoAuth:main"
4320

44-
[build-system]
45-
requires = ["setuptools>=61.0"]
46-
build-backend = "setuptools.build_meta"
47-
48-
# Tell setuptools to include the two top-level modules as installable
4921
[tool.setuptools]
50-
py-modules = ["JenkinsEnvHunter", "CheckNoAuth"]
22+
py-modules = [ "JenkinsEnvHunter", "CheckNoAuth",]

0 commit comments

Comments
 (0)