Skip to content

Commit 2a64bc1

Browse files
authored
Merge PR #4546 from @phantinuss - Update Release Script and Workflow
chore: use less strict merge messages chore: add version.txt to release packages chore: generate release as draft to enable manual reviewing
1 parent 559cc6b commit 2a64bc1

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
git log --pretty=%B ${prev_tag}..${curr_tag} | grep -E '^\s*update: ' | sort | sed -e 's%^% - %' >> changes.txt
2727
if [[ $(git log --pretty=%B ${prev_tag}..${curr_tag} | grep -E '^\s*fix: ' -c) -gt 0 ]]; then echo "### Fixed Rules" >> changes.txt; fi
2828
git log --pretty=%B ${prev_tag}..${curr_tag} | grep -E '^\s*fix: ' | sort | sed -e 's%^% - %' >> changes.txt
29-
git log --pretty=%B ${prev_tag}..${curr_tag} | grep -oP 'Merge PR #\d+ from \K(@\S+)' | sort -u > authors_raw.txt
29+
git log --pretty=%B ${prev_tag}..${curr_tag} | grep -ioP 'Merge PR #\d+ from \K(@\S+)' | sort -u > authors_raw.txt
3030
git log --pretty=%B ${prev_tag}..${curr_tag} | grep -oP "Co-authored-by: \K.*(?= <)" | sort -u | sed -e 's%^%@%' >> authors_raw.txt
3131
LC_ALL=en_US.UTF-8 sort -u authors_raw.txt | grep -v 'dependabot\[bot\]' > authors.txt
3232
cat changes.txt >> changelog.txt
@@ -55,7 +55,7 @@ jobs:
5555
name: Release ${{ github.ref_name }}
5656
body_path: changelog.txt
5757
token: ${{ secrets.GITHUB_TOKEN }}
58-
draft: false
58+
draft: true
5959
prerelease: false
6060
files: |
6161
sigma_core.zip

tests/sigma-package-release.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,16 @@
44
Creates the Sigma release archive packages for different configurations
55
66
EXAMPLE
7-
# python3 sigma-package-release.py --min-status testing --levels high critical --rule-types generic --outfile Sigma-standard.zip
7+
# python3 sigma-package-release.py --min-status test --levels high critical --rule-types generic --outfile Sigma-standard.zip
88
"""
99

1010
import os
1111
import sys
1212
import argparse
1313
import yaml
1414
import zipfile
15-
15+
import datetime
16+
import subprocess
1617

1718
STATUS = ["experimental", "test", "stable"]
1819
LEVEL = ["informational", "low", "medium", "high", "critical"]
@@ -137,6 +138,15 @@ def write_zip(outfile: str, selected_rules: list):
137138
) as zip:
138139
for rule_path in selected_rules:
139140
zip.write(rule_path)
141+
142+
# Write version info text file
143+
today = datetime.date.today().isoformat()
144+
label = subprocess.check_output(["git", "describe", "--always"]).strip()
145+
commit_hash = subprocess.check_output(["git", "rev-parse", "HEAD"]).strip()
146+
version = "Release Date: {}\nLabel: {}\nCommit-Hash: {}\n".format(
147+
today, label.decode(), commit_hash.decode()
148+
)
149+
zip.writestr("version.txt", version)
140150
return
141151

142152

0 commit comments

Comments
 (0)