@panoptic-it-solutions/coolify-setup 1.1.29 → 1.1.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/git.js CHANGED
@@ -237,50 +237,75 @@ export async function setupGitHub(projectName) {
237
237
  }
238
238
  }
239
239
  // Ensure we're on develop branch and push to it
240
+ // Skip if there are uncommitted changes - commitAndPushToDevelop will handle it
241
+ let hasUncommittedChanges = false;
240
242
  try {
241
- const currentBranch = run('git branch --show-current') || 'develop';
242
- if (currentBranch !== 'develop') {
243
- // Try to checkout develop
244
- let checkoutSucceeded = false;
245
- try {
246
- // Check if develop exists locally
243
+ const status = run('git status --porcelain');
244
+ hasUncommittedChanges = status.length > 0;
245
+ }
246
+ catch {
247
+ // If status check fails, proceed anyway
248
+ }
249
+ if (!hasUncommittedChanges) {
250
+ // Only try to push develop if there are no uncommitted changes
251
+ // (commitAndPushToDevelop will handle it after committing)
252
+ try {
253
+ const currentBranch = run('git branch --show-current') || 'develop';
254
+ if (currentBranch !== 'develop') {
255
+ // Try to checkout develop
256
+ let checkoutSucceeded = false;
247
257
  try {
248
- run('git rev-parse --verify develop');
249
- run('git checkout develop');
258
+ // Check if develop exists locally
259
+ try {
260
+ run('git rev-parse --verify develop');
261
+ run('git checkout develop');
262
+ }
263
+ catch {
264
+ // Create develop from current branch
265
+ run('git checkout -b develop');
266
+ }
267
+ checkoutSucceeded = true;
250
268
  }
251
269
  catch {
252
- // Create develop from current branch
253
- run('git checkout -b develop');
270
+ // Checkout failed - might be worktree issue
271
+ // Try to push current branch to develop instead (if fast-forward possible)
272
+ try {
273
+ // First fetch to check if develop exists remotely
274
+ try {
275
+ run('git fetch origin develop');
276
+ // Check if current branch contains all develop commits (fast-forward possible)
277
+ run(`git merge-base --is-ancestor origin/develop ${currentBranch}`);
278
+ }
279
+ catch {
280
+ // Either develop doesn't exist remotely, or can't fast-forward
281
+ // Try push anyway - will fail if develop exists and diverged
282
+ }
283
+ run(`git push origin ${currentBranch}:develop -u`);
284
+ result.developBranchCreated = true;
285
+ result.repoPushed = true;
286
+ // Skip the rest of develop push logic since we already pushed
287
+ checkoutSucceeded = false;
288
+ }
289
+ catch {
290
+ result.warnings.push('Failed to push develop branch (checkout failed, possibly worktree conflict or branches diverged)');
291
+ checkoutSucceeded = false;
292
+ }
254
293
  }
255
- checkoutSucceeded = true;
256
- }
257
- catch {
258
- // Checkout failed - might be worktree issue
259
- // Try to push current branch to develop instead (if fast-forward possible)
260
- try {
261
- // First fetch to check if develop exists remotely
294
+ if (checkoutSucceeded) {
295
+ // Pull latest changes before pushing to avoid non-fast-forward errors
262
296
  try {
263
- run('git fetch origin develop');
264
- // Check if current branch contains all develop commits (fast-forward possible)
265
- run(`git merge-base --is-ancestor origin/develop ${currentBranch}`);
297
+ run('git pull --rebase origin develop');
266
298
  }
267
299
  catch {
268
- // Either develop doesn't exist remotely, or can't fast-forward
269
- // Try push anyway - will fail if develop exists and diverged
300
+ // Pull might fail if remote doesn't exist yet, that's ok
270
301
  }
271
- run(`git push origin ${currentBranch}:develop -u`);
302
+ run('git push origin develop -u');
272
303
  result.developBranchCreated = true;
273
304
  result.repoPushed = true;
274
- // Skip the rest of develop push logic since we already pushed
275
- checkoutSucceeded = false;
276
- }
277
- catch {
278
- result.warnings.push('Failed to push develop branch (checkout failed, possibly worktree conflict or branches diverged)');
279
- checkoutSucceeded = false;
280
305
  }
281
306
  }
282
- if (checkoutSucceeded) {
283
- // Pull latest changes before pushing to avoid non-fast-forward errors
307
+ else {
308
+ // Already on develop
284
309
  try {
285
310
  run('git pull --rebase origin develop');
286
311
  }
@@ -292,22 +317,10 @@ export async function setupGitHub(projectName) {
292
317
  result.repoPushed = true;
293
318
  }
294
319
  }
295
- else {
296
- // Already on develop
297
- try {
298
- run('git pull --rebase origin develop');
299
- }
300
- catch {
301
- // Pull might fail if remote doesn't exist yet, that's ok
302
- }
303
- run('git push origin develop -u');
304
- result.developBranchCreated = true;
305
- result.repoPushed = true;
320
+ catch {
321
+ result.warnings.push('Failed to push develop branch');
306
322
  }
307
323
  }
308
- catch {
309
- result.warnings.push('Failed to push develop branch');
310
- }
311
324
  // Create main branch from develop if it doesn't exist
312
325
  try {
313
326
  // Check if main exists remotely
@@ -76,12 +76,7 @@ jobs:
76
76
  owner: context.repo.owner,
77
77
  repo: context.repo.repo,
78
78
  title: \`Deploy: \${sourceBranch} -> \${targetBranch}\`,
79
- body: \`Automated deployment PR from \${sourceBranch} to \${targetBranch}.
80
-
81
- **Commit:** \${{ steps.sha.outputs.sha }}
82
- **Image:** \${{ env.REGISTRY }}/\${{ env.PROJECT_NAME }}-app:\${{ steps.sha.outputs.sha }}
83
-
84
- Merge this PR to trigger deployment.\`,
79
+ body: \`Automated deployment PR from \${sourceBranch} to \${targetBranch}.\\n\\n**Commit:** \${{ steps.sha.outputs.sha }}\\n**Image:** \${{ env.REGISTRY }}/\${{ env.PROJECT_NAME }}-app:\${{ steps.sha.outputs.sha }}\\n\\nMerge this PR to trigger deployment.\`,
85
80
  head: sourceBranch,
86
81
  base: targetBranch
87
82
  });
@@ -114,12 +109,7 @@ Merge this PR to trigger deployment.\`,
114
109
  owner: context.repo.owner,
115
110
  repo: context.repo.repo,
116
111
  title: 'Deploy to Production: staging -> main',
117
- body: \`Promote staging to production.
118
-
119
- **Commit:** \${{ steps.sha.outputs.sha }}
120
- **Image:** \${{ env.REGISTRY }}/\${{ env.PROJECT_NAME }}-app:\${{ steps.sha.outputs.sha }}
121
-
122
- Merge this PR to deploy to production.\`,
112
+ body: \`Promote staging to production.\\n\\n**Commit:** \${{ steps.sha.outputs.sha }}\\n**Image:** \${{ env.REGISTRY }}/\${{ env.PROJECT_NAME }}-app:\${{ steps.sha.outputs.sha }}\\n\\nMerge this PR to deploy to production.\`,
123
113
  head: 'staging',
124
114
  base: 'main'
125
115
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@panoptic-it-solutions/coolify-setup",
3
- "version": "1.1.29",
3
+ "version": "1.1.31",
4
4
  "description": "CLI tool for setting up Coolify deployment on Panoptic projects",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",