Skip to content

Branching and Deployment

Branch Strategy

Cycle Journal uses a GitLab Flow style environment branch model.

FlowTarget
feature/* -> PR -> developIntegration and dev deploy
develop -> PR -> mainProduction release
fix/* -> PR -> main -> merge back to developProduction hotfix

develop is the default branch. main is production and must receive changes only through pull requests.

Environments

EnvironmentBranchCloud RunFirestore
devdevelopcycle-api-devdev-db
prodmaincycle-api-prod(default)

The GCP project remains cycle-journal. Project-level IAM, billing, quotas, and Artifact Registry are shared.

CI/CD

.github/workflows/api-ci-cd.yml runs API lint and tests on pull requests to develop or main.

On push:

  • develop builds and deploys the API image to cycle-api-dev.
  • main builds and deploys the API image to cycle-api-prod.

The workflow expects these GitHub secrets:

SecretPurpose
GCP_WORKLOAD_IDENTITY_PROVIDERWorkload Identity Federation provider
GCP_SERVICE_ACCOUNTDeploy service account email

Use GitHub Environments:

  • api-dev: no approval gate
  • api-prod: require reviewer approval before production deploy

Terraform

Use directory-per-environment Terraform:

bash
terraform -chdir=infra/environments/shared plan
terraform -chdir=infra/environments/dev plan
terraform -chdir=infra/environments/prod plan

Do not switch environments with Terraform workspaces.