Skip to main content

GitHub Workflows Overview

This repository uses GitHub Actions for continuous integration and deployment. The workflows orchestrate building, testing, and deploying the Backstage application to Google Cloud Run.

Workflow Summary

WorkflowTriggerPurpose
ci.ymlPush to mainFull CI/CD pipeline
ci-pr.ymlPull requestPR validation
ci-deploy.ymlCalled by ci.ymlReusable deployment

Pipeline Overview

Push to Main Pipeline

When code is pushed to main, the full CI/CD pipeline executes:

1. Version Job

  • Calculates semantic version using conventional commits
  • Outputs: version (e.g., 1.2.3-sha.abc123)

2. Terraform Apply

  • Applies infrastructure changes to non-production
  • Uses Terraform Cloud workspace wrkspc-np-devex-backstage
  • Outputs: Terraform outputs artifact

3. Build Package

  • Installs dependencies with yarn install --immutable
  • Runs TypeScript compilation with yarn tsc
  • Builds backend with yarn build:backend
  • Uploads artifacts for deployment

4. Deploy

  • Downloads Terraform outputs and build artifacts
  • Builds Docker image and pushes to Artifact Registry
  • Deploys to Cloud Run with secrets from GCP Secret Manager

Pull Request Pipeline

When a PR is opened or updated:

1. Terraform Plan

  • Generates execution plan for review
  • Comments plan on PR for visibility

2. Build Validation

  • Runs full build to catch compilation errors
  • Does not deploy

Authentication

Workload Identity Federation

The workflows use OIDC authentication with GCP - no stored credentials:

- uses: google-github-actions/auth@v2
with:
workload_identity_provider: ${{ secrets.WIF_PROVIDER }}
service_account: ${{ secrets.WIF_SERVICE_ACCOUNT }}

Required Secrets

SecretPurpose
GCP_PROJECT_IDGCP project identifier
WIF_PROVIDERWorkload Identity Federation provider
WIF_SERVICE_ACCOUNTGCP service account for OIDC
AUTH_GITHUB_*GitHub OAuth credentials
AUTH_GOOGLE_*Google OAuth credentials
BASE_URL_FRONTENDBackstage frontend URL
BASE_URL_BACKENDBackstage backend URL

Deployment Configuration

Cloud Run Settings

SettingValue
Regionnorthamerica-northeast1
Port7007
Memory4Gi
CPU4000m (4 cores)
Timeout300s
Concurrency80
Min Instances1
Max Instances1

Mounted Secrets

Mount PathSource
/etc/ssl/certs/vault-ca.crtGCP Secret Manager
/etc/backstage/jwt-private/keyGCP Secret Manager
/etc/backstage/jwt-public/keyGCP Secret Manager

Concurrency Control

The ci.yml workflow uses concurrency groups to prevent parallel runs:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

This ensures only one deployment runs at a time per branch.

Caching

Yarn Cache

- uses: actions/setup-node@v4
with:
node-version: 22
cache: yarn
cache-dependency-path: backstage/yarn.lock

Docker Layer Cache

- uses: docker/build-push-action@v6
with:
cache-from: type=gha
cache-to: type=gha,mode=max

Node.js Configuration

All build jobs use:

  • Node.js 22
  • NODE_OPTIONS: --max-old-space-size=8192 for large builds
  • Yarn with immutable lockfile