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
5 changes: 5 additions & 0 deletions bin/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ else
echo " ⚠ gh CLI not found — GitHub Release will need to be created manually"
fi

# Derive repo from git remote so gh doesn't require set-default
GH_REPO=$(git remote get-url origin | sed -E 's#.*github\.com[:/](.+)\.git$#\1#; s#.*github\.com[:/](.+)$#\1#')

echo " ✓ PHP ${PHP_VERSION}"
echo " ✓ Branch: main (merged from develop)"
echo " ✓ Working directory clean"
Expand Down Expand Up @@ -82,6 +85,7 @@ if [[ "$GH_AVAILABLE" == "true" ]]; then

if [[ -n "$PREV_TAG" ]]; then
if gh release create "$TAG" \
--repo "$GH_REPO" \
--generate-notes \
--latest \
--notes-start-tag "$PREV_TAG"; then
Expand All @@ -91,6 +95,7 @@ if [[ "$GH_AVAILABLE" == "true" ]]; then
fi
else
if gh release create "$TAG" \
--repo "$GH_REPO" \
--generate-notes \
--latest; then
echo " ✓ GitHub Release created"
Expand Down
7 changes: 7 additions & 0 deletions tests/ReleaseScriptTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,13 @@
->and($contents)->toContain('8.5');
});

it('derives repo from git remote for gh release create', function () use ($script): void {
$contents = file_get_contents($script);

expect($contents)->toContain('GH_REPO=$(git remote get-url origin')
->and($contents)->toContain('--repo "$GH_REPO"');
});

it('creates bin/release.sh with version argument validation', function () use ($root, $script): void {
expect(file_exists($script))->toBeTrue('bin/release.sh does not exist')
->and(is_executable($script))->toBeTrue('bin/release.sh is not executable');
Expand Down