Skip to content

Update README.md to replace the hardcoded hc-uuid with a new UUID for… #5

Update README.md to replace the hardcoded hc-uuid with a new UUID for…

Update README.md to replace the hardcoded hc-uuid with a new UUID for… #5

Workflow file for this run

name: Release
on:
push:
tags:
- 'v*' # Triggers on any tag starting with 'v' (e.g., v1.0.0, v2.1.3, etc.)
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history for changelog generation
- name: Extract version from tag
id: version
run: |
VERSION=${GITHUB_REF#refs/tags/v}
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
echo "Version: $VERSION"
- name: Create release archive
run: |
mkdir -p release
tar -czf release/unifi-ctrld-healthchecks-${GITHUB_REF#refs/tags/v}.tar.gz \
scripts/ \
remote/ \
README.md \
LICENSE \
SECURITY.md
echo "Archive created: release/unifi-ctrld-healthchecks-${GITHUB_REF#refs/tags/v}.tar.gz"
ls -lh release/
- name: Generate release notes
id: release_notes
run: |
TAG=${GITHUB_REF#refs/tags/}
VERSION=${GITHUB_REF#refs/tags/v}
PREV_TAG=$(git tag --sort=-v:refname | sed -n '2p' || echo "")
if [ -f CHANGELOG.md ]; then
# Extract changelog section for this version using awk
# Look for "## [VERSION]" header and extract until next "## [" header
awk -v version="$VERSION" '
BEGIN { found=0 }
/^## \[/ {
if (found) exit
if ($0 ~ "\\[" version "\\]") {
found=1
print
next
}
}
found { print }
' CHANGELOG.md > release_notes.txt
# Verify we got content
if [ ! -s release_notes.txt ]; then
echo "Failed to extract from CHANGELOG.md, using fallback" >&2
rm -f release_notes.txt
fi
fi
# If still no content, fallback to git log
if [ ! -f release_notes.txt ] || [ ! -s release_notes.txt ]; then
echo "## Release $TAG" > release_notes.txt
echo "" >> release_notes.txt
if [ -n "$PREV_TAG" ]; then
echo "### Changes since $PREV_TAG" >> release_notes.txt
echo "" >> release_notes.txt
git log ${PREV_TAG}..HEAD --pretty=format:"- %s (%h)" >> release_notes.txt || true
else
echo "### Initial Release" >> release_notes.txt
echo "" >> release_notes.txt
git log --pretty=format:"- %s (%h)" -20 >> release_notes.txt || true
fi
fi
# Display generated notes for debugging
echo "=== Generated release notes ==="
cat release_notes.txt
echo "=== End release notes ==="
echo "File location: $(pwd)/release_notes.txt"
ls -lh release_notes.txt
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Verify release notes file
run: |
if [ ! -f release_notes.txt ]; then
echo "ERROR: release_notes.txt not found!" >&2
exit 1
fi
echo "Release notes file exists, size: $(wc -c < release_notes.txt) bytes"
echo "Full content:"
cat release_notes.txt
echo "---End of file---"
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
files: release/*.tar.gz
name: Release ${{ steps.version.outputs.tag }}
body_path: release_notes.txt
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
continue-on-error: false