Skip to content

Commit 3bff9e5

Browse files
committed
Update and test build workflow
1 parent 2d42e45 commit 3bff9e5

File tree

2 files changed

+48
-3
lines changed

2 files changed

+48
-3
lines changed

.github/workflows/build.yml

Lines changed: 42 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,11 @@ on:
88
# Trigger action manually from GitHub > Actions
99
workflow_dispatch:
1010
# Trigger action at a given date and time
11-
# schedule:
12-
# - cron: '37 13 * * *'
11+
schedule:
12+
- cron: '47 12 * * 3'
13+
14+
concurrency:
15+
group: privesccheck-update-and-build
1316

1417
#
1518
# Below, we are building the following chain:
@@ -31,6 +34,7 @@ jobs:
3134
runs-on: ubuntu-latest
3235
outputs:
3336
data-updated: ${{ steps.commit-and-push.outputs.data-updated }}
37+
data-update-diff: ${{ steps.commit-and-push.outputs.data-update-diff }}
3438
steps:
3539
- name: Check out master branch
3640
uses: actions/checkout@v5
@@ -49,8 +53,10 @@ jobs:
4953
run: |
5054
if ! bash ./.github/workflows/commit_and_push.sh "${{ github.actor_id }}" "${{ github.actor }}"; then
5155
echo "data-updated=false" >> "$GITHUB_OUTPUT"
56+
echo "data-update-diff=$(echo "N/A" | base64 -w 0)" >> "$GITHUB_OUTPUT"
5257
else
5358
echo "data-updated=true" >> "$GITHUB_OUTPUT"
59+
echo "data-update-diff=$(git diff --name-only -- ./data | base64 -w 0)" >> "$GITHUB_OUTPUT"
5460
fi
5561
5662
get-release-tag:
@@ -81,6 +87,25 @@ jobs:
8187
uses: actions/checkout@v5
8288
with:
8389
ref: master
90+
fetch-depth: 0
91+
- name: Generate Changelog
92+
shell: bash
93+
run: |
94+
event_name="${{ github.event_name }}"
95+
echo "[*] Event name: ${event_name}"
96+
changelog_content=""
97+
if [[ "${event_name}" == "push" ]]; then
98+
echo "[*] Commit ID before push: ${{ github.event.before }}"
99+
echo "[*] Commit ID after push: ${{ github.event.after }}"
100+
changelog_content="$(git diff --unified=0 "${{ github.event.before }}" "${{ github.event.after }}" -- "./info/CHANGELOG.md" 2>/dev/null | grep -E "^\\+" | grep -v '+++' | sed "s/^+//g")"
101+
elif [[ "${event_name}" == "schedule" ]]; then
102+
data_file_update=$(echo "${{ needs.update-data.outputs.data-update-diff }}" | base64 -d)
103+
echo -e "[*] Data file update:\n${data_file_update}"
104+
changelog_content="## Files updated\n\n${data_file_update}"
105+
else
106+
changelog_content="N/A"
107+
fi
108+
echo -ne "# Changelog\n\n${changelog_content}\n" > ./release/changelog.md
84109
- name: Build PrivescCheck script
85110
shell: pwsh
86111
run: |
@@ -102,10 +127,24 @@ jobs:
102127
echo "[*] Release tag: ${RELEASE_TAG}"
103128
echo "[*] Data updated: ${DATA_UPDATED}"
104129
echo "[*] Event name: ${event_name}"
130+
create_release=0
105131
if [[ "${event_name}" = "schedule" ]]; then
106132
if [[ "${DATA_UPDATED}" = "true" ]]; then
133+
create_release=1
134+
gh release create "${RELEASE_TAG}" ./release/*.ps1
135+
fi
136+
else
137+
create_release=1
138+
fi
139+
if [[ $create_release == 1 ]]; then
140+
changelog_path="./release/changelog.md"
141+
if [[ -f "${changelog_path}" ]]; then
142+
echo "[*] Changelog file found: ${changelog_path}"
143+
gh release create "${RELEASE_TAG}" --notes-file "${changelog_path}" ./release/*.ps1
144+
else
145+
echo "[!] Changelog file not found"
107146
gh release create "${RELEASE_TAG}" ./release/*.ps1
108147
fi
109148
else
110-
gh release create "${RELEASE_TAG}" ./release/*.ps1
149+
echo "[*] No release to create"
111150
fi

info/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## 2025-10-06
4+
5+
### Modified
6+
7+
- Automated build workflow + Changelog generation
8+
39
## 2025-09-03
410

511
### Fixed

0 commit comments

Comments
 (0)