Skip to content

Commit 321b91a

Browse files
committed
ci: enhance release process with versioning and changelog generation improvements
1 parent 150bb60 commit 321b91a

File tree

2 files changed

+28
-7
lines changed

2 files changed

+28
-7
lines changed

.github/workflows/ci.yml

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -249,17 +249,26 @@ jobs:
249249

250250
create-release:
251251
needs: build
252-
if: startsWith(github.ref, 'refs/tags/v')
252+
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v')
253253
runs-on: ubuntu-latest
254254
permissions:
255255
contents: write
256256

257257
steps:
258258
- uses: actions/checkout@v4
259+
with:
260+
fetch-depth: 0 # Fetch all history for changelog generation
259261

260-
- name: Get version from tag
262+
- name: Get version
261263
id: get_version
262-
run: echo "version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
264+
run: |
265+
if [[ $GITHUB_REF == refs/tags/* ]]; then
266+
VERSION=${GITHUB_REF#refs/tags/v}
267+
else
268+
# For main/master, use date-based version
269+
VERSION="0.1.0-$(date +'%Y%m%d')-${GITHUB_SHA::7}"
270+
fi
271+
echo "version=$VERSION" >> $GITHUB_OUTPUT
263272
264273
- name: Download all artifacts
265274
uses: actions/download-artifact@v4
@@ -270,18 +279,30 @@ jobs:
270279
- name: Display structure of downloaded files
271280
run: ls -R artifacts/
272281

273-
- name: Get Changelog Entry
282+
- name: Generate Release Notes
274283
id: changelog
275284
run: |
276-
awk '/^## Version/{p=NR+1}(NR<=p){print}' CHANGELOG.md > release_notes.md
285+
# Get latest changes since last release or last 10 commits if no releases
286+
if git describe --tags --abbrev=0 2>/dev/null; then
287+
LAST_TAG=$(git describe --tags --abbrev=0)
288+
CHANGES=$(git log --pretty=format:"* %s" $LAST_TAG..HEAD)
289+
else
290+
CHANGES=$(git log --pretty=format:"* %s" -n 10)
291+
fi
292+
293+
# Save changes to file
294+
echo "## What's New" > release_notes.md
295+
echo "" >> release_notes.md
296+
echo "$CHANGES" >> release_notes.md
277297
278298
- name: Create Release
279299
uses: softprops/action-gh-release@v2
280300
with:
281301
name: NetworkMonitor v${{ steps.get_version.outputs.version }}
282302
body_path: release_notes.md
283303
draft: false
284-
prerelease: false
304+
prerelease: ${{ !startsWith(github.ref, 'refs/tags/') }}
305+
tag_name: v${{ steps.get_version.outputs.version }}
285306
files: |
286307
artifacts/**/*.zip
287308
artifacts/**/*.tar.gz

DEVELOPER.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ run_networkmonitor.bat
185185

186186
1. Clone the repository:
187187
```bash
188-
git clone https://github.com/yourorg/networkmonitor.git
188+
git clone https://github.com/umerfarok/networkmonitor.git
189189
cd networkmonitor
190190
```
191191

0 commit comments

Comments
 (0)