chore: release as 0.0.6; compare the version check against published releases
- composer.json 0.0.6, CHANGELOG entries of the withdrawn 0.1.0/0.1.1 merged into [0.0.6] - version-changelog: version must exceed the latest published release (main may carry a version whose release was withdrawn), instead of exceeding main's version Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
7f3e77a3e9
commit
bfb88a25b8
4 files changed
+26
-29
No files matched your search
@@ -22,26 +22,24 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Check version bump and changelog entry
|
||||
# The version must be higher than the latest *published release* (not just higher than main), so main can
|
||||
# carry a version whose release failed or was withdrawn without blocking the next PR.
|
||||
- name: Check version is unreleased and changelog entry exists
|
||||
env:
|
||||
TOKEN: ${{ secrets.RELEASE_TOKEN }}
|
||||
run: |
|
||||
set -e
|
||||
PR_VERSION=$(grep -m1 '"version"' composer.json | sed -E 's/.*"version"[[:space:]]*:[[:space:]]*"([^"]+)".*/\1/')
|
||||
MAIN_VERSION=$(git show origin/main:composer.json | grep -m1 '"version"' | sed -E 's/.*"version"[[:space:]]*:[[:space:]]*"([^"]+)".*/\1/')
|
||||
LATEST=$(curl -sf -H "Authorization: token ${TOKEN}" "${GITHUB_SERVER_URL}/api/v1/repos/${GITHUB_REPOSITORY}/releases?limit=100" \
|
||||
| jq -r '.[].tag_name' | sed 's/^v//' | sort -V | tail -n1)
|
||||
LATEST="${LATEST:-0.0.0}"
|
||||
|
||||
echo "main version: $MAIN_VERSION"
|
||||
echo "PR version: $PR_VERSION"
|
||||
echo "latest release: $LATEST"
|
||||
echo "PR version: $PR_VERSION"
|
||||
|
||||
if [ "$MAIN_VERSION" = "$PR_VERSION" ]; then
|
||||
echo "::error::composer.json version ($PR_VERSION) was not bumped from main ($MAIN_VERSION)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
HIGHEST=$(printf '%s\n%s\n' "$MAIN_VERSION" "$PR_VERSION" | sort -V | tail -n1)
|
||||
if [ "$HIGHEST" != "$PR_VERSION" ]; then
|
||||
echo "::error::composer.json version ($PR_VERSION) is not greater than main's ($MAIN_VERSION)"
|
||||
if [ "$PR_VERSION" = "$LATEST" ] || [ "$(printf '%s\n%s\n' "$LATEST" "$PR_VERSION" | sort -V | tail -n1)" != "$PR_VERSION" ]; then
|
||||
echo "::error::composer.json version ($PR_VERSION) is not greater than the latest release ($LATEST)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -50,7 +48,7 @@ jobs:
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "OK: version bumped to $PR_VERSION and documented in CHANGELOG.md"
|
||||
echo "OK: $PR_VERSION is unreleased and documented in CHANGELOG.md"
|
||||
|
||||
# Packages the extension (builds admin/storefront assets) and validates the resulting zip,
|
||||
# which is the artifact that ships. A separate directory validate would only repeat these checks.
|
||||
|
||||
Reference in new issue
Block a user