Skip to content

Auto-bump version on staging and prod deploys#150

Open
aditeyabaral wants to merge 9 commits into
pesu-dev:devfrom
aditeyabaral:feat/auto-version-bump
Open

Auto-bump version on staging and prod deploys#150
aditeyabaral wants to merge 9 commits into
pesu-dev:devfrom
aditeyabaral:feat/auto-version-bump

Conversation

@aditeyabaral
Copy link
Copy Markdown
Member

@aditeyabaral aditeyabaral commented May 22, 2026

This pull request introduces automated version bumping to the deployment workflows and improves the safety and consistency of deployments to both staging and production environments. The main changes include adding a script for version bumping, updating the GitHub Actions workflows to use this script, and enhancing deployment checks to prevent accidental or redundant deployments.

Automated version management and deployment workflow improvements:

Version bumping automation:

  • Added a new script scripts/bump_version.py that automatically bumps the patch or minor version in pyproject.toml based on the argument provided. This script is now used in both staging and production deployment workflows.

Production deployment workflow (.github/workflows/deploy-prod.yaml):

  • Introduced new jobs to bump the minor version on the main branch after syncing from dev, and to sync this version bump back to dev to keep branches aligned. These jobs ensure version consistency and are required by subsequent deployment steps.
  • Updated dependencies between jobs so that Docker image builds and deployments only occur after the version bump is completed, ensuring that production deployments always use the correct version. [1] [2] [3]
  • Explicitly set contents: write permissions for jobs that modify repository contents.

Staging deployment workflow (.github/workflows/deploy-staging.yaml):

  • Added concurrency control to prevent overlapping staging deployments for the same branch.
  • Updated the deployment trigger to skip runs for commits with messages starting with chore: bump, preventing unnecessary redeployments for automated version bumps.
  • Inserted a patch version bump (using the new script) immediately before deploying to staging, and committed the change back to the dev branch. This ensures each staging deployment corresponds to a unique version.
  • Added steps to verify that the deployment is using the validated commit and that dev has not advanced, improving deployment safety.

- Patch version bumped in deploy-staging.yaml before calling the Render
  hook, ensuring staging always runs the version shown on the dev branch
- Minor version bumped in deploy-prod.yaml after syncing dev to main,
  with patch reset to 0 and the bump synced back to dev afterward to
  prevent branch divergence on subsequent deploys
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds automated semantic version bumping to the deployment workflows: patch bumps on dev during staging deploys, and minor bumps on main during production deploys, with additional branch sync steps to keep dev and main aligned.

Changes:

  • Add a staging workflow concurrency group and a patch-version bump + commit/push step on dev before staging deployment.
  • Add a production workflow job to bump the minor version on main (commit/push) after syncing dev → main.
  • Add a production workflow job to fast-forward dev to the updated main, and update downstream job dependencies to follow the new bump/sync sequence.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
.github/workflows/deploy-staging.yaml Adds concurrency control and auto patch bump + push to dev before triggering the staging deploy hook.
.github/workflows/deploy-prod.yaml Adds auto minor bump on main, syncs the bump back to dev, and rewires job needs to reflect the new sequencing.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/deploy-staging.yaml Outdated
Comment thread .github/workflows/deploy-staging.yaml Outdated
Comment thread .github/workflows/deploy-prod.yaml Outdated
- staging: guard against feedback loop by skipping bot bump commits,
  checkout exact validated SHA instead of rebasing on latest dev, verify
  dev HEAD matches before bumping, push via HEAD:dev from detached HEAD
- prod: add error handler with recovery message to sync-minor-to-dev
  fast-forward step, add missing permissions/contents:write to
  sync-dev-to-main, remove no-op git merge --abort after --ff-only failure
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.

Comment thread .github/workflows/deploy-staging.yaml
Comment thread .github/workflows/deploy-staging.yaml Outdated
Comment thread .github/workflows/deploy-staging.yaml
Comment thread .github/workflows/deploy-prod.yaml Outdated
Comment thread .github/workflows/deploy-prod.yaml
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.

Comment thread .github/workflows/deploy-staging.yaml Outdated
Comment thread .github/workflows/deploy-staging.yaml
Comment thread .github/workflows/deploy-staging.yaml Outdated
Comment thread .github/workflows/deploy-prod.yaml
Comment thread .github/workflows/deploy-staging.yaml
Comment thread .github/workflows/deploy-prod.yaml
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.

Comment thread .github/workflows/deploy-staging.yaml
Comment thread scripts/bump_version.py
Comment thread .github/workflows/deploy-staging.yaml Outdated
Comment thread .github/workflows/deploy-prod.yaml
Comment thread .github/workflows/deploy-prod.yaml Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

Comment thread .github/workflows/deploy-staging.yaml
Comment thread .github/workflows/deploy-staging.yaml
Comment thread .github/workflows/deploy-prod.yaml
Comment thread .github/workflows/deploy-prod.yaml Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants