Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 22 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
8 changes: 5 additions & 3 deletions RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"
```

Expand Down
19 changes: 16 additions & 3 deletions bump_version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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//./\\.}"

Expand All @@ -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 ""
Expand Down
Loading