diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ed48658..8d911a7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -27,12 +27,31 @@ jobs: echo "version=${VERSION}" >> $GITHUB_OUTPUT echo "Building release for version: ${VERSION}" - - name: Verify VERSION file matches tag + - name: Verify every version identifier matches tag + env: + TAG_VERSION: ${{ steps.get_version.outputs.version }} run: | - FILE_VERSION=$(cat VERSION | tr -d '\n') - TAG_VERSION="${{ steps.get_version.outputs.version }}" + failed=0 + check() { + if ! grep -Fq -- "$2" "$1"; then + echo "❌ Error: $1 does not contain: $2" + failed=1 + fi + } + FILE_VERSION=$(tr -d '\n' < VERSION) if [ "$FILE_VERSION" != "$TAG_VERSION" ]; then echo "❌ Error: VERSION file ($FILE_VERSION) does not match tag ($TAG_VERSION)" + failed=1 + fi + check setup.py "version=\"${TAG_VERSION}\"," + check pyproject.toml "version = \"${TAG_VERSION}\"" + check planetscale_discovery/__init__.py "__version__ = \"${TAG_VERSION}\"" + check README.md "unzip ps-discovery-${TAG_VERSION}.zip" + check README.md "cd ps-discovery-${TAG_VERSION}" + check docs/workload-bundle.md "\"discovery_version\": \"${TAG_VERSION}\"" + check CHANGELOG.md "## [${TAG_VERSION}]" + if [ "$failed" -ne 0 ]; then + echo "Update the files above to ${TAG_VERSION} on main, then tag again." exit 1 fi echo "✅ Version verified: $TAG_VERSION" diff --git a/RELEASING.md b/RELEASING.md index e40ca96..6732ac9 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -84,17 +84,19 @@ This will update the version in: - `setup.py` - `pyproject.toml` - `planetscale_discovery/__init__.py` +- `README.md` (the release zip name in Quick Start) +- `docs/workload-bundle.md` (the example `discovery_version`) -The script stops with an error if any of these files was not updated to the new version. +The script stops with an error if any of these files was not updated to the new version. The release workflow checks the same files and a `CHANGELOG.md` section for the tag, and stops before it builds anything if one does not match. ### 4. Review and Commit Changes ```bash # Review the changes -git diff VERSION setup.py pyproject.toml planetscale_discovery/__init__.py CHANGELOG.md +git diff VERSION setup.py pyproject.toml planetscale_discovery/__init__.py README.md docs/workload-bundle.md CHANGELOG.md # Commit the version bump and changelog -git add VERSION setup.py pyproject.toml planetscale_discovery/__init__.py CHANGELOG.md +git add VERSION setup.py pyproject.toml planetscale_discovery/__init__.py README.md docs/workload-bundle.md CHANGELOG.md git commit -m "Release vX.Y.Z" ``` diff --git a/bump_version.sh b/bump_version.sh index 64e9e1a..acdd0a8 100755 --- a/bump_version.sh +++ b/bump_version.sh @@ -75,6 +75,16 @@ sed -i.bak "s/^__version__ = \"${CURRENT_VERSION}\"/__version__ = \"${NEW_VERSIO rm planetscale_discovery/__init__.py.bak echo "✅ Updated planetscale_discovery/__init__.py" +ESCAPED_CURRENT_VERSION="${CURRENT_VERSION//./\\.}" + +sed -i.bak "s/ps-discovery-${ESCAPED_CURRENT_VERSION}/ps-discovery-${NEW_VERSION}/g" README.md +rm README.md.bak +echo "✅ Updated README.md" + +sed -i.bak "s/\"discovery_version\": \"${ESCAPED_CURRENT_VERSION}\"/\"discovery_version\": \"${NEW_VERSION}\"/" docs/workload-bundle.md +rm docs/workload-bundle.md.bak +echo "✅ Updated docs/workload-bundle.md" + # Fail if any file did not end up at the new version ESCAPED_NEW_VERSION="${NEW_VERSION//./\\.}" @@ -89,16 +99,19 @@ check_version VERSION "^${ESCAPED_NEW_VERSION}$" check_version setup.py "version=\"${ESCAPED_NEW_VERSION}\"," check_version pyproject.toml "^version = \"${ESCAPED_NEW_VERSION}\"$" check_version planetscale_discovery/__init__.py "^__version__ = \"${ESCAPED_NEW_VERSION}\"$" +check_version README.md "unzip ps-discovery-${ESCAPED_NEW_VERSION}\.zip" +check_version README.md "cd ps-discovery-${ESCAPED_NEW_VERSION}" +check_version docs/workload-bundle.md "\"discovery_version\": \"${ESCAPED_NEW_VERSION}\"" # Show what changed echo "" echo "Changes made:" -git diff VERSION setup.py pyproject.toml planetscale_discovery/__init__.py +git diff VERSION setup.py pyproject.toml planetscale_discovery/__init__.py README.md docs/workload-bundle.md echo "" echo "Next steps:" -echo "1. Review the changes above" -echo "2. Commit: git add VERSION setup.py pyproject.toml planetscale_discovery/__init__.py && git commit -m 'Bump version to ${NEW_VERSION}'" +echo "1. Review the changes above, and add a ## [${NEW_VERSION}] section to CHANGELOG.md" +echo "2. Commit: git add VERSION setup.py pyproject.toml planetscale_discovery/__init__.py README.md docs/workload-bundle.md CHANGELOG.md && git commit -m 'Release v${NEW_VERSION}'" echo "3. Tag: git tag -a v${NEW_VERSION} -m 'Release v${NEW_VERSION}'" echo "4. Push: git push origin main && git push origin v${NEW_VERSION}" echo ""