Merge pull request #10627 from appwrite/fix-releases-sdks

fix: prevent empty releases in sdk release script
This commit is contained in:
Jake Barnby 2025-10-10 21:43:35 +13:00 committed by GitHub
commit d89173ad57
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -280,6 +280,20 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
continue;
}
// Check if the latest commit on the target branch already has a release
$latestCommitCommand = 'gh api repos/' . $repoName . '/commits/' . $releaseTarget . ' --jq ".sha" 2>/dev/null';
$latestCommitSha = trim(\shell_exec($latestCommitCommand) ?? '');
if (!empty($latestCommitSha)) {
$commitReleasesCommand = 'gh api repos/' . $repoName . '/releases --jq ".[] | select(.target_commitish == \"' . $releaseTarget . '\") | .tag_name" 2>/dev/null | head -n 1';
$existingCommitRelease = trim(\shell_exec($commitReleasesCommand) ?? '');
if (!empty($existingCommitRelease)) {
Console::warning("Latest commit on {$releaseTarget} already has a release ({$existingCommitRelease}) for {$language['name']} SDK, skipping to avoid empty release...");
continue;
}
}
$previousVersion = '';
$tagListCommand = 'gh release list --repo "' . $repoName . '" --limit 1 --json tagName --jq ".[0].tagName" 2>&1';
$previousVersion = trim(\shell_exec($tagListCommand) ?? '');