@panoptic-it-solutions/coolify-setup 1.1.37 → 1.1.38

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 CHANGED
@@ -214,6 +214,9 @@ export async function generateFiles(options) {
214
214
  // Generate GitHub workflow
215
215
  const workflow = generateWorkflow({
216
216
  projectName,
217
+ includePostgres,
218
+ dbPath,
219
+ packageManager,
217
220
  });
218
221
  writeFile('.github/workflows/build-deploy.yml', workflow);
219
222
  // Generate staging version workflow
@@ -6,6 +6,7 @@ export function generateDockerCompose(options) {
6
6
  // App service
7
7
  services.push(` app:
8
8
  image: ${REGISTRY}/${projectName}-app:latest
9
+ pull_policy: always
9
10
  restart: unless-stopped
10
11
  expose:
11
12
  - "3000"
@@ -36,8 +36,9 @@ function generateNextjsDockerfile(options) {
36
36
  // postgres must be externalized due to pnpm's symlink structure causing resolution issues
37
37
  const migrationBundle = includePostgres ? `
38
38
 
39
- # Create migrations folder if it doesn't exist (may be gitignored)
40
- RUN mkdir -p ${dbPath}/migrations
39
+ # Verify migrations exist (fail build if missing - don't silently create empty folder)
40
+ RUN echo "Checking migrations:" && ls -la ${dbPath}/migrations/ && \\
41
+ test -f ${dbPath}/migrations/meta/_journal.json || (echo "ERROR: Migrations not found! Run 'drizzle-kit generate' and commit the files." && exit 1)
41
42
 
42
43
  # Build the migration bundle (single JS file with all deps baked in)
43
44
  # This avoids module resolution issues in the standalone container
@@ -8,6 +8,7 @@ on:
8
8
 
9
9
  permissions:
10
10
  contents: write
11
+ pull-requests: write
11
12
 
12
13
  jobs:
13
14
  version:
@@ -172,5 +173,38 @@ jobs:
172
173
  echo "**Version:** v\${{ steps.version.outputs.version }}" >> \$GITHUB_STEP_SUMMARY
173
174
  echo "**Bump Type:** \${{ steps.bump.outputs.type }}" >> \$GITHUB_STEP_SUMMARY
174
175
  echo "**Skipped:** \${{ steps.version.outputs.skip_commit }}" >> \$GITHUB_STEP_SUMMARY
176
+
177
+ - name: Create sync PR to develop
178
+ if: steps.version.outputs.skip_commit != 'true'
179
+ uses: actions/github-script@v7
180
+ with:
181
+ script: |
182
+ // Check if sync PR already exists
183
+ const { data: prs } = await github.rest.pulls.list({
184
+ owner: context.repo.owner,
185
+ repo: context.repo.repo,
186
+ head: \`\${context.repo.owner}:staging\`,
187
+ base: 'develop',
188
+ state: 'open'
189
+ });
190
+
191
+ if (prs.length > 0) {
192
+ console.log(\`Sync PR #\${prs[0].number} already exists for staging -> develop\`);
193
+ return;
194
+ }
195
+
196
+ try {
197
+ const { data: pr } = await github.rest.pulls.create({
198
+ owner: context.repo.owner,
199
+ repo: context.repo.repo,
200
+ title: \`Sync: version bump v\${{ steps.version.outputs.version }} → develop\`,
201
+ body: \`Syncs the version bump commit back to develop to prevent package.json conflicts in future merges.\\n\\n**Version:** v\${{ steps.version.outputs.version }}\\n\\nMerge this PR to keep branches in sync.\`,
202
+ head: 'staging',
203
+ base: 'develop'
204
+ });
205
+ console.log(\`Created sync PR #\${pr.number}\`);
206
+ } catch (error) {
207
+ console.log(\`Sync PR creation skipped: \${error.message}\`);
208
+ }
175
209
  `;
176
210
  }
@@ -1,4 +1,7 @@
1
1
  export interface WorkflowOptions {
2
2
  projectName: string;
3
+ includePostgres?: boolean;
4
+ dbPath?: string;
5
+ packageManager?: 'pnpm' | 'npm' | 'yarn';
3
6
  }
4
7
  export declare function generateWorkflow(options: WorkflowOptions): string;
@@ -1,6 +1,51 @@
1
1
  const REGISTRY = '10.0.0.2:5000';
2
2
  export function generateWorkflow(options) {
3
- const { projectName } = options;
3
+ const { projectName, includePostgres = false, dbPath = 'src/lib/db', packageManager = 'pnpm' } = options;
4
+ const installCmd = packageManager === 'pnpm'
5
+ ? 'pnpm install --frozen-lockfile'
6
+ : packageManager === 'yarn'
7
+ ? 'yarn install --frozen-lockfile'
8
+ : 'npm ci';
9
+ const drizzleCmd = packageManager === 'pnpm'
10
+ ? 'pnpm drizzle-kit generate'
11
+ : packageManager === 'yarn'
12
+ ? 'yarn drizzle-kit generate'
13
+ : 'npx drizzle-kit generate';
14
+ const pnpmSetup = packageManager === 'pnpm' ? `
15
+ - name: Setup pnpm
16
+ run: corepack enable && corepack prepare pnpm@latest --activate
17
+ ` : '';
18
+ const migrationCheck = includePostgres ? `
19
+ - name: Setup Node.js
20
+ uses: actions/setup-node@v4
21
+ with:
22
+ node-version: '22'
23
+ ${pnpmSetup}
24
+ - name: Install dependencies
25
+ run: ${installCmd}
26
+
27
+ - name: Check migrations are up to date
28
+ run: |
29
+ ${drizzleCmd}
30
+ if [ -n "$(git status --porcelain ${dbPath}/migrations)" ]; then
31
+ echo "::error::Schema changes detected without migrations!"
32
+ echo "The database schema has changed but migrations are not up to date."
33
+ echo ""
34
+ echo "To fix this, run locally:"
35
+ echo " ${drizzleCmd}"
36
+ echo ""
37
+ echo "Then commit the generated migration files."
38
+ git status ${dbPath}/migrations
39
+ git diff ${dbPath}/migrations
40
+ exit 1
41
+ fi
42
+ echo "Migrations are up to date"
43
+
44
+ - name: Verify migrations exist
45
+ run: |
46
+ echo "Checking migrations in build context:"
47
+ ls -la ${dbPath}/migrations/
48
+ ` : '';
4
49
  return `name: Build and Deploy
5
50
 
6
51
  on:
@@ -26,7 +71,7 @@ jobs:
26
71
  steps:
27
72
  - name: Checkout
28
73
  uses: actions/checkout@v4
29
-
74
+ ${migrationCheck}
30
75
  - name: Get commit SHA
31
76
  id: sha
32
77
  run: echo "sha=\$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
@@ -36,7 +81,7 @@ jobs:
36
81
  export COMMIT_SHA=\${{ steps.sha.outputs.sha }}
37
82
  export COMPOSE_PROJECT_NAME=\${{ env.PROJECT_NAME }}
38
83
 
39
- docker compose -f docker-compose.build.yml build
84
+ docker compose -f docker-compose.build.yml build --no-cache
40
85
  docker compose -f docker-compose.build.yml push
41
86
 
42
87
  # Also tag and push as latest
@@ -49,14 +94,14 @@ jobs:
49
94
  SOURCE_BRANCH="\${{ github.ref_name }}"
50
95
 
51
96
  # Feature/fix/hotfix branches target develop
52
- if [[ "\\$SOURCE_BRANCH" == feature/* ]] || [[ "\\$SOURCE_BRANCH" == fix/* ]] || [[ "\\$SOURCE_BRANCH" == hotfix/* ]]; then
53
- echo "branch=develop" >> \\$GITHUB_OUTPUT
97
+ if [[ "$SOURCE_BRANCH" == feature/* ]] || [[ "$SOURCE_BRANCH" == fix/* ]] || [[ "$SOURCE_BRANCH" == hotfix/* ]]; then
98
+ echo "branch=develop" >> $GITHUB_OUTPUT
54
99
  # Develop targets staging
55
- elif [[ "\\$SOURCE_BRANCH" == "develop" ]]; then
56
- echo "branch=staging" >> \\$GITHUB_OUTPUT
100
+ elif [[ "$SOURCE_BRANCH" == "develop" ]]; then
101
+ echo "branch=staging" >> $GITHUB_OUTPUT
57
102
  # Staging/other branches don't create PRs (staging->main handled separately)
58
103
  else
59
- echo "branch=" >> \\$GITHUB_OUTPUT
104
+ echo "branch=" >> $GITHUB_OUTPUT
60
105
  fi
61
106
 
62
107
  - name: Create deploy PR
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@panoptic-it-solutions/coolify-setup",
3
- "version": "1.1.37",
3
+ "version": "1.1.38",
4
4
  "description": "CLI tool for setting up Coolify deployment on Panoptic projects",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",