mirror of
https://github.com/alexhopeoconnor/WiFiManager.git
synced 2026-10-04 02:48:13 +10:00
Improve release preparation tooling
This commit is contained in:
@@ -20,6 +20,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
- run: bash -n scripts/*.sh
|
||||||
- run: ./scripts/check-docs.sh
|
- run: ./scripts/check-docs.sh
|
||||||
|
|
||||||
compile-tests:
|
compile-tests:
|
||||||
|
|||||||
@@ -79,6 +79,8 @@ The suffix after `#` is a Git ref. PlatformIO clones the repository and checks o
|
|||||||
## Development and releases
|
## Development and releases
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
./scripts/bump-version.sh vMAJOR.MINOR.PATCH
|
||||||
|
# Replace the generated CHANGELOG TODO with the release summary.
|
||||||
./scripts/test.sh compile --platform esp8266
|
./scripts/test.sh compile --platform esp8266
|
||||||
./scripts/test.sh compile --platform esp32
|
./scripts/test.sh compile --platform esp32
|
||||||
./scripts/check-docs.sh
|
./scripts/check-docs.sh
|
||||||
|
|||||||
+3
-1
@@ -14,9 +14,11 @@ known six-second asynchronous scan failure in the older 2.0.17 framework. Core
|
|||||||
ignore settings shown in this repository `platformio.ini`; keep those settings
|
ignore settings shown in this repository `platformio.ini`; keep those settings
|
||||||
when adding an ESP32 environment.
|
when adding an ESP32 environment.
|
||||||
|
|
||||||
Before a release, update `library.json`, `CHANGELOG.md`, and the relevant public documentation, then run:
|
Start a release with `bump-version.sh`. It updates package metadata and canonical installation snippets, then creates the changelog section. Replace its generated TODO with the release summary and update any behavioural documentation before running:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
./scripts/bump-version.sh vMAJOR.MINOR.PATCH
|
||||||
|
# Replace the generated CHANGELOG TODO with the release summary.
|
||||||
./scripts/check-docs.sh
|
./scripts/check-docs.sh
|
||||||
./scripts/test.sh compile --platform esp8266
|
./scripts/test.sh compile --platform esp8266
|
||||||
./scripts/test.sh compile --platform esp32
|
./scripts/test.sh compile --platform esp32
|
||||||
|
|||||||
Executable
+46
@@ -0,0 +1,46 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
usage() {
|
||||||
|
echo "Usage: $0 vMAJOR.MINOR.PATCH" >&2
|
||||||
|
exit 2
|
||||||
|
}
|
||||||
|
|
||||||
|
tag="${1:-}"
|
||||||
|
[[ "$tag" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]] || usage
|
||||||
|
|
||||||
|
root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||||
|
version="${tag#v}"
|
||||||
|
repo_url="https://github.com/alexhopeoconnor/WiFiManager.git"
|
||||||
|
reference_files=(README.md docs/GETTING_STARTED.md)
|
||||||
|
|
||||||
|
current_version="$(sed -n 's/.*"version": "\([^"]*\)".*/\1/p' "$root/library.json" | head -n 1)"
|
||||||
|
[[ "$current_version" != "$version" ]] || {
|
||||||
|
echo "library.json already declares $version; choose a new version." >&2
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
grep -q "^## $version$" "$root/CHANGELOG.md" && {
|
||||||
|
echo "CHANGELOG.md already has a $version section; choose a new version." >&2
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
sed -i -E '0,/"version": "[0-9]+\.[0-9]+\.[0-9]+"/s//"version": "'"$version"'"/' "$root/library.json"
|
||||||
|
for file in "${reference_files[@]}"; do
|
||||||
|
sed -i -E "s|${repo_url}#v[0-9]+\.[0-9]+\.[0-9]+|${repo_url}#v${version}|g" "$root/$file"
|
||||||
|
done
|
||||||
|
|
||||||
|
temp_file="$(mktemp)"
|
||||||
|
trap 'rm -f "$temp_file"' EXIT
|
||||||
|
{
|
||||||
|
IFS= read -r changelog_heading < "$root/CHANGELOG.md"
|
||||||
|
[[ "$changelog_heading" == "# Changelog" ]] || {
|
||||||
|
echo "CHANGELOG.md must begin with # Changelog" >&2
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
printf '%s\n\n## %s\n\n- TODO: Describe this release.\n' "$changelog_heading" "$version"
|
||||||
|
tail -n +2 "$root/CHANGELOG.md"
|
||||||
|
} > "$temp_file"
|
||||||
|
mv "$temp_file" "$root/CHANGELOG.md"
|
||||||
|
|
||||||
|
echo "Updated WiFiManager declarations and canonical install references to $tag."
|
||||||
|
echo "Replace the generated changelog TODO with the release summary, then run scripts/check-docs.sh and scripts/prepare-release.sh $tag."
|
||||||
@@ -32,11 +32,30 @@ if [[ -f "$root/library.properties" ]]; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if awk -v heading="## $version" '
|
||||||
|
$0 == heading { found = 1; next }
|
||||||
|
found && /^## / { exit }
|
||||||
|
found { print }
|
||||||
|
' "$root/CHANGELOG.md" | grep -Fq 'TODO: Describe this release.'; then
|
||||||
|
echo "CHANGELOG.md still has the generated TODO for $version" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
repo_url="https://github.com/alexhopeoconnor/WiFiManager.git"
|
||||||
|
validate_reference() {
|
||||||
|
local file="$1"
|
||||||
|
local reference_count
|
||||||
|
reference_count="$(grep -F "$repo_url#v" "$root/$file" | wc -l)"
|
||||||
|
[[ "$reference_count" -eq 1 ]] || { echo "$file must contain exactly one canonical release reference" >&2; exit 1; }
|
||||||
|
grep -Fq "$repo_url#$tag" "$root/$file" || { echo "$file does not reference $tag" >&2; exit 1; }
|
||||||
|
}
|
||||||
|
validate_reference README.md
|
||||||
|
validate_reference docs/GETTING_STARTED.md
|
||||||
|
|
||||||
git -C "$root" diff --check
|
git -C "$root" diff --check
|
||||||
package_dir="$(mktemp -d)"
|
package_dir="$(mktemp -d)"
|
||||||
trap 'rm -rf "$package_dir"' EXIT
|
trap 'rm -rf "$package_dir"' EXIT
|
||||||
pio pkg pack "$root" --output "$package_dir/package.tar.gz" >/dev/null
|
pio pkg pack "$root" --output "$package_dir/package.tar.gz" >/dev/null
|
||||||
echo "Validated PlatformIO package for $tag"
|
echo "Validated release metadata and PlatformIO package for $tag"
|
||||||
|
|
||||||
if [[ "${2:-}" == "--tag" ]]; then
|
if [[ "${2:-}" == "--tag" ]]; then
|
||||||
git -C "$root" diff --quiet
|
git -C "$root" diff --quiet
|
||||||
|
|||||||
Reference in New Issue
Block a user