@panoptic-it-solutions/coolify-setup 1.1.22 → 1.1.23

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.
Files changed (2) hide show
  1. package/dist/git.js +24 -24
  2. package/package.json +1 -1
package/dist/git.js CHANGED
@@ -44,6 +44,8 @@ export async function commitAndPushToDevelop(files) {
44
44
  if (!isGitRepo()) {
45
45
  run('git init');
46
46
  }
47
+ // Save the original branch name before any operations
48
+ const originalBranch = run('git branch --show-current');
47
49
  // Stage all specified files (use -A to also stage deletions)
48
50
  for (const file of files) {
49
51
  try {
@@ -53,26 +55,19 @@ export async function commitAndPushToDevelop(files) {
53
55
  // File might not exist, that's ok
54
56
  }
55
57
  }
56
- // Check if there are staged changes
58
+ // Check if there are staged changes and commit if so
59
+ let hasNewCommit = false;
57
60
  try {
58
61
  const status = run('git diff --cached --name-only');
59
- if (!status) {
60
- result.warnings.push('No changes to commit');
61
- return result;
62
+ if (status) {
63
+ // Commit the changes
64
+ run('git commit -m "chore: add Coolify deployment configuration"');
65
+ result.committed = true;
66
+ hasNewCommit = true;
62
67
  }
63
68
  }
64
69
  catch {
65
- result.warnings.push('Failed to check git status');
66
- return result;
67
- }
68
- // Commit the changes
69
- try {
70
- run('git commit -m "chore: add Coolify deployment configuration"');
71
- result.committed = true;
72
- }
73
- catch (error) {
74
- result.warnings.push(`Failed to commit: ${error}`);
75
- return result;
70
+ // Commit might fail if nothing staged, that's ok
76
71
  }
77
72
  // Check if remote exists
78
73
  const remoteUrl = getGitRemoteUrl();
@@ -82,9 +77,8 @@ export async function commitAndPushToDevelop(files) {
82
77
  }
83
78
  // Ensure develop branch exists and push to it
84
79
  try {
85
- const currentBranch = run('git branch --show-current');
86
- if (currentBranch === 'develop') {
87
- // Pull latest changes with rebase, then push
80
+ if (originalBranch === 'develop') {
81
+ // Already on develop, pull and push
88
82
  try {
89
83
  run('git pull --rebase origin develop');
90
84
  }
@@ -94,18 +88,24 @@ export async function commitAndPushToDevelop(files) {
94
88
  run('git push origin develop');
95
89
  }
96
90
  else {
97
- // Check if develop exists remotely
91
+ // On a feature branch - need to merge into develop
98
92
  try {
99
93
  run('git fetch origin develop');
100
- // Develop exists, checkout and merge/rebase current changes
94
+ // Develop exists remotely, checkout and merge feature branch
101
95
  run('git checkout develop');
102
- run('git pull --rebase origin develop');
103
- run(`git merge ${currentBranch} --no-edit`);
96
+ try {
97
+ run('git pull --rebase origin develop');
98
+ }
99
+ catch {
100
+ // Pull might fail, continue
101
+ }
102
+ // Merge the original branch (which has the commits)
103
+ run(`git merge ${originalBranch} --no-edit`);
104
104
  run('git push origin develop');
105
105
  }
106
106
  catch {
107
- // Develop doesn't exist remotely, create it from current branch
108
- run('git push origin HEAD:develop');
107
+ // Develop doesn't exist remotely, create it from feature branch
108
+ run(`git push origin ${originalBranch}:develop`);
109
109
  }
110
110
  }
111
111
  result.pushed = true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@panoptic-it-solutions/coolify-setup",
3
- "version": "1.1.22",
3
+ "version": "1.1.23",
4
4
  "description": "CLI tool for setting up Coolify deployment on Panoptic projects",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",