Skip to content

Commit 48d430a

Browse files
authored
chore(ci): flatten gitflow to develop → master (#20)
Drop the develop → main/<version> → stable stabilization layer (solo maintainer; the ceremony isn't earning its keep). New release train is develop → master, with master as the single release branch. Changes: - branch-policy.yml: allow only develop/hotfix → master (was stable ← main/hotfix). Triggers on PRs to master. - bump-version-on-pr-to-{stable→master}.yml: trigger on PR to master, gate on head_ref == 'develop'. Compares develop vs master; auto-bumps patch only if develop isn't already ahead (manual minor/major bumps set on develop pass through). - release-on-merge-to-{stable→master}.yml: trigger on merge to master, checkout master, tag vX.Y.Z + GitHub Release targeting master. - pr-lint-and-test.yml: trigger on [develop, master] (was [develop, stable, main, main/**]). - docs/branching-strategy.md: rewrite for the two-branch model. - pyproject.toml: 0.1.3 → 0.2.0 (next release is a minor bump). Follow-up (not in this PR): rename the stable branch → master via `gh api .../branches/stable/rename`. The existing ruleset is keyed on ~DEFAULT_BRANCH so it auto-covers master without reconfiguration. Orphaned asset: docs/assets/gitflow-vertical-branching.svg still depicts the old 5-branch model and is no longer referenced — safe to delete later.
1 parent 1c22655 commit 48d430a

6 files changed

Lines changed: 60 additions & 74 deletions

File tree

.github/workflows/branch-policy.yml

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@ name: Enforce branch flow
22
on:
33
pull_request:
44
branches:
5-
- stable
6-
- main
7-
- 'main/**'
5+
- master
86

97
jobs:
108
check-branch-policy:
@@ -17,19 +15,9 @@ jobs:
1715
1816
echo "PR: $SOURCE → $TARGET"
1917
20-
# stable ← main, main/*, hotfix/*
21-
# main ← develop, hotfix/*
22-
# main/* ← develop, hotfix/*
23-
if [[ "$TARGET" == "stable" ]]; then
24-
PATTERN="^(main(/.*)?|hotfix/.+)$"
25-
ALLOWED="main, main/*, hotfix/*"
26-
elif [[ "$TARGET" == "main" || "$TARGET" == main/* ]]; then
27-
PATTERN="^(develop|hotfix/.+)$"
28-
ALLOWED="develop, hotfix/*"
29-
else
30-
echo "✅ No branch policy for target '$TARGET'"
31-
exit 0
32-
fi
18+
# master ← develop, hotfix/*
19+
PATTERN="^(develop|hotfix/.+)$"
20+
ALLOWED="develop, hotfix/*"
3321
3422
if [[ "$SOURCE" =~ $PATTERN ]]; then
3523
echo "✅ '$SOURCE' → '$TARGET' is allowed"

.github/workflows/bump-version-on-pr-to-stable.yml renamed to .github/workflows/bump-version-on-pr-to-master.yml

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
1-
name: Bump version on PR to stable
1+
name: Bump version on PR to master
22

33
on:
44
pull_request:
55
types: [opened, synchronize]
6-
branches: [stable]
6+
branches: [master]
77

88
jobs:
99
bump-version:
10-
# Only run for main/* branches
11-
if: startsWith(github.head_ref, 'main/')
10+
# Only run for the develop → master release train.
11+
# Hotfix branches bump their version manually before opening the PR.
12+
if: github.head_ref == 'develop'
1213
runs-on: ubuntu-latest
1314
permissions:
1415
contents: write
@@ -23,20 +24,21 @@ jobs:
2324
- name: Read versions and compare
2425
id: compare
2526
run: |
26-
# Read version from source branch (main/*)
27+
# Read version from source branch (develop)
2728
SOURCE_VERSION=$(grep -m1 '^version' pyproject.toml | sed 's/.*"\(.*\)"/\1/')
2829
echo "source=$SOURCE_VERSION" >> "$GITHUB_OUTPUT"
2930
30-
# Read version from stable
31-
git fetch origin stable
32-
STABLE_VERSION=$(git show origin/stable:pyproject.toml | grep -m1 '^version' | sed 's/.*"\(.*\)"/\1/')
33-
echo "stable=$STABLE_VERSION" >> "$GITHUB_OUTPUT"
31+
# Read version from master
32+
git fetch origin master
33+
MASTER_VERSION=$(git show origin/master:pyproject.toml | grep -m1 '^version' | sed 's/.*"\(.*\)"/\1/')
34+
echo "master=$MASTER_VERSION" >> "$GITHUB_OUTPUT"
3435
35-
echo "Source: $SOURCE_VERSION | Stable: $STABLE_VERSION"
36+
echo "Source: $SOURCE_VERSION | Master: $MASTER_VERSION"
3637
37-
# Compare using sort -V (version sort)
38-
HIGHER=$(printf '%s\n%s' "$SOURCE_VERSION" "$STABLE_VERSION" | sort -V | tail -1)
39-
if [ "$SOURCE_VERSION" != "$STABLE_VERSION" ] && [ "$SOURCE_VERSION" = "$HIGHER" ]; then
38+
# Compare using sort -V (version sort). If develop is already ahead
39+
# (e.g. a manual minor/major bump), no patch bump is needed.
40+
HIGHER=$(printf '%s\n%s' "$SOURCE_VERSION" "$MASTER_VERSION" | sort -V | tail -1)
41+
if [ "$SOURCE_VERSION" != "$MASTER_VERSION" ] && [ "$SOURCE_VERSION" = "$HIGHER" ]; then
4042
echo "needs_bump=false" >> "$GITHUB_OUTPUT"
4143
echo "Source is already ahead, no bump needed"
4244
else
@@ -48,7 +50,7 @@ jobs:
4850
if: steps.compare.outputs.needs_bump == 'true'
4951
id: next
5052
run: |
51-
IFS='.' read -r MAJOR MINOR PATCH <<< "${{ steps.compare.outputs.stable }}"
53+
IFS='.' read -r MAJOR MINOR PATCH <<< "${{ steps.compare.outputs.master }}"
5254
PATCH=$((PATCH + 1))
5355
echo "version=$MAJOR.$MINOR.$PATCH" >> "$GITHUB_OUTPUT"
5456
echo "Next version: $MAJOR.$MINOR.$PATCH"

.github/workflows/pr-lint-and-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ name: PR Lint & Test
55

66
on:
77
pull_request:
8-
branches: [develop, stable, main, 'main/**']
8+
branches: [develop, master]
99
workflow_dispatch:
1010

1111
jobs:

.github/workflows/release-on-merge-to-stable.yml renamed to .github/workflows/release-on-merge-to-master.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
name: Release on merge to stable
1+
name: Release on merge to master
22

33
on:
44
pull_request:
55
types: [closed]
6-
branches: [stable]
6+
branches: [master]
77

88
jobs:
99
release:
@@ -13,10 +13,10 @@ jobs:
1313
contents: write
1414

1515
steps:
16-
- name: Checkout stable
16+
- name: Checkout master
1717
uses: actions/checkout@v4
1818
with:
19-
ref: stable
19+
ref: master
2020
fetch-depth: 0
2121

2222
- name: Read version from pyproject.toml
@@ -37,4 +37,4 @@ jobs:
3737
fi
3838
git tag "$TAG"
3939
git push origin "$TAG"
40-
gh release create "$TAG" --title "$TAG" --generate-notes --target stable
40+
gh release create "$TAG" --title "$TAG" --generate-notes --target master

docs/branching-strategy.md

Lines changed: 33 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,64 @@
11
# Branching Strategy
22

3-
Dana Runtime uses a **Gitflow-based vertical branching** model with long-lived branches and short-lived branch types.
3+
Dana Runtime uses a **simplified two-branch model**: one integration branch and one release branch.
44

5-
![Branching Diagram](assets/gitflow-vertical-branching.svg)
5+
```
6+
feature/* ──PR──> develop ──PR──> master
7+
|
8+
hotfix/* ────┘ (branched from master; merged back to master + develop)
9+
```
610

711
## Long-lived Branches
812

9-
| Branch | Purpose | Accepts PRs from |
10-
|-----------|--------------------------------------------------------------------------|----------------------|
11-
| `stable` | Production-ready code. Every commit is tagged with a release version. | `main/*`, `hotfix/*` |
12-
| `develop` | Integration branch. All feature work merges here first. | `feature/*` |
13-
14-
## Release Branches (`main/*`)
15-
16-
Each release gets its own branch under the `main/` prefix.
17-
18-
- Naming: `main/<version>` (e.g. `main/1.0`, `main/2.0`)
19-
- Created from `develop` when a release is ready for stabilization
20-
- **Only bugfixes** are allowed on release branches
21-
- Bugfixes on `main/*` merge back into `develop` to stay in sync
22-
- Once stable, merges into `stable` and a version tag is created
23-
- Accepts PRs from: `develop`, `hotfix/*`
13+
| Branch | Purpose | Accepts PRs from |
14+
|-----------|----------------------------------------------------------------------|----------------------|
15+
| `develop` | Integration branch. All feature work merges here first. **Default branch.** | `feature/*` |
16+
| `master` | Release branch. Every merge produces a version tag + GitHub Release. | `develop`, `hotfix/*` |
2417

2518
## Short-lived Branches
2619

2720
### Feature branches (`feature/*`)
2821

2922
- Branch from `develop`
3023
- Merge back into `develop` via PR
31-
- Naming: `feature/<descriptive-slug>` (e.g. `feature/login`, `feature/timeline-compression`)
24+
- Naming: `feature/<descriptive-slug>` (e.g. `feature/timeline-compression`)
3225
- Delete after merge
3326

3427
### Hotfix branches (`hotfix/*`)
3528

36-
- Branch from `stable` for critical production bugs
37-
- Merge into **both** `stable` and `develop` (to keep develop in sync)
38-
- Naming: `hotfix/<version-or-slug>` (e.g. `hotfix/0.1.1`, `hotfix/fix-crash`)
39-
- A new tag is created on `stable` after merge
29+
- Branch from `master` for critical production bugs
30+
- Merge into **both** `master` and `develop` (keep develop in sync)
31+
- Bump the version on the hotfix branch manually before merging into `master`
32+
- Naming: `hotfix/<version-or-slug>` (e.g. `hotfix/fix-crash`)
4033
- Delete after merge
4134

4235
## Release Flow
4336

4437
1. `develop` accumulates features via merged feature branches
45-
2. When ready for release, create `main/<version>` from `develop`
46-
3. Only bugfixes are committed on `main/<version>` during stabilization
47-
4. Bugfixes on `main/<version>` merge back into `develop` to stay in sync
48-
5. Once stable, `main/<version>` merges into `stable` and a version tag is created
49-
6. `main/<version>` also merges back into `develop` to include final bugfixes
38+
2. When ready for release, set the target version in `pyproject.toml` on `develop`
39+
3. Open a PR `develop → master`. CI auto-bumps the patch version if `develop` is not already ahead
40+
4. Merge the PR → [`release-on-merge-to-master`](../.github/workflows/release-on-merge-to-master.yml) tags `v<version>` and creates a GitHub Release
5041

51-
## Branch Protection
42+
## Versioning
5243

53-
Enforced by [`.github/workflows/branch-policy.yml`](../.github/workflows/branch-policy.yml):
44+
- Source of truth: `version` in [`pyproject.toml`](../pyproject.toml)
45+
- To ship a **minor/major** bump (e.g. `0.2.0`, `1.0.0`), set it on `develop` before opening the release PR — the auto-bumper detects `develop` is already ahead and skips
46+
- Otherwise the auto-bumper raises the patch component (`0.1.3``0.1.4`)
47+
- Tags follow `v<version>` (e.g. `v0.2.0`)
48+
49+
## Branch Protection
5450

55-
- **`stable`** only accepts PRs from `main/*` or `hotfix/*`
56-
- **`main/*`** only accepts PRs from `develop` or `hotfix/*`
51+
Enforced by [`.github/workflows/branch-policy.yml`](../.github/workflows/branch-policy.yml) plus repository rulesets:
5752

58-
Any PR violating these rules is automatically rejected by CI.
53+
- **`master`** only accepts PRs from `develop` or `hotfix/*`
54+
- Direct pushes to `master` are blocked (no non-fast-forward, no deletion); merges require review + signatures
55+
- Any PR violating the source-branch rule is rejected by the `check-branch-policy` job
5956

6057
## Quick Reference
6158

6259
```text
63-
feature/* ──PR──> develop ──PR──> main/<version> ──PR──> stable
64-
^ |
65-
| hotfix/* ────────PR──> stable
66-
+----------- hotfix/* (also merged back)
67-
+----------- main/<version> bugfixes (merged back)
60+
feature/* ──PR──> develop ──PR──> master ──> tag vX.Y.Z + GitHub Release
61+
^ |
62+
| hotfix/* ──┘ (also merged back to develop)
63+
+-------------------+
6864
```

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ build-backend = "setuptools.build_meta"
1515

1616
[project]
1717
name = "dana"
18-
version = "0.1.3"
18+
version = "0.2.0"
1919
description = "Dana Agent - Domain-Aware Neurosymbolic Agents"
2020
readme = "README.md"
2121
requires-python = ">=3.12"

0 commit comments

Comments
 (0)