Repository navigation
feat: implement automatic version bumping in CI workflow - #10
Merged
Merged
Conversation
- Add bump-version job that auto-increments patch version before Docker builds - Update backend/config/constants.php and backend/versions.json automatically - Prevent infinite loops with [skip version bump] commit message marker - Add scripts/bump-devforge-version.sh for manual version bumping - Add docs/VERSIONING.md documenting the versioning system - Change permissions to contents: write for version commits - Ensure build job pulls latest main after version bump This ensures every successful Docker Images build on main creates a new semver tag (4.1.4, 4.1.5, ...) and updates versions.json on GitHub, allowing the /settings/updates/ page to detect new releases. Co-authored-by: Mathieu JESER <bobdivx@users.noreply.github.com>
Critical fixes to ensure Docker Hub and GitHub versions always match: 1. Reorder jobs: prepare → build → commit-version - prepare: Compute next version only (no commit yet) - build: Apply version patch in workspace, build/push images to Hub - commit-version: Only runs after successful builds, updates GitHub main 2. Fix detached HEAD issue - prepare: No git operations needed - build: Checkout triggering SHA (not hardcoded 'main') - commit-version: Checkout github.ref_name with GITHUB_TOKEN 3. Remove skip logic that blocked builds - No 'if: !contains' check on prepare job - Build always runs when prepare succeeds - GITHUB_TOKEN pushes don't retrigger workflows anyway 4. Improve version extraction - Use awk to target coolify.version specifically (not any 'version' key) - Prevents accidental replacement of unrelated version fields 5. Idempotent commit-version job - Checks if files already have target version - No-op if version already committed (safe for reruns) - Only pushes if there are actual changes This prevents the broken flow where GitHub has 4.1.4 but Hub still has 4.1.3. Now: Hub gets 4.1.4 first, then GitHub is updated only after confirmation. Updated docs/VERSIONING.md and scripts/bump-devforge-version.sh to reflect the correct prepare→build→commit flow with detailed troubleshooting. Co-authored-by: Mathieu JESER <bobdivx@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
DevForge was stuck on version
4.1.3because every Docker Images build onmainoverwrote the samebobdivx/devforge:4.1.3tag. The updates page at/settings/updates/compares semver frombackend/versions.json(fetched from GitHub) vs the runningbackend/config/constants.php, so4.1.3vs4.1.3= no update detected.Solution
This PR implements automatic version bumping in the CI pipeline with the correct job ordering to ensure Docker Hub and GitHub versions always match.
Critical Design: Why This Order?
❌ Broken flow (commit first):
If build fails, GitHub has
4.1.4but Hub still has4.1.3→ updates page lies about available version.✅ Correct flow (commit after success):
Docker Hub gets
4.1.4first, then GitHub is updated only after images are confirmed published.Jobs Flow
preparejob: Calculate next versionbackend/config/constants.php(coolify.version)4.1.3→4.1.4currentandversionfor downstream jobsbuildjob: Apply patch and build images (matrix)main— avoids race)backend/config/constants.php(coolify.version)backend/versions.json(devforge.version+coolify.v4.version)api,web,realtime,helper,proxybobdivx/devforge:latest(api)bobdivx/devforge:X.Y.Z(api)bobdivx/devforge:{component}-X.Y.Z:sha-XXXXXXXtags for rollbackcommit-versionjob: Update GitHub main (only after full build success)if: success()— skipped if any build job failedneeds: [prepare, build]— waits for full matrixgithub.ref_namewithGITHUB_TOKENchore: bump version to X.Y.Z [skip version bump]git push origin HEAD:${{ github.ref_name }}Bug Fixes in This PR
Fixed detached HEAD git push failure
actions/checkout@v5on push event checked outGITHUB_SHAdetachedcommit-versionusesref: ${{ github.ref_name }}+token: ${{ secrets.GITHUB_TOKEN }}Fixed version mismatch when build fails
Fixed build skip when bump is skipped
needs: bump-version+if: !containsskip blocked dependent jobsprepare, build always runsGITHUB_TOKENpushes don't retrigger workflows anywayFixed checkout racing to wrong commit
ref: mainhardcoded — could race with concurrent pushesgithub.ref_namein commit-versionImproved version extraction precision
sedon first'version' =>could match wrong fieldawkscoped tocoolifyarray block, targetscoolify.versiononlyHow It Works After Merge
Loop Prevention
Q: Why doesn't the version commit re-trigger infinitely?
A:
GITHUB_TOKENpushes do not trigger workflows (GitHub native behavior). Even if a PAT is used later, the[skip version bump]marker can be checked. Thecommit-versionjob also checks if files already have the target version (idempotent).Manual Bumping
Script
scripts/bump-devforge-version.shis provided for local development:Note: Manual bumps will trigger the CI workflow, which computes the next version. If you manually set
4.2.0, the workflow will build4.2.0then prepare4.2.1for the next build.Testing Plan
After this PR merges to
main:4.1.3→4.1.4and push to Hubversions.jsonto4.1.4/settings/updates/4.1.4→4.1.5→4.1.6(continuous auto-increment)Files Changed
.github/workflows/devforge-images.yml— Correctprepare→build→commit-versionflowscripts/bump-devforge-version.sh— Manual bump helper with improved extractiondocs/VERSIONING.md— Complete documentation with flow diagram and troubleshootingRelated
Important: This PR must be merged for the auto-versioning to begin. The first successful build after merge will create version
4.1.4.