This document describes the CI/CD pipeline for the Bridge-Watch project, implemented using GitHub Actions.
- Triggers: Main and Develop branches, and PRs targeting them.
- Node.js:
- Installs dependencies (
npm ci). - Lints (
npm run lint). - Builds (backend & frontend).
- Tests (backend & frontend).
- Installs dependencies (
- Rust (Contracts):
- Formats check (
cargo fmt). - Lints (
cargo clippy). - Builds and tests contracts.
- Formats check (
- Static Analysis: Uses CodeQL to scan JavaScript and TypeScript for vulnerabilities.
- Dependency Audit: Runs
npm auditandcargo auditto find insecure dependencies. - Schedule: Runs on pushes, PRs, and weekly on Sundays.
- Triggers: Pushes to
mainanddevelop. - Registry: GitHub Container Registry (GHCR).
- Images: Builds separate images for
backendandfrontend. - Tags: Environment (
main/develop) and SHA for traceability.
- Automatic Deployment: Runs after a successful Docker build.
- Staging: Automatically deploys the
developbranch to the staging environment. - Production: Deploys the
mainbranch to the production environment. - Approval Gates: Production deployments MUST be manually approved via the GitHub UI (Settings > Environments).
To enable the full pipeline, the following configuration is needed in the GitHub repository:
- staging:
DEPLOY_HOST: Staging server address.DEPLOY_USER: SSH user for staging.DEPLOY_KEY: Private SSH key for staging.
- production:
DEPLOY_HOST: Production server address.DEPLOY_USER: SSH user for production.DEPLOY_KEY: Private SSH key for production.
- Go to Settings > Environments.
- Create
stagingandproductionenvironments. - For
production, enable Required reviewers to enforce approval gates.
Audit CI and deploy secrets quarterly using the Secrets Audit Checklist. Workflow secret reference: .github/workflows/README.md.
In the event of a failure, you can roll back by:
- Reverting the commit in Git.
- Manually triggering the "Docker Build & Push" workflow for a previous SHA.
- The deployment workflow will automatically pick up the new (reverted) image.