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.

feat: Be able to redeploy PRs

Andras Bacsai4e8fe79e2b34
diff --git a/src/routes/applications/[id]/deploy.json.ts b/src/routes/applications/[id]/deploy.json.ts
index 0e33c7ce0b..59bd7d0016 100644
--- a/src/routes/applications/[id]/deploy.json.ts
+++ b/src/routes/applications/[id]/deploy.json.ts
@@ -11,6 +11,7 @@ export const post: RequestHandler = async (event) => {
if (status === 401) return { status, body };
const { id } = event.params;
+ const { pullmergeRequestId = null, branch } = await event.request.json();
try {
const buildId = cuid();
const applicationFound = await db.getApplication({ id, teamId });
@@ -42,7 +43,17 @@ export const post: RequestHandler = async (event) => {
type: 'manual'
}
});
- await buildQueue.add(buildId, { build_id: buildId, type: 'manual', ...applicationFound });
+ if (pullmergeRequestId) {
+ await buildQueue.add(buildId, {
+ build_id: buildId,
+ type: 'manual',
+ ...applicationFound,
+ sourceBranch: branch,
+ pullmergeRequestId
+ });
+ } else {
+ await buildQueue.add(buildId, { build_id: buildId, type: 'manual', ...applicationFound });
+ }
return {
status: 200,
body: {
diff --git a/src/routes/applications/[id]/previews/index.svelte b/src/routes/applications/[id]/previews/index.svelte
index 632dafb628..e78e46efdc 100644
--- a/src/routes/applications/[id]/previews/index.svelte
+++ b/src/routes/applications/[id]/previews/index.svelte
@@ -26,15 +26,28 @@
export let applicationSecrets;
import { getDomain } from '$lib/components/common';
import Secret from '../secrets/_Secret.svelte';
- import { get } from '$lib/api';
+ import { get, post } from '$lib/api';
import { page } from '$app/stores';
import Explainer from '$lib/components/Explainer.svelte';
+ import { errorNotification } from '$lib/form';
+ import { toast } from '@zerodevx/svelte-toast';
const { id } = $page.params;
async function refreshSecrets() {
const data = await get(`/applications/${id}/secrets.json`);
PRMRSecrets = [...data.secrets];
}
+ async function redeploy(container) {
+ try {
+ await post(`/applications/${id}/deploy.json`, {
+ pullmergeRequestId: container.pullmergeRequestId,
+ branch: container.branch
+ });
+ toast.push('Application redeployed queued.');
+ } catch ({ error }) {
+ return errorNotification(error);
+ }
+ }
</script>
<div class="flex space-x-1 p-6 font-bold">
@@ -90,6 +103,11 @@
<div class="truncate text-center text-xl font-bold">{getDomain(container.fqdn)}</div>
</div>
</a>
+ <div class="flex items-center justify-center">
+ <button class="bg-coollabs hover:bg-coollabs-100" on:click={() => redeploy(container)}
+ >Redeploy</button
+ >
+ </div>
{/each}
{:else}
<div class="flex-col">
diff --git a/src/routes/applications/[id]/storage/index.svelte b/src/routes/applications/[id]/storage/index.svelte
index 88d0ac231d..75b129d680 100644
--- a/src/routes/applications/[id]/storage/index.svelte
+++ b/src/routes/applications/[id]/storage/index.svelte
@@ -27,6 +27,7 @@
import { page } from '$app/stores';
import Storage from './_Storage.svelte';
import { get } from '$lib/api';
+ import Explainer from '$lib/components/Explainer.svelte';
const { id } = $page.params;
async function refreshStorage() {
@@ -44,6 +45,12 @@
</div>
<div class="mx-auto max-w-6xl rounded-xl px-6 pt-4">
+ <div class="flex justify-center py-4 text-center">
+ <Explainer
+ customClass="w-full"
+ text={'You can specify any folder that you want to be persistent across deployments. <br>This is useful for storing data such as a database (SQLite) or a cache.'}
+ />
+ </div>
<table class="mx-auto border-separate text-left">
<thead>
<tr class="h-12">