Documentation
¶
Overview ¶
Package cicd renders the GitHub Actions deploy workflow. It is the single source of truth for both `nextdeploy generate-ci` and the scaffolder, so the two can never drift — previously each shipped its own file (different runtime, different install step, different secrets), and a user who ran both `init` and `generate-ci` got two workflows and two deploys per push.
Index ¶
Constants ¶
const ( PreviewWorkflowPath = ".github/workflows/preview.yml" PreviewCleanupWorkflowPath = ".github/workflows/preview-cleanup.yml" )
PreviewWorkflowPath and PreviewCleanupWorkflowPath are repo-relative.
const CLIVersion = "v1.1.0" // {x-release-please-version}
CLIVersion pins the nextdeploy CLI installed in CI. Bump on release; keep in sync with .release-please-manifest.json.
The generated workflows download this release's prebuilt binary and verify its checksum. release-please updates this pin from the package manifest.
const GitLabWorkflowPath = ".gitlab-ci.yml"
GitLabWorkflowPath is the default location for GitLab CI/CD configuration.
const WorkflowPath = ".github/workflows/nextdeploy.yml"
WorkflowPath is where the rendered workflow is written, relative to the repository root. Both callers use it so a scaffolded app and `generate-ci` produce exactly one file.
Variables ¶
This section is empty.
Functions ¶
func RenderDeployWorkflow ¶
RenderDeployWorkflow returns the YAML for WorkflowPath.
The workflow knows the deployment type from nextdeploy CLI and nextdeploy.yml at runtime, while also supporting an explicit target type passed at generation time.
Note: Application secrets (including Hyperdrive origin_env URLs) are intentionally not wired here — `nextdeploy apply` resolves origin_env from the shell env or NextDeploy's configured secret store.
func RenderGitLabCIWorkflow ¶ added in v1.0.0
RenderGitLabCIWorkflow returns the YAML for GitLabWorkflowPath.
The workflow knows the deployment type from nextdeploy CLI and nextdeploy.yml at runtime, while also supporting an explicit target type passed at generation time.
Secret Handling (Doppler-first):
- If DOPPLER_TOKEN is configured in GitLab CI/CD Variables, NextDeploy will automatically install the Doppler CLI and run with `doppler run --`, streaming secrets directly in memory.
- If DOPPLER_TOKEN is not provided, NextDeploy falls back to standard GitLab CI/CD variables (e.g. CLOUDFLARE_API_TOKEN, AWS_ACCESS_KEY_ID, SSH_PRIVATE_KEY).
func RenderPreviewCleanupWorkflow ¶
func RenderPreviewCleanupWorkflow() string
RenderPreviewCleanupWorkflow returns the YAML that destroys a PR's preview stack when the PR closes.
Always pair create with destroy: without this, every PR leaks a Worker and an R2 bucket until the account hits its limits. The `closed` trigger fires for both merge and plain close, so no stack is missed.
func RenderPreviewWorkflow ¶
func RenderPreviewWorkflow() string
RenderPreviewWorkflow returns the YAML that deploys a per-PR preview stack and comments its URL on the pull request.
Requires one extra repository secret beyond the normal Cloudflare pair: CLOUDFLARE_WORKERS_SUBDOMAIN — the account's workers.dev subdomain (the <x> in https://<worker>.<x>.workers.dev). It is a stable per-account value, set once.
Types ¶
This section is empty.