1- name : Query syntax validation
1+ name : Generate query bundle and push release
22on :
3- pull_request :
4- branches : [ 'main' ]
5-
63 workflow_dispatch :
7-
8- permissions :
9- contents : write
4+ push :
5+ branches :
6+ - main
107
118jobs :
129 test :
1310 runs-on : ubuntu-latest
1411
1512 steps :
1613 - uses : actions/checkout@v4
17- with :
18- ref : ${{ github.head_ref }}
1914 - name : Set up Python 3.10
2015 uses : actions/setup-python@v3
2116 with :
@@ -38,42 +33,46 @@ jobs:
3833 name : test-report
3934 path : test-report.md
4035
41- build :
36+
37+ release :
4238 runs-on : ubuntu-latest
4339 needs : test
4440 steps :
4541 - uses : actions/checkout@v4
46- with :
47- ref : ${{ github.head_ref }}
4842 - name : Set up Python 3.10
4943 uses : actions/setup-python@v3
5044 with :
5145 python-version : " 3.10"
46+
5247 - name : Install dependencies
5348 run : |
5449 python -m pip install --upgrade pip
5550 pip install -r requirements.txt
56-
57- - name : Install dependencies
58- run : |
59- python -m pip install --upgrade pip
60- pip install -r requirements.txt
61-
62- - name : Convert queries into single json
51+
52+ - name : Convert queries into single zip file
6353 run : |
64- python utilities/python/convert.py ./queries ./Queries.json
54+ python utilities/python/convert.py ./queries ./Queries.zip --file-format zip
6555
66- - name : Configure Git
56+ - name : Convert queries into single json file
6757 run : |
68- git config --global user.name "github-actions[bot]"
69- git config --global user.email "github-actions[bot]@users.noreply.github.com"
70-
71- - name : Commit if changed
58+ python utilities/python/convert.py ./queries ./Queries.json
59+
60+ - name : Set metadata
61+ id : release_meta
7262 run : |
73- git add ./Queries.json
74- if git diff --staged --quiet; then
75- echo "No changes to commit"
76- else
77- git commit -m "Update combined queries"
78- git push
79- fi
63+ release_date="$(date -u +%Y-%m-%d)"
64+ echo "release_date=${release_date}" >> "$GITHUB_OUTPUT"
65+ echo "release_tag=queries-${release_date}" >> "$GITHUB_OUTPUT"
66+ echo "release_name=Queries ${release_date}" >> "$GITHUB_OUTPUT"
67+
68+ - name : Create release
69+ uses : softprops/action-gh-release@v2
70+ with :
71+ tag_name : ${{ steps.release_meta.outputs.release_tag }}
72+ name : ${{ steps.release_meta.outputs.release_name }}
73+ files : |
74+ Queries.zip
75+ Queries.json
76+ body : |
77+ This release contains all queries exported as JSON and bundled in a single file. The compressed .zip file can be uploaded to BloodHound to bulk-import all queries.
78+ draft : true
0 commit comments