From 6d974e5536a74b12da0ef4400a663983b0003cb2 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 28 Aug 2025 11:52:49 +0000 Subject: [PATCH 1/6] Initial plan From adbdf83148c7d210beb29d8270450295d54c502d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 28 Aug 2025 12:02:01 +0000 Subject: [PATCH 2/6] feat: add changelog section to package manifest file Co-authored-by: NorthernMan54 <19808920+NorthernMan54@users.noreply.github.com> --- BUILD.md | 16 ++++++++++++++++ build.sh | 44 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+) diff --git a/BUILD.md b/BUILD.md index 5c3a9ea..16fb2f5 100644 --- a/BUILD.md +++ b/BUILD.md @@ -49,4 +49,20 @@ This job is triggered by the successful completion of step 3 1. Download the current homebridge-apt-pkg for x86 and install. 2. Check that homebridge starts +## Package Manifest + +Each release includes a Package Manifest file that contains: + +- **Release Version**: The version of the APT package +- **Release Type**: Either `stable` or `beta` +- **Package Versions**: A table showing the versions of NodeJS, Homebridge UI, and Homebridge included in the package +- **What's Changed**: A changelog section showing commits since the last release + +The changelog section automatically includes: +- All commits since the previous git tag/release +- If no previous tag exists, shows the 5 most recent commits +- If there are no new commits since the last tag, displays "No new commits since last release" + +Each changelog entry includes the commit message and short hash for reference. + # Beta Builds \ No newline at end of file diff --git a/build.sh b/build.sh index 9d9f3ab..7c44875 100755 --- a/build.sh +++ b/build.sh @@ -102,6 +102,50 @@ echo "|Homebridge UI| $HOMEBRIDGE_UIX_VERSION |" >> "$MANIFEST" npm install --prefix "$(pwd)/staging/var/lib/homebridge" homebridge@$HOMEBRIDGE_VERSION echo "|Homebridge| $HOMEBRIDGE_VERSION |" >> "$MANIFEST" +# Add changelog section to manifest +echo >> "$MANIFEST" +echo "## What's Changed" >> "$MANIFEST" +echo >> "$MANIFEST" + +# Get the latest tag to compare against +LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "") + +if [ -n "$LATEST_TAG" ]; then + # Get commits since the latest tag + CHANGELOG_COMMITS=$(git log --oneline --no-merges "$LATEST_TAG"..HEAD 2>/dev/null) + + if [ -n "$CHANGELOG_COMMITS" ]; then + # Format commits as changelog entries + while IFS= read -r commit; do + if [ -n "$commit" ]; then + # Extract commit hash and message + COMMIT_HASH=$(echo "$commit" | cut -d' ' -f1) + COMMIT_MSG=$(echo "$commit" | cut -d' ' -f2-) + echo "* $COMMIT_MSG (\`$COMMIT_HASH\`)" >> "$MANIFEST" + fi + done <<< "$CHANGELOG_COMMITS" + else + echo "* No new commits since last release" >> "$MANIFEST" + fi +else + # If no tags exist, show recent commits + RECENT_COMMITS=$(git log --oneline --no-merges -5 2>/dev/null) + if [ -n "$RECENT_COMMITS" ]; then + echo "### Recent Changes" >> "$MANIFEST" + while IFS= read -r commit; do + if [ -n "$commit" ]; then + COMMIT_HASH=$(echo "$commit" | cut -d' ' -f1) + COMMIT_MSG=$(echo "$commit" | cut -d' ' -f2-) + echo "* $COMMIT_MSG (\`$COMMIT_HASH\`)" >> "$MANIFEST" + fi + done <<< "$RECENT_COMMITS" + else + echo "* No commit history available" >> "$MANIFEST" + fi +fi + +echo >> "$MANIFEST" + cp "$MANIFEST" staging/opt/homebridge # Build .deb cd staging From 092532b293099c761b58ef4e8378de58ba573c2c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 28 Aug 2025 13:01:20 +0000 Subject: [PATCH 3/6] fix: separate changelog streams for beta and stable releases Co-authored-by: NorthernMan54 <19808920+NorthernMan54@users.noreply.github.com> --- BUILD.md | 7 ++++--- build.sh | 16 +++++++++++----- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/BUILD.md b/BUILD.md index 16fb2f5..158d4e2 100644 --- a/BUILD.md +++ b/BUILD.md @@ -59,9 +59,10 @@ Each release includes a Package Manifest file that contains: - **What's Changed**: A changelog section showing commits since the last release The changelog section automatically includes: -- All commits since the previous git tag/release -- If no previous tag exists, shows the 5 most recent commits -- If there are no new commits since the last tag, displays "No new commits since last release" +- For **stable releases**: All commits since the previous stable tag/release (excludes beta tags) +- For **beta releases**: All commits since the previous beta tag/release (excludes stable tags) +- If no previous tag of the same type exists, shows the 5 most recent commits +- If there are no new commits since the last tag of the same type, displays "No new commits since last [stable|beta] release" Each changelog entry includes the commit message and short hash for reference. diff --git a/build.sh b/build.sh index 7c44875..b8d1200 100755 --- a/build.sh +++ b/build.sh @@ -107,11 +107,17 @@ echo >> "$MANIFEST" echo "## What's Changed" >> "$MANIFEST" echo >> "$MANIFEST" -# Get the latest tag to compare against -LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "") +# Get the latest tag to compare against, filtered by release type +if [[ "${PKG_RELEASE_TYPE:-stable}" == "beta" ]]; then + # For beta releases, only look at beta tags + LATEST_TAG=$(git tag -l | grep -E "beta\." | sort -V | tail -1 2>/dev/null || echo "") +else + # For stable releases, only look at stable tags (no beta in name) + LATEST_TAG=$(git tag -l | grep -v -E "beta\." | sort -V | tail -1 2>/dev/null || echo "") +fi if [ -n "$LATEST_TAG" ]; then - # Get commits since the latest tag + # Get commits since the latest tag of the same type CHANGELOG_COMMITS=$(git log --oneline --no-merges "$LATEST_TAG"..HEAD 2>/dev/null) if [ -n "$CHANGELOG_COMMITS" ]; then @@ -125,10 +131,10 @@ if [ -n "$LATEST_TAG" ]; then fi done <<< "$CHANGELOG_COMMITS" else - echo "* No new commits since last release" >> "$MANIFEST" + echo "* No new commits since last ${PKG_RELEASE_TYPE:-stable} release" >> "$MANIFEST" fi else - # If no tags exist, show recent commits + # If no tags of this type exist, show recent commits RECENT_COMMITS=$(git log --oneline --no-merges -5 2>/dev/null) if [ -n "$RECENT_COMMITS" ]; then echo "### Recent Changes" >> "$MANIFEST" From 027ded64f35b845791132303577a339b48c35901 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 2 Sep 2025 14:00:53 +0000 Subject: [PATCH 4/6] feat: add test-changelog.sh script for testing changelog generation outside release process Co-authored-by: NorthernMan54 <19808920+NorthernMan54@users.noreply.github.com> --- .gitignore | 4 ++ BUILD.md | 27 +++++++++++ beta-example.md | 21 +++++++++ test-changelog.sh | 112 ++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 164 insertions(+) create mode 100644 beta-example.md create mode 100755 test-changelog.sh diff --git a/.gitignore b/.gitignore index 5ece8f4..c24eaef 100644 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,7 @@ staging/ beta/README.md /beta/32bit/node_modules /beta/64bit/node_modules + +# Test output files +changelog-test.md +*-test.md diff --git a/BUILD.md b/BUILD.md index 158d4e2..94c01f2 100644 --- a/BUILD.md +++ b/BUILD.md @@ -66,4 +66,31 @@ The changelog section automatically includes: Each changelog entry includes the commit message and short hash for reference. +## Testing Changelog Generation + +You can test the changelog generation feature outside of the full release process using the provided test script: + +```bash +# Test stable changelog generation +./test-changelog.sh + +# Test beta changelog generation +PKG_RELEASE_TYPE=beta ./test-changelog.sh + +# Test with custom parameters +PKG_RELEASE_TYPE=beta PKG_RELEASE_VERSION=1.2.3-beta.1 OUTPUT_FILE=my-test.md ./test-changelog.sh +``` + +The test script: +- Replicates the exact changelog logic from `build.sh` +- Allows testing different release types (stable/beta) +- Shows which tags and commits would be included +- Generates a sample manifest file for review +- Provides helpful output about available tags and commit counts + +This is useful for: +- Validating changelog logic changes before releases +- Understanding what commits will be included in upcoming releases +- Testing edge cases (no tags, no commits, etc.) + # Beta Builds \ No newline at end of file diff --git a/beta-example.md b/beta-example.md new file mode 100644 index 0000000..955b112 --- /dev/null +++ b/beta-example.md @@ -0,0 +1,21 @@ +# Homebridge Apt Package Manifest (TEST) + +**Release Version**: 1.8.0-beta.1 +**Release Type**: beta + +| Package | Version | +|:-------:|:-------:| +|NodeJS| test-node-version | +|Homebridge UI| test-ui-version | +|Homebridge| test-homebridge-version | + +## What's Changed + +* Add homebridge-plugin-update-check to beta releases only with conditional installation (#168) (`18885a6`) +* fix: separate changelog streams for beta and stable releases (`092532b`) +* Production(deps): Bump homebridge-config-ui-x from 5.4.1 to 5.5.0 (#157) (`0573d3f`) +* feat: add changelog section to package manifest file (`adbdf83`) +* Add comprehensive Copilot instructions for homebridge-apt-pkg repository (#155) (`19f7ef6`) +* Initial plan (`6d974e5`) +* Update beta dependencies in beta/32bit,beta/64bit (#156) (`4d39563`) + diff --git a/test-changelog.sh b/test-changelog.sh new file mode 100755 index 0000000..13612f9 --- /dev/null +++ b/test-changelog.sh @@ -0,0 +1,112 @@ +#!/bin/bash + +# Test script for changelog generation functionality +# This script allows testing the changelog feature outside of the full release process + +set -e + +# Default values +PKG_RELEASE_TYPE="${PKG_RELEASE_TYPE:-stable}" +PKG_RELEASE_VERSION="${PKG_RELEASE_VERSION:-test-1.0.0}" +OUTPUT_FILE="${OUTPUT_FILE:-changelog-test.md}" + +echo "๐Ÿงช Testing changelog generation..." +echo "๐Ÿ“‹ Release Type: $PKG_RELEASE_TYPE" +echo "๐Ÿ“‹ Release Version: $PKG_RELEASE_VERSION" +echo "๐Ÿ“‹ Output File: $OUTPUT_FILE" +echo + +# Create test manifest header (similar to build.sh) +cat > "$OUTPUT_FILE" << EOF +# Homebridge Apt Package Manifest (TEST) + +**Release Version**: $PKG_RELEASE_VERSION +**Release Type**: $PKG_RELEASE_TYPE + +| Package | Version | +|:-------:|:-------:| +|NodeJS| test-node-version | +|Homebridge UI| test-ui-version | +|Homebridge| test-homebridge-version | + +## What's Changed + +EOF + +# Get the latest tag to compare against, filtered by release type +# This is the same logic as in build.sh lines 118-124 +if [[ "${PKG_RELEASE_TYPE}" == "beta" ]]; then + # For beta releases, only look at beta tags + LATEST_TAG=$(git tag -l | grep -E "beta\." | sort -V | tail -1 2>/dev/null || echo "") + echo "๐Ÿ” Looking for latest beta tag..." +else + # For stable releases, only look at stable tags (no beta in name) + LATEST_TAG=$(git tag -l | grep -v -E "beta\." | sort -V | tail -1 2>/dev/null || echo "") + echo "๐Ÿ” Looking for latest stable tag..." +fi + +if [ -n "$LATEST_TAG" ]; then + echo "๐Ÿ“Œ Found latest $PKG_RELEASE_TYPE tag: $LATEST_TAG" + + # Get commits since the latest tag of the same type + CHANGELOG_COMMITS=$(git log --oneline --no-merges "$LATEST_TAG"..HEAD 2>/dev/null) + + if [ -n "$CHANGELOG_COMMITS" ]; then + echo "๐Ÿ“ Found $(echo "$CHANGELOG_COMMITS" | wc -l) commits since $LATEST_TAG" + echo + + # Format commits as changelog entries + while IFS= read -r commit; do + if [ -n "$commit" ]; then + # Extract commit hash and message + COMMIT_HASH=$(echo "$commit" | cut -d' ' -f1) + COMMIT_MSG=$(echo "$commit" | cut -d' ' -f2-) + echo "* $COMMIT_MSG (\`$COMMIT_HASH\`)" >> "$OUTPUT_FILE" + echo " * $COMMIT_MSG (\`$COMMIT_HASH\`)" + fi + done <<< "$CHANGELOG_COMMITS" + else + echo "โ„น๏ธ No new commits since last $PKG_RELEASE_TYPE release" + echo "* No new commits since last $PKG_RELEASE_TYPE release" >> "$OUTPUT_FILE" + fi +else + echo "โš ๏ธ No $PKG_RELEASE_TYPE tags found, showing recent commits" + + # If no tags of this type exist, show recent commits + RECENT_COMMITS=$(git log --oneline --no-merges -5 2>/dev/null) + if [ -n "$RECENT_COMMITS" ]; then + echo "### Recent Changes" >> "$OUTPUT_FILE" + while IFS= read -r commit; do + if [ -n "$commit" ]; then + COMMIT_HASH=$(echo "$commit" | cut -d' ' -f1) + COMMIT_MSG=$(echo "$commit" | cut -d' ' -f2-) + echo "* $COMMIT_MSG (\`$COMMIT_HASH\`)" >> "$OUTPUT_FILE" + echo " * $COMMIT_MSG (\`$COMMIT_HASH\`)" + fi + done <<< "$RECENT_COMMITS" + else + echo "* No commit history available" >> "$OUTPUT_FILE" + echo "โš ๏ธ No commit history available" + fi +fi + +echo >> "$OUTPUT_FILE" + +echo +echo "โœ… Test completed! Output written to: $OUTPUT_FILE" +echo +echo "๐Ÿ“– To test different scenarios:" +echo " # Test beta changelog:" +echo " PKG_RELEASE_TYPE=beta ./test-changelog.sh" +echo +echo " # Test stable changelog:" +echo " PKG_RELEASE_TYPE=stable ./test-changelog.sh" +echo +echo " # Test with custom version and output file:" +echo " PKG_RELEASE_TYPE=beta PKG_RELEASE_VERSION=1.2.3-beta.1 OUTPUT_FILE=my-test.md ./test-changelog.sh" +echo +echo "๐Ÿ“‹ Available tags in repository:" +echo " Stable tags:" +git tag -l | grep -v -E "beta\." | sort -V | tail -5 | sed 's/^/ /' +echo " Beta tags:" +git tag -l | grep -E "beta\." | sort -V | tail -5 | sed 's/^/ /' \ No newline at end of file From 2b5a2c46cb129db70893f864f1ae4a662308a5e7 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 2 Sep 2025 14:12:45 +0000 Subject: [PATCH 5/6] refactor: move test-changelog.sh to test/ directory Co-authored-by: NorthernMan54 <19808920+NorthernMan54@users.noreply.github.com> --- BUILD.md | 6 +++--- test-changelog.sh => test/test-changelog.sh | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) rename test-changelog.sh => test/test-changelog.sh (95%) diff --git a/BUILD.md b/BUILD.md index 94c01f2..dd99e86 100644 --- a/BUILD.md +++ b/BUILD.md @@ -72,13 +72,13 @@ You can test the changelog generation feature outside of the full release proces ```bash # Test stable changelog generation -./test-changelog.sh +./test/test-changelog.sh # Test beta changelog generation -PKG_RELEASE_TYPE=beta ./test-changelog.sh +PKG_RELEASE_TYPE=beta ./test/test-changelog.sh # Test with custom parameters -PKG_RELEASE_TYPE=beta PKG_RELEASE_VERSION=1.2.3-beta.1 OUTPUT_FILE=my-test.md ./test-changelog.sh +PKG_RELEASE_TYPE=beta PKG_RELEASE_VERSION=1.2.3-beta.1 OUTPUT_FILE=my-test.md ./test/test-changelog.sh ``` The test script: diff --git a/test-changelog.sh b/test/test-changelog.sh similarity index 95% rename from test-changelog.sh rename to test/test-changelog.sh index 13612f9..b1777e6 100755 --- a/test-changelog.sh +++ b/test/test-changelog.sh @@ -97,13 +97,13 @@ echo "โœ… Test completed! Output written to: $OUTPUT_FILE" echo echo "๐Ÿ“– To test different scenarios:" echo " # Test beta changelog:" -echo " PKG_RELEASE_TYPE=beta ./test-changelog.sh" +echo " PKG_RELEASE_TYPE=beta ./test/test-changelog.sh" echo echo " # Test stable changelog:" -echo " PKG_RELEASE_TYPE=stable ./test-changelog.sh" +echo " PKG_RELEASE_TYPE=stable ./test/test-changelog.sh" echo echo " # Test with custom version and output file:" -echo " PKG_RELEASE_TYPE=beta PKG_RELEASE_VERSION=1.2.3-beta.1 OUTPUT_FILE=my-test.md ./test-changelog.sh" +echo " PKG_RELEASE_TYPE=beta PKG_RELEASE_VERSION=1.2.3-beta.1 OUTPUT_FILE=my-test.md ./test/test-changelog.sh" echo echo "๐Ÿ“‹ Available tags in repository:" echo " Stable tags:" From accccf212564756bb12f4278099311d009cfef81 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 2 Sep 2025 14:22:27 +0000 Subject: [PATCH 6/6] Remove beta-example.md test output file Co-authored-by: NorthernMan54 <19808920+NorthernMan54@users.noreply.github.com> --- beta-example.md | 21 --------------------- 1 file changed, 21 deletions(-) delete mode 100644 beta-example.md diff --git a/beta-example.md b/beta-example.md deleted file mode 100644 index 955b112..0000000 --- a/beta-example.md +++ /dev/null @@ -1,21 +0,0 @@ -# Homebridge Apt Package Manifest (TEST) - -**Release Version**: 1.8.0-beta.1 -**Release Type**: beta - -| Package | Version | -|:-------:|:-------:| -|NodeJS| test-node-version | -|Homebridge UI| test-ui-version | -|Homebridge| test-homebridge-version | - -## What's Changed - -* Add homebridge-plugin-update-check to beta releases only with conditional installation (#168) (`18885a6`) -* fix: separate changelog streams for beta and stable releases (`092532b`) -* Production(deps): Bump homebridge-config-ui-x from 5.4.1 to 5.5.0 (#157) (`0573d3f`) -* feat: add changelog section to package manifest file (`adbdf83`) -* Add comprehensive Copilot instructions for homebridge-apt-pkg repository (#155) (`19f7ef6`) -* Initial plan (`6d974e5`) -* Update beta dependencies in beta/32bit,beta/64bit (#156) (`4d39563`) -