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
This commit is contained in:
phantinuss
2023-11-06 15:40:11 +01:00
committed by GitHub
parent 559cc6bbab
commit 2a64bc1f88
2 changed files with 14 additions and 4 deletions
+2 -2
View File
@@ -26,7 +26,7 @@ jobs:
git log --pretty=%B ${prev_tag}..${curr_tag} | grep -E '^\s*update: ' | sort | sed -e 's%^% - %' >> changes.txt
if [[ $(git log --pretty=%B ${prev_tag}..${curr_tag} | grep -E '^\s*fix: ' -c) -gt 0 ]]; then echo "### Fixed Rules" >> changes.txt; fi
git log --pretty=%B ${prev_tag}..${curr_tag} | grep -E '^\s*fix: ' | sort | sed -e 's%^% - %' >> changes.txt
git log --pretty=%B ${prev_tag}..${curr_tag} | grep -oP 'Merge PR #\d+ from \K(@\S+)' | sort -u > authors_raw.txt
git log --pretty=%B ${prev_tag}..${curr_tag} | grep -ioP 'Merge PR #\d+ from \K(@\S+)' | sort -u > authors_raw.txt
git log --pretty=%B ${prev_tag}..${curr_tag} | grep -oP "Co-authored-by: \K.*(?= <)" | sort -u | sed -e 's%^%@%' >> authors_raw.txt
LC_ALL=en_US.UTF-8 sort -u authors_raw.txt | grep -v 'dependabot\[bot\]' > authors.txt
cat changes.txt >> changelog.txt
@@ -55,7 +55,7 @@ jobs:
name: Release ${{ github.ref_name }}
body_path: changelog.txt
token: ${{ secrets.GITHUB_TOKEN }}
draft: false
draft: true
prerelease: false
files: |
sigma_core.zip
+12 -2
View File
@@ -4,7 +4,7 @@
Creates the Sigma release archive packages for different configurations
EXAMPLE
# python3 sigma-package-release.py --min-status testing --levels high critical --rule-types generic --outfile Sigma-standard.zip
# python3 sigma-package-release.py --min-status test --levels high critical --rule-types generic --outfile Sigma-standard.zip
"""
import os
@@ -12,7 +12,8 @@ import sys
import argparse
import yaml
import zipfile
import datetime
import subprocess
STATUS = ["experimental", "test", "stable"]
LEVEL = ["informational", "low", "medium", "high", "critical"]
@@ -137,6 +138,15 @@ def write_zip(outfile: str, selected_rules: list):
) as zip:
for rule_path in selected_rules:
zip.write(rule_path)
# Write version info text file
today = datetime.date.today().isoformat()
label = subprocess.check_output(["git", "describe", "--always"]).strip()
commit_hash = subprocess.check_output(["git", "rev-parse", "HEAD"]).strip()
version = "Release Date: {}\nLabel: {}\nCommit-Hash: {}\n".format(
today, label.decode(), commit_hash.decode()
)
zip.writestr("version.txt", version)
return