Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

fix(changelog): use configurable GitHub releases source

Andras Bacsaiffe8cfd76f29
diff --git a/config/constants.php b/config/constants.php
index 7721ff2134..0a0227ea6c 100644
--- a/config/constants.php
+++ b/config/constants.php
@@ -16,7 +16,7 @@ return [
'cdn_url' => env('CDN_URL', 'https://cdn.coollabs.io'),
'versions_url' => env('VERSIONS_URL', env('CDN_URL', 'https://cdn.coollabs.io').'/coolify/versions.json'),
'upgrade_script_url' => env('UPGRADE_SCRIPT_URL', env('CDN_URL', 'https://cdn.coollabs.io').'/coolify/upgrade.sh'),
- 'releases_url' => 'https://cdn.coolify.io/releases.json',
+ 'releases_url' => env('RELEASES_URL', 'https://raw.githubusercontent.com/coollabsio/coolify-cdn/main/json/releases.json'),
],
'urls' => [
diff --git a/tests/Feature/PullChangelogTest.php b/tests/Feature/PullChangelogTest.php
new file mode 100644
index 0000000000..145638812b
--- /dev/null
+++ b/tests/Feature/PullChangelogTest.php
@@ -0,0 +1,72 @@
+<?php
+
+use App\Jobs\PullChangelog;
+use Illuminate\Support\Facades\File;
+use Illuminate\Support\Facades\Http;
+
+/**
+ * Fake releases land in a month that no real release uses, so the generated
+ * changelog file never collides with committed changelogs.
+ */
+function fakeReleasesPayload(): array
+{
+ return [
+ [
+ 'tag_name' => 'v9.9.9',
+ 'name' => 'Test Release',
+ 'body' => 'Released notes here.',
+ 'draft' => false,
+ 'published_at' => '1999-01-15T00:00:00Z',
+ ],
+ [
+ 'tag_name' => 'v9.9.8-draft',
+ 'name' => 'Draft Release',
+ 'body' => 'Should be skipped.',
+ 'draft' => true,
+ 'published_at' => '1999-01-10T00:00:00Z',
+ ],
+ ];
+}
+
+afterEach(function () {
+ File::delete(base_path('changelogs/1999-01.json'));
+});
+
+test('releases_url config defaults to the GitHub raw source', function () {
+ expect(config('constants.coolify.releases_url'))
+ ->toBe('https://raw.githubusercontent.com/coollabsio/coolify-cdn/main/json/releases.json');
+});
+
+test('PullChangelog fetches from the configured releases_url and writes the changelog', function () {
+ config(['constants.coolify.releases_url' => 'https://example.test/releases.json']);
+
+ Http::fake([
+ 'https://example.test/releases.json' => Http::response(fakeReleasesPayload(), 200),
+ ]);
+
+ (new PullChangelog)->handle();
+
+ Http::assertSent(fn ($request) => $request->url() === 'https://example.test/releases.json');
+
+ $path = base_path('changelogs/1999-01.json');
+ expect(File::exists($path))->toBeTrue();
+
+ $data = json_decode(File::get($path), true);
+ expect($data['entries'])->toHaveCount(1)
+ ->and($data['entries'][0]['tag_name'])->toBe('v9.9.9');
+});
+
+test('PullChangelog skips draft releases', function () {
+ config(['constants.coolify.releases_url' => 'https://example.test/releases.json']);
+
+ Http::fake([
+ 'https://example.test/releases.json' => Http::response(fakeReleasesPayload(), 200),
+ ]);
+
+ (new PullChangelog)->handle();
+
+ $data = json_decode(File::get(base_path('changelogs/1999-01.json')), true);
+
+ $tags = array_column($data['entries'], 'tag_name');
+ expect($tags)->not->toContain('v9.9.8-draft');
+});