cistack 3.1.0 → 3.2.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cistack",
3
- "version": "3.1.0",
3
+ "version": "3.2.0",
4
4
  "description": "Automatically generate GitHub Actions CI/CD pipelines by analysing your codebase",
5
5
  "main": "src/index.js",
6
6
  "bin": {
@@ -280,6 +280,7 @@ class WorkflowGenerator {
280
280
  const h = this.primaryHosting;
281
281
  const lang = this.primaryLang;
282
282
  const branches = this.extraConfig.branches || ['main', 'master'];
283
+ const isGHPages = h.name === 'GitHub Pages';
283
284
 
284
285
  const preDeploySteps = [
285
286
  this._stepCheckout(),
@@ -288,14 +289,21 @@ class WorkflowGenerator {
288
289
  ].filter(Boolean);
289
290
 
290
291
  const deploySteps = this._hostingDeploySteps(h, lang, false); // production
291
- const previewSteps = this._hostingDeploySteps(h, lang, true); // preview
292
+ // GitHub Pages has no PR preview concept — skip preview job for it
293
+ const previewSteps = isGHPages ? [] : this._hostingDeploySteps(h, lang, true);
294
+
295
+ // GitHub Pages requires special permissions on the deploy job
296
+ const ghPagesPermissions = isGHPages
297
+ ? { pages: 'write', 'id-token': 'write', contents: 'read' }
298
+ : undefined;
292
299
 
293
300
  const jobs = {
294
301
  deploy: {
295
302
  name: `🚀 Deploy → ${h.name} (Production)`,
296
303
  if: "github.event_name == 'push' || github.event_name == 'workflow_dispatch'",
297
304
  'runs-on': 'ubuntu-latest',
298
- environment: 'production',
305
+ environment: isGHPages ? 'github-pages' : 'production',
306
+ ...(ghPagesPermissions ? { permissions: ghPagesPermissions } : {}),
299
307
  steps: [...preDeploySteps, ...deploySteps].filter(Boolean),
300
308
  },
301
309
  };
@@ -323,13 +331,14 @@ class WorkflowGenerator {
323
331
 
324
332
  const envComment = this._envComment();
325
333
 
334
+ // GitHub Pages doesn't need pull_request trigger (no preview)
335
+ const onTrigger = isGHPages
336
+ ? { push: { branches: branches.filter((b) => b !== 'develop') }, workflow_dispatch: {} }
337
+ : { push: { branches: branches.filter((b) => b !== 'develop') }, pull_request: { branches }, workflow_dispatch: {} };
338
+
326
339
  const workflow = {
327
340
  name: `Deploy to ${h.name}`,
328
- on: {
329
- push: { branches: branches.filter((b) => b !== 'develop') },
330
- pull_request: { branches },
331
- workflow_dispatch: {},
332
- },
341
+ on: onTrigger,
333
342
  jobs,
334
343
  };
335
344
 
@@ -739,11 +748,28 @@ class WorkflowGenerator {
739
748
 
740
749
  case 'Vercel': {
741
750
  const prodFlag = isPreview ? '' : '--prod';
751
+ const vercelEnv = {
752
+ VERCEL_TOKEN: '${{ secrets.VERCEL_TOKEN }}',
753
+ VERCEL_ORG_ID: '${{ secrets.VERCEL_ORG_ID }}',
754
+ VERCEL_PROJECT_ID: '${{ secrets.VERCEL_PROJECT_ID }}',
755
+ };
742
756
  steps.push(
743
757
  { name: 'Install Vercel CLI', run: 'npm install -g vercel' },
744
- { name: 'Pull Vercel environment', run: `vercel pull --yes --environment=${isPreview ? 'preview' : 'production'} --token=\${{ secrets.VERCEL_TOKEN }}` },
745
- { name: 'Build project', run: `vercel build${prodFlag ? ' ' + prodFlag : ''} --token=\${{ secrets.VERCEL_TOKEN }}` },
746
- { name: 'Deploy to Vercel', run: `vercel deploy --prebuilt${prodFlag ? ' ' + prodFlag : ''} --token=\${{ secrets.VERCEL_TOKEN }}` },
758
+ {
759
+ name: 'Pull Vercel environment',
760
+ run: `vercel pull --yes --environment=${isPreview ? 'preview' : 'production'} --token=\${{ secrets.VERCEL_TOKEN }}`,
761
+ env: vercelEnv,
762
+ },
763
+ {
764
+ name: 'Build project',
765
+ run: `vercel build${prodFlag ? ' ' + prodFlag : ''} --token=\${{ secrets.VERCEL_TOKEN }}`,
766
+ env: vercelEnv,
767
+ },
768
+ {
769
+ name: 'Deploy to Vercel',
770
+ run: `vercel deploy --prebuilt${prodFlag ? ' ' + prodFlag : ''} --token=\${{ secrets.VERCEL_TOKEN }}`,
771
+ env: vercelEnv,
772
+ },
747
773
  );
748
774
  break;
749
775
  }
@@ -832,7 +858,10 @@ class WorkflowGenerator {
832
858
  }
833
859
 
834
860
  case 'Render': {
835
- steps.push({ name: 'Trigger Render deploy', run: 'curl -X POST ${{ secrets.RENDER_DEPLOY_HOOK_URL }}' });
861
+ // Render doesn't support PR preview deploys via deploy hook
862
+ if (!isPreview) {
863
+ steps.push({ name: 'Trigger Render deploy', run: 'curl -X POST "${{ secrets.RENDER_DEPLOY_HOOK_URL }}"' });
864
+ }
836
865
  break;
837
866
  }
838
867
 
package/src/index.js CHANGED
@@ -309,7 +309,19 @@ class CIFlow {
309
309
  name: HOSTING_NAME_MAP[h] || h, // always the correct PascalCase name
310
310
  confidence: 1.0,
311
311
  manual: true,
312
- secrets: [],
312
+ // Populate secrets so the generated deploy.yml header lists them correctly
313
+ secrets: {
314
+ firebase: ['FIREBASE_SERVICE_ACCOUNT'],
315
+ vercel: ['VERCEL_TOKEN', 'VERCEL_ORG_ID', 'VERCEL_PROJECT_ID'],
316
+ netlify: ['NETLIFY_AUTH_TOKEN', 'NETLIFY_SITE_ID'],
317
+ aws: ['AWS_ACCESS_KEY_ID', 'AWS_SECRET_ACCESS_KEY', 'AWS_REGION', 'AWS_S3_BUCKET', 'CLOUDFRONT_DISTRIBUTION_ID'],
318
+ gcp: ['GCP_SA_KEY'],
319
+ azure: ['AZURE_APP_NAME', 'AZURE_WEBAPP_PUBLISH_PROFILE'],
320
+ heroku: ['HEROKU_API_KEY', 'HEROKU_APP_NAME', 'HEROKU_EMAIL'],
321
+ render: ['RENDER_DEPLOY_HOOK_URL'],
322
+ railway: ['RAILWAY_TOKEN'],
323
+ 'github-pages': [],
324
+ }[h] || [],
313
325
  }));
314
326
  }
315
327