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 ( TargetCloudflare = "cloudflare" TargetAWS = "aws" TargetVPS = "vps" )
Deploy targets a workflow can be pinned to. Anything else (including "" and "auto") renders the multi-target workflow that detects the target at runtime.
const CLIVersion = "v1.3.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.
With a concrete target ("cloudflare", "aws" or "vps") the workflow carries only that target's deploy step and secrets. With no target or "auto" it carries all three and picks one at runtime from `nextdeploy target` / nextdeploy.yml, so retargeting the app needs no regeneration.
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.
With a concrete target ("cloudflare", "aws" or "vps") the job runs only that target's deploy. With no target or "auto" it resolves the target at runtime from `nextdeploy target` / nextdeploy.yml.
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.
func SingleTarget ¶ added in v1.3.0
SingleTarget reports whether target names one concrete deploy target, in which case the renderers emit only that target's steps and secrets.
Types ¶
This section is empty.