mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2026-10-28 11:14:58 +00:00
show diffs in dev releases
This commit is contained in:
@@ -29,6 +29,8 @@ jobs:
|
|||||||
|
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v6
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Install pnpm
|
- name: Install pnpm
|
||||||
run: npm install -g pnpm
|
run: npm install -g pnpm
|
||||||
@@ -39,6 +41,13 @@ jobs:
|
|||||||
version=`grep -E '^#define EMSESP_APP_VERSION' ./src/emsesp_version.h | awk -F'"' '{print $2}'`
|
version=`grep -E '^#define EMSESP_APP_VERSION' ./src/emsesp_version.h | awk -F'"' '{print $2}'`
|
||||||
echo "VERSION=$version" >> $GITHUB_OUTPUT
|
echo "VERSION=$version" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
# must run before the release moves the 'latest' tag to this build
|
||||||
|
- name: Find the previous dev release
|
||||||
|
id: previous
|
||||||
|
run: |
|
||||||
|
prev=`git rev-parse -q --verify 'refs/tags/latest^{commit}' || git describe --tags --abbrev=0 --match 'v*'`
|
||||||
|
echo "REF=$prev" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: Install PlatformIO
|
- name: Install PlatformIO
|
||||||
run: |
|
run: |
|
||||||
python -m pip install --upgrade pip
|
python -m pip install --upgrade pip
|
||||||
@@ -66,12 +75,28 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
commit_message: "chore: update generated files for v${{steps.build_info.outputs.VERSION}}"
|
commit_message: "chore: update generated files for v${{steps.build_info.outputs.VERSION}}"
|
||||||
|
|
||||||
|
# an empty body falls back to the commit list generated by the release action
|
||||||
|
- name: Build the release notes
|
||||||
|
id: notes
|
||||||
|
env:
|
||||||
|
PREV_REF: ${{ steps.previous.outputs.REF }}
|
||||||
|
VERSION: ${{ steps.build_info.outputs.VERSION }}
|
||||||
|
run: |
|
||||||
|
./scripts/release_notes.sh "$PREV_REF" "$VERSION" > release_notes.md || :
|
||||||
|
cat release_notes.md
|
||||||
|
{
|
||||||
|
echo 'BODY<<__RELEASE_NOTES_EOF__'
|
||||||
|
cat release_notes.md
|
||||||
|
echo '__RELEASE_NOTES_EOF__'
|
||||||
|
} >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: Create GitHub Release
|
- name: Create GitHub Release
|
||||||
id: 'automatic_releases'
|
id: 'automatic_releases'
|
||||||
uses: emsesp/action-automatic-releases@v1.0.1
|
uses: emsesp/action-automatic-releases@v1.0.1
|
||||||
with:
|
with:
|
||||||
repo_token: '${{ secrets.GITHUB_TOKEN }}'
|
repo_token: '${{ secrets.GITHUB_TOKEN }}'
|
||||||
title: Development Build v${{steps.build_info.outputs.VERSION}}
|
title: Development Build v${{steps.build_info.outputs.VERSION}}
|
||||||
|
body: ${{ steps.notes.outputs.BODY }}
|
||||||
automatic_release_tag: 'latest'
|
automatic_release_tag: 'latest'
|
||||||
prerelease: true
|
prerelease: true
|
||||||
files: |
|
files: |
|
||||||
|
|||||||
Executable
+72
@@ -0,0 +1,72 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
#
|
||||||
|
# Builds the release body for a dev build and writes it to stdout.
|
||||||
|
#
|
||||||
|
# scripts/release_notes.sh <previous release ref> <version>
|
||||||
|
#
|
||||||
|
# The summary is the set of CHANGELOG_LATEST.md lines added since the previous
|
||||||
|
# dev release, kept under their own headings. The full changelog and the commit
|
||||||
|
# list follow, both collapsed.
|
||||||
|
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
PREV_REF=${1:?usage: release_notes.sh <previous release ref> <version>}
|
||||||
|
VERSION=${2:?usage: release_notes.sh <previous release ref> <version>}
|
||||||
|
|
||||||
|
CHANGELOG=CHANGELOG_LATEST.md
|
||||||
|
REPO_URL="https://github.com/${GITHUB_REPOSITORY:-emsesp/EMS-ESP32}"
|
||||||
|
MAX_COMMITS=250
|
||||||
|
|
||||||
|
prev_version=$(git show "${PREV_REF}:src/emsesp_version.h" 2>/dev/null |
|
||||||
|
awk -F'"' '/EMSESP_APP_VERSION/ { print $2 }')
|
||||||
|
|
||||||
|
added=$(mktemp)
|
||||||
|
trap 'rm -f "${added}"' EXIT
|
||||||
|
git diff -U0 "${PREV_REF}..HEAD" -- "${CHANGELOG}" |
|
||||||
|
sed -n 's/^+\([^+].*\)/\1/p' >"${added}"
|
||||||
|
|
||||||
|
# walk the changelog so the added lines keep the order and headings they have there
|
||||||
|
summary=$(awk '
|
||||||
|
NR == FNR { if (NF) wanted[$0] = 1; next }
|
||||||
|
/^#+ / { sub(/^#+ /, ""); heading = $0; next }
|
||||||
|
$0 in wanted && !seen[$0]++ {
|
||||||
|
if (heading != shown) { printf "\n### %s\n\n", heading; shown = heading }
|
||||||
|
print
|
||||||
|
}
|
||||||
|
' "${added}" "${CHANGELOG}")
|
||||||
|
|
||||||
|
echo "Development build of EMS-ESP v${VERSION}."
|
||||||
|
echo
|
||||||
|
|
||||||
|
if [ -n "${summary}" ]; then
|
||||||
|
echo "## Changes since ${prev_version:-the previous dev build}"
|
||||||
|
echo "${summary}"
|
||||||
|
echo
|
||||||
|
elif [ -n "${prev_version}" ]; then
|
||||||
|
echo "No changelog entries were added since ${prev_version}, see the commits below."
|
||||||
|
echo
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "<details>"
|
||||||
|
echo "<summary>Full v${VERSION%%-*} changelog so far</summary>"
|
||||||
|
echo
|
||||||
|
sed '1,/^For more details go to/d' "${CHANGELOG}" | awk 'NF || seen { print; seen = 1 }'
|
||||||
|
echo
|
||||||
|
echo "</details>"
|
||||||
|
echo
|
||||||
|
|
||||||
|
count=$(git rev-list --no-merges --count "${PREV_REF}..HEAD")
|
||||||
|
echo "<details>"
|
||||||
|
echo "<summary>Commits (${count})</summary>"
|
||||||
|
echo
|
||||||
|
git log --no-merges --max-count="${MAX_COMMITS}" \
|
||||||
|
--pretty=format:"- [\`%h\`](${REPO_URL}/commit/%H) %s (%an)" "${PREV_REF}..HEAD"
|
||||||
|
echo
|
||||||
|
if [ "${count}" -gt "${MAX_COMMITS}" ]; then
|
||||||
|
echo
|
||||||
|
echo "... and $((count - MAX_COMMITS)) more."
|
||||||
|
fi
|
||||||
|
echo
|
||||||
|
echo "</details>"
|
||||||
|
echo
|
||||||
|
echo "[Compare all changes](${REPO_URL}/compare/${PREV_REF}...$(git rev-parse HEAD))"
|
||||||
Reference in New Issue
Block a user