@panoptic-it-solutions/coolify-setup 1.1.21 → 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.
- package/dist/git.js +30 -23
- 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 (
|
|
60
|
-
|
|
61
|
-
|
|
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
|
-
|
|
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,23 +77,35 @@ export async function commitAndPushToDevelop(files) {
|
|
|
82
77
|
}
|
|
83
78
|
// Ensure develop branch exists and push to it
|
|
84
79
|
try {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
80
|
+
if (originalBranch === 'develop') {
|
|
81
|
+
// Already on develop, pull and push
|
|
82
|
+
try {
|
|
83
|
+
run('git pull --rebase origin develop');
|
|
84
|
+
}
|
|
85
|
+
catch {
|
|
86
|
+
// Pull might fail if remote doesn't exist yet, that's ok
|
|
87
|
+
}
|
|
88
88
|
run('git push origin develop');
|
|
89
89
|
}
|
|
90
90
|
else {
|
|
91
|
-
//
|
|
91
|
+
// On a feature branch - need to merge into develop
|
|
92
92
|
try {
|
|
93
93
|
run('git fetch origin develop');
|
|
94
|
-
// Develop exists, checkout and merge
|
|
94
|
+
// Develop exists remotely, checkout and merge feature branch
|
|
95
95
|
run('git checkout develop');
|
|
96
|
-
|
|
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`);
|
|
97
104
|
run('git push origin develop');
|
|
98
105
|
}
|
|
99
106
|
catch {
|
|
100
|
-
// Develop doesn't exist remotely, create it from
|
|
101
|
-
run(
|
|
107
|
+
// Develop doesn't exist remotely, create it from feature branch
|
|
108
|
+
run(`git push origin ${originalBranch}:develop`);
|
|
102
109
|
}
|
|
103
110
|
}
|
|
104
111
|
result.pushed = true;
|