@panoptic-it-solutions/coolify-setup 1.1.31 → 1.1.33
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/generator.js +4 -1
- package/dist/index.js +2 -0
- package/dist/templates/docker-compose.js +5 -4
- package/dist/templates/index.d.ts +1 -0
- package/dist/templates/index.js +1 -0
- package/dist/templates/staging-workflow.d.ts +1 -0
- package/dist/templates/staging-workflow.js +176 -0
- package/package.json +1 -1
package/dist/generator.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { existsSync, mkdirSync, writeFileSync, readFileSync, unlinkSync, readdirSync, rmSync } from 'fs';
|
|
2
2
|
import { join, dirname } from 'path';
|
|
3
3
|
import { execSync } from 'child_process';
|
|
4
|
-
import { generateDockerfile, generateDockerCompose, generateDockerComposeBuild, generateWorkflow, generateEntrypoint, generateMigrateScript, generateClaudeRules, } from './templates/index.js';
|
|
4
|
+
import { generateDockerfile, generateDockerCompose, generateDockerComposeBuild, generateWorkflow, generateStagingWorkflow, generateEntrypoint, generateMigrateScript, generateClaudeRules, } from './templates/index.js';
|
|
5
5
|
function ensureDir(filePath) {
|
|
6
6
|
const dir = dirname(filePath);
|
|
7
7
|
if (!existsSync(dir)) {
|
|
@@ -157,6 +157,9 @@ export async function generateFiles(options) {
|
|
|
157
157
|
projectName,
|
|
158
158
|
});
|
|
159
159
|
writeFile('.github/workflows/build-deploy.yml', workflow);
|
|
160
|
+
// Generate staging version workflow
|
|
161
|
+
const stagingWorkflow = generateStagingWorkflow();
|
|
162
|
+
writeFile('.github/workflows/staging-version.yml', stagingWorkflow);
|
|
160
163
|
// Generate entrypoint.sh
|
|
161
164
|
const entrypoint = generateEntrypoint({
|
|
162
165
|
projectType,
|
package/dist/index.js
CHANGED
|
@@ -81,6 +81,7 @@ async function main() {
|
|
|
81
81
|
'docker-compose.yml',
|
|
82
82
|
'docker-compose.build.yml',
|
|
83
83
|
'.github/workflows/build-deploy.yml',
|
|
84
|
+
'.github/workflows/staging-version.yml',
|
|
84
85
|
'.claude/rules/coolify.md',
|
|
85
86
|
'entrypoint.sh',
|
|
86
87
|
'package.json', // May be modified with esbuild
|
|
@@ -111,6 +112,7 @@ async function main() {
|
|
|
111
112
|
console.log(chalk.green(' ✓ docker-compose.yml'));
|
|
112
113
|
console.log(chalk.green(' ✓ docker-compose.build.yml'));
|
|
113
114
|
console.log(chalk.green(' ✓ .github/workflows/build-deploy.yml'));
|
|
115
|
+
console.log(chalk.green(' ✓ .github/workflows/staging-version.yml'));
|
|
114
116
|
console.log(chalk.green(' ✓ .claude/rules/coolify.md'));
|
|
115
117
|
console.log(chalk.green(' ✓ entrypoint.sh'));
|
|
116
118
|
if (response.includePostgres) {
|
|
@@ -7,8 +7,8 @@ export function generateDockerCompose(options) {
|
|
|
7
7
|
services.push(` app:
|
|
8
8
|
image: ${REGISTRY}/${projectName}-app:latest
|
|
9
9
|
restart: unless-stopped
|
|
10
|
-
|
|
11
|
-
- "3000
|
|
10
|
+
expose:
|
|
11
|
+
- "3000"
|
|
12
12
|
environment:
|
|
13
13
|
- NODE_ENV=production${includePostgres ? `
|
|
14
14
|
- POSTGRES_URL=postgres://\${POSTGRES_USER:-postgres}:\${POSTGRES_PASSWORD:-postgres}@postgres:5432/\${POSTGRES_DB:-app}` : ''}${includeRedis ? `
|
|
@@ -70,8 +70,9 @@ export function generateDockerCompose(options) {
|
|
|
70
70
|
- MINIO_ROOT_PASSWORD=\${MINIO_SECRET_KEY:-minioadmin}
|
|
71
71
|
volumes:
|
|
72
72
|
- minio-data:/data
|
|
73
|
-
|
|
74
|
-
- "
|
|
73
|
+
expose:
|
|
74
|
+
- "9000"
|
|
75
|
+
- "9001"`);
|
|
75
76
|
volumes.push(' minio-data:');
|
|
76
77
|
}
|
|
77
78
|
let compose = `services:
|
|
@@ -2,6 +2,7 @@ export { generateDockerfile, type DockerfileOptions } from './dockerfile.js';
|
|
|
2
2
|
export { generateDockerCompose, type DockerComposeOptions } from './docker-compose.js';
|
|
3
3
|
export { generateDockerComposeBuild, type DockerComposeBuildOptions } from './docker-compose-build.js';
|
|
4
4
|
export { generateWorkflow, type WorkflowOptions } from './workflow.js';
|
|
5
|
+
export { generateStagingWorkflow } from './staging-workflow.js';
|
|
5
6
|
export { generateEntrypoint, type EntrypointOptions } from './entrypoint.js';
|
|
6
7
|
export { generateMigrateScript, type MigrateScriptOptions } from './migrate.js';
|
|
7
8
|
export { generateClaudeRules } from './claude-rules.js';
|
package/dist/templates/index.js
CHANGED
|
@@ -2,6 +2,7 @@ export { generateDockerfile } from './dockerfile.js';
|
|
|
2
2
|
export { generateDockerCompose } from './docker-compose.js';
|
|
3
3
|
export { generateDockerComposeBuild } from './docker-compose-build.js';
|
|
4
4
|
export { generateWorkflow } from './workflow.js';
|
|
5
|
+
export { generateStagingWorkflow } from './staging-workflow.js';
|
|
5
6
|
export { generateEntrypoint } from './entrypoint.js';
|
|
6
7
|
export { generateMigrateScript } from './migrate.js';
|
|
7
8
|
export { generateClaudeRules } from './claude-rules.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function generateStagingWorkflow(): string;
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
export function generateStagingWorkflow() {
|
|
2
|
+
return `name: Staging Version
|
|
3
|
+
|
|
4
|
+
on:
|
|
5
|
+
push:
|
|
6
|
+
branches:
|
|
7
|
+
- staging
|
|
8
|
+
|
|
9
|
+
permissions:
|
|
10
|
+
contents: write
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
version:
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
steps:
|
|
16
|
+
- name: Checkout
|
|
17
|
+
uses: actions/checkout@v4
|
|
18
|
+
with:
|
|
19
|
+
fetch-depth: 0
|
|
20
|
+
token: \${{ secrets.GITHUB_TOKEN }}
|
|
21
|
+
|
|
22
|
+
- name: Setup Node.js
|
|
23
|
+
uses: actions/setup-node@v4
|
|
24
|
+
with:
|
|
25
|
+
node-version: '22'
|
|
26
|
+
|
|
27
|
+
- name: Configure Git
|
|
28
|
+
run: |
|
|
29
|
+
git config user.name "github-actions[bot]"
|
|
30
|
+
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
31
|
+
|
|
32
|
+
- name: Get last staging tag
|
|
33
|
+
id: last_tag
|
|
34
|
+
run: |
|
|
35
|
+
LAST_TAG=\$(git tag -l "staging-v*" --sort=-v:refname | head -n1)
|
|
36
|
+
if [ -z "\$LAST_TAG" ]; then
|
|
37
|
+
LAST_TAG=\$(git rev-list --max-parents=0 HEAD)
|
|
38
|
+
fi
|
|
39
|
+
echo "tag=\$LAST_TAG" >> \$GITHUB_OUTPUT
|
|
40
|
+
|
|
41
|
+
- name: Determine version bump from commits
|
|
42
|
+
id: bump
|
|
43
|
+
run: |
|
|
44
|
+
COMMITS=\$(git log \${{ steps.last_tag.outputs.tag }}..HEAD --pretty=format:"%s" 2>/dev/null || git log --pretty=format:"%s")
|
|
45
|
+
|
|
46
|
+
BUMP="patch"
|
|
47
|
+
|
|
48
|
+
if echo "\$COMMITS" | grep -qiE "^feat(\\(.+\\))?!:|BREAKING CHANGE:"; then
|
|
49
|
+
BUMP="major"
|
|
50
|
+
elif echo "\$COMMITS" | grep -qiE "^feat(\\(.+\\))?:"; then
|
|
51
|
+
BUMP="minor"
|
|
52
|
+
fi
|
|
53
|
+
|
|
54
|
+
echo "type=\$BUMP" >> \$GITHUB_OUTPUT
|
|
55
|
+
|
|
56
|
+
- name: Bump version
|
|
57
|
+
id: version
|
|
58
|
+
run: |
|
|
59
|
+
CURRENT=\$(node -p "require('./package.json').version")
|
|
60
|
+
LAST_TAG="\${{ steps.last_tag.outputs.tag }}"
|
|
61
|
+
|
|
62
|
+
# Check if HEAD is the same as the last tag (rerun scenario with no new commits)
|
|
63
|
+
LAST_TAG_SHA=\$(git rev-parse "\$LAST_TAG" 2>/dev/null || echo "")
|
|
64
|
+
HEAD_SHA=\$(git rev-parse HEAD)
|
|
65
|
+
|
|
66
|
+
if [ "\$LAST_TAG_SHA" = "\$HEAD_SHA" ]; then
|
|
67
|
+
echo "HEAD is at \$LAST_TAG, no new commits to version"
|
|
68
|
+
echo "version=\$CURRENT" >> \$GITHUB_OUTPUT
|
|
69
|
+
echo "skip_commit=true" >> \$GITHUB_OUTPUT
|
|
70
|
+
exit 0
|
|
71
|
+
fi
|
|
72
|
+
|
|
73
|
+
# Check if there are any commits since last tag (excluding version bump commits)
|
|
74
|
+
NEW_COMMITS=\$(git log "\$LAST_TAG"..HEAD --pretty=format:"%s" --invert-grep --grep="^chore(release):" 2>/dev/null | head -1)
|
|
75
|
+
if [ -z "\$NEW_COMMITS" ]; then
|
|
76
|
+
echo "No new commits since \$LAST_TAG (only release commits)"
|
|
77
|
+
echo "version=\$CURRENT" >> \$GITHUB_OUTPUT
|
|
78
|
+
echo "skip_commit=true" >> \$GITHUB_OUTPUT
|
|
79
|
+
exit 0
|
|
80
|
+
fi
|
|
81
|
+
|
|
82
|
+
IFS='.' read -r MAJOR MINOR PATCH <<< "\$CURRENT"
|
|
83
|
+
|
|
84
|
+
case "\${{ steps.bump.outputs.type }}" in
|
|
85
|
+
major)
|
|
86
|
+
MAJOR=\$((MAJOR + 1))
|
|
87
|
+
MINOR=0
|
|
88
|
+
PATCH=0
|
|
89
|
+
;;
|
|
90
|
+
minor)
|
|
91
|
+
MINOR=\$((MINOR + 1))
|
|
92
|
+
PATCH=0
|
|
93
|
+
;;
|
|
94
|
+
patch)
|
|
95
|
+
PATCH=\$((PATCH + 1))
|
|
96
|
+
;;
|
|
97
|
+
esac
|
|
98
|
+
|
|
99
|
+
NEW_VERSION="\${MAJOR}.\${MINOR}.\${PATCH}"
|
|
100
|
+
npm version \$NEW_VERSION --no-git-tag-version
|
|
101
|
+
|
|
102
|
+
echo "version=\$NEW_VERSION" >> \$GITHUB_OUTPUT
|
|
103
|
+
echo "skip_commit=false" >> \$GITHUB_OUTPUT
|
|
104
|
+
|
|
105
|
+
- name: Generate changelog
|
|
106
|
+
id: changelog
|
|
107
|
+
if: steps.version.outputs.skip_commit != 'true'
|
|
108
|
+
run: |
|
|
109
|
+
LAST_TAG="\${{ steps.last_tag.outputs.tag }}"
|
|
110
|
+
|
|
111
|
+
{
|
|
112
|
+
echo "changelog<<EOF"
|
|
113
|
+
echo "## Changes in v\${{ steps.version.outputs.version }}"
|
|
114
|
+
echo ""
|
|
115
|
+
|
|
116
|
+
# Features
|
|
117
|
+
FEATURES=\$(git log \$LAST_TAG..HEAD --pretty=format:"- %s" --grep="^feat" 2>/dev/null || true)
|
|
118
|
+
if [ -n "\$FEATURES" ]; then
|
|
119
|
+
echo "### Features"
|
|
120
|
+
echo "\$FEATURES"
|
|
121
|
+
echo ""
|
|
122
|
+
fi
|
|
123
|
+
|
|
124
|
+
# Fixes
|
|
125
|
+
FIXES=\$(git log \$LAST_TAG..HEAD --pretty=format:"- %s" --grep="^fix" 2>/dev/null || true)
|
|
126
|
+
if [ -n "\$FIXES" ]; then
|
|
127
|
+
echo "### Bug Fixes"
|
|
128
|
+
echo "\$FIXES"
|
|
129
|
+
echo ""
|
|
130
|
+
fi
|
|
131
|
+
|
|
132
|
+
# Other changes
|
|
133
|
+
OTHERS=\$(git log \$LAST_TAG..HEAD --pretty=format:"- %s" --invert-grep --grep="^feat" --grep="^fix" 2>/dev/null | head -20 || true)
|
|
134
|
+
if [ -n "\$OTHERS" ]; then
|
|
135
|
+
echo "### Other Changes"
|
|
136
|
+
echo "\$OTHERS"
|
|
137
|
+
echo ""
|
|
138
|
+
fi
|
|
139
|
+
|
|
140
|
+
echo "EOF"
|
|
141
|
+
} >> \$GITHUB_OUTPUT
|
|
142
|
+
|
|
143
|
+
- name: Commit version bump
|
|
144
|
+
if: steps.version.outputs.skip_commit != 'true'
|
|
145
|
+
run: |
|
|
146
|
+
git add package.json
|
|
147
|
+
git commit -m "chore(release): v\${{ steps.version.outputs.version }}"
|
|
148
|
+
|
|
149
|
+
- name: Create and push tag
|
|
150
|
+
if: steps.version.outputs.skip_commit != 'true'
|
|
151
|
+
run: |
|
|
152
|
+
TAG_NAME="staging-v\${{ steps.version.outputs.version }}"
|
|
153
|
+
# Check if tag already exists
|
|
154
|
+
if git rev-parse "\$TAG_NAME" >/dev/null 2>&1; then
|
|
155
|
+
EXISTING_SHA=\$(git rev-parse "\$TAG_NAME")
|
|
156
|
+
CURRENT_SHA=\$(git rev-parse HEAD)
|
|
157
|
+
if [ "\$EXISTING_SHA" = "\$CURRENT_SHA" ]; then
|
|
158
|
+
echo "Tag \$TAG_NAME already exists at current commit, skipping"
|
|
159
|
+
else
|
|
160
|
+
echo "Error: Tag \$TAG_NAME exists at different commit"
|
|
161
|
+
exit 1
|
|
162
|
+
fi
|
|
163
|
+
else
|
|
164
|
+
git tag "\$TAG_NAME"
|
|
165
|
+
fi
|
|
166
|
+
git push origin staging --tags
|
|
167
|
+
|
|
168
|
+
- name: Output version info
|
|
169
|
+
run: |
|
|
170
|
+
echo "## Version Summary" >> \$GITHUB_STEP_SUMMARY
|
|
171
|
+
echo "" >> \$GITHUB_STEP_SUMMARY
|
|
172
|
+
echo "**Version:** v\${{ steps.version.outputs.version }}" >> \$GITHUB_STEP_SUMMARY
|
|
173
|
+
echo "**Bump Type:** \${{ steps.bump.outputs.type }}" >> \$GITHUB_STEP_SUMMARY
|
|
174
|
+
echo "**Skipped:** \${{ steps.version.outputs.skip_commit }}" >> \$GITHUB_STEP_SUMMARY
|
|
175
|
+
`;
|
|
176
|
+
}
|