Skip to content

RoboticGen/Deployement-Workflow

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

Deployment Workflow

Automated CI/CD workflow for syncing, testing, and deploying applications from a stable branch to production.

Overview

This repository contains a GitHub Actions workflow that automates the process of:

  1. Detecting changes between stable and production branches
  2. Testing and building the stable branch
  3. Running release processes with semantic versioning
  4. Deploying to production environments

Workflow Schedule

The main workflow runs automatically on a weekly schedule:

  • Day: Wednesday
  • Time: 8:30 PM UTC / Thursday 2:00 AM SLT
  • Cron: 30 20 * * 3

Manual triggers are also supported via workflow_dispatch.

Workflow Steps

1. Check for Changes

Detects if there are new commits in the stable branch that need syncing to production.

2. Test and Build (Stable Branch)

  • Checks out the stable branch
  • Sets up Node.js environment (v20)
  • Installs dependencies with npm ci
  • Auto-detects and runs test suite (if available)
  • Builds the application with npm run build

3. Merge Stable → Production

  • Merges stable branch into production using a merge commit (--no-ff)
  • Pushes the merge to the remote repository
  • Saves the previous production commit for potential rollback

4. Test and Build (Production Branch)

  • Re-tests and rebuilds on the production branch
  • Runs the same test and build steps to ensure quality post-merge

5. Release (Semantic Versioning)

  • Runs semantic-release to:
    • Analyze commits and determine version bump
    • Generate changelog
    • Create GitHub release
    • Commit and tag version updates
    • Push updates back to production branch

6. Deploy to Production

  • Checks out the production branch
  • Placeholder implementation - customize with your deployment logic:
    • Can use AWS CLI, kubectl, Docker, rsync, SCP, etc.
    • Requires DEPLOY_TARGET and DEPLOY_TOKEN secrets
  • Runs smoke tests on the deployed environment

7. Rollback on Failure

  • Automatically triggered if any previous job fails
  • Reverts production branch to the pre-merge commit
  • Force pushes to remote to undo any changes

Configuration

Release Configuration

Configure release behavior in .releaserc.json:

  • Semantic versioning rules
  • Changelog generation
  • Git commit and tag settings

GitHub Actions

Main workflow file: .github/workflows/weekly-production-sync.yml

Requirements

  • Node.js 20+
  • npm
  • GitHub repository with stable and production branches
  • Appropriate GitHub Actions permissions for branch operations

Usage

Automatic Execution

The workflow runs automatically every Wednesday at 8:30 PM UTC (Thursday 2:00 AM SLT).

Manual Trigger

To manually trigger the workflow:

  1. Go to Actions tab in GitHub
  2. Select Weekly Sync, Test, Release & Deploy
  3. Click Run workflow

Environment Variables

Configure the following secrets in GitHub for deployment:

  • DEPLOY_TARGET: The target environment/endpoint for deployment
  • DEPLOY_TOKEN: Authentication token for deployment access
  • GITHUB_TOKEN: Automatically provided by GitHub Actions for semantic-release

Deployment Customization

The deployment step (job #6) is a template that requires customization for your specific platform:

Replace the deployment logic with your platform:

  • AWS: AWS CLI commands (CloudFormation, Lambda, ECS, etc.)
  • Kubernetes: kubectl apply commands
  • Docker: docker compose up or Docker image push/pull
  • Servers: SSH commands, rsync, SCP, etc.

Smoke Test Configuration: Update the health check URL in the smoke test step to match your production endpoint.

Troubleshooting

  • Workflow fails at check-changes: No new commits in stable branch - nothing to deploy
  • Tests failing: Ensure all tests pass locally before pushing to stable
  • Merge conflicts: Resolve conflicts between stable and production manually if needed
  • Deployment fails: Verify DEPLOY_TARGET and DEPLOY_TOKEN secrets are set correctly
  • Rollback triggered: Check the workflow logs to identify which job failed and resolve the issue

Contributing

When contributing:

  1. Work on feature branches
  2. Merge to stable when ready for testing
  3. The workflow handles promotion to production automatically

About

Automation script to deploy and generate semantics for deployment

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published