Skip to content

Commit e28c83e

Browse files
github-actions[bot]ChristophShyperCopilot
authored
Update workflows and documentation for improved release process (#142)
* Update workflows and documentation for improved release process * Add testing guidelines for branches in README.md * Add automated version detection and release workflows with comprehensive documentation * Update .github/WORKFLOWS.md Co-authored-by: Copilot <[email protected]> * Update version detection logic and documentation for accurate version bumping * Limit `git log` to 50 entries Co-authored-by: Copilot <[email protected]> * Fix naming in README.md Co-authored-by: Copilot <[email protected]> * Improve release branch delete Co-authored-by: Copilot <[email protected]> * Fix release trigger to skip dependency and documentation commits * Update README.md Co-authored-by: Copilot <[email protected]> * Update README.md Co-authored-by: Copilot <[email protected]> * Update .github/workflows/AUTO-VERSION.yml Co-authored-by: Copilot <[email protected]> * Update .github/workflows/AUTO-VERSION.yml Co-authored-by: Copilot <[email protected]> * Update .github/WORKFLOWS.md Co-authored-by: Copilot <[email protected]> * Update .github/WORKFLOWS.md Co-authored-by: Copilot <[email protected]> * Update .github/WORKFLOWS.md Co-authored-by: Copilot <[email protected]> * Update .github/workflows/AUTO-VERSION.yml Co-authored-by: Copilot <[email protected]> * Update .github/workflows/AUTO-VERSION.yml Co-authored-by: Copilot <[email protected]> * Update .github/workflows/RELEASE.yml Co-authored-by: Copilot <[email protected]> * Update README.md Co-authored-by: Copilot <[email protected]> --------- Co-authored-by: ChristophShyper <[email protected]> Co-authored-by: Copilot <[email protected]>
1 parent f9d951d commit e28c83e

File tree

9 files changed

+653
-84
lines changed

9 files changed

+653
-84
lines changed

.github/VERSION-DETECTION.md

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Version Detection Test Examples
2+
3+
This file demonstrates how the automated version detection works with different branch merges and commit patterns.
4+
5+
## Branch-Based Version Detection
6+
7+
### ✅ Minor Version Bump (v0.10.2 → v0.11.0)
8+
**Trigger**: Merging from `feat*` branches
9+
10+
```bash
11+
# Developer workflow:
12+
git checkout master
13+
git checkout -b feat/new-user-authentication
14+
git commit -m "add OAuth login support"
15+
git commit -m "add user profile management"
16+
git push origin feat/new-user-authentication
17+
18+
# Create PR and merge to master
19+
# Result: Automatic minor version bump v0.10.2 → v0.11.0
20+
```
21+
22+
### ✅ Patch Version Bump (v0.10.2 → v0.10.3)
23+
**Trigger**: Merging from any other branch
24+
25+
```bash
26+
# Bug fix:
27+
git checkout -b fix/login-timeout
28+
git commit -m "fix: resolve session timeout issue"
29+
# Result: v0.10.2 → v0.10.3
30+
31+
# Documentation:
32+
git checkout -b docs/update-api-guide
33+
git commit -m "docs: update API documentation"
34+
# Result: v0.10.2 → v0.10.3
35+
36+
# Refactoring:
37+
git checkout -b refactor/cleanup-auth
38+
git commit -m "refactor: simplify authentication flow"
39+
# Result: v0.10.2 → v0.10.3
40+
```
41+
42+
## Detection Priority
43+
44+
The system checks in this order:
45+
46+
1. **Feature branches** (highest priority)
47+
- Checks merged branch names for `feat*` pattern
48+
- Also checks commit messages for `feat:` prefix
49+
- Results in minor version bump (Y)
50+
51+
2. **Everything else** (default)
52+
- All other branch merges and commits
53+
- Results in patch version bump (Z)
54+
55+
## Example Scenarios
56+
57+
| Branch Name | Commit Message | Version Change | Reason |
58+
|-------------|----------------|----------------|---------|
59+
| `feat/auth` | "add login system" | v0.10.2 → v0.11.0 | feat branch (minor) |
60+
| `fix/bug` | "fix: resolve crash" | v0.10.2 → v0.10.3 | non-feat branch (patch) |
61+
| `docs/readme` | "docs: update guide" | v0.10.2 → v0.10.3 | non-feat branch (patch) |
62+
| `fix/bug` | "feat: add new feature" | v0.10.2 → v0.11.0 | feat in commit (minor) |
63+
| `refactor/code` | "refactor: improve structure" | v0.10.2 → v0.10.3 | non-feat branch (patch) |
64+
65+
This ensures that:
66+
- ✅ New features always increment minor version (Y number)
67+
- ✅ Bug fixes and other changes increment patch version (Z number)
68+
- ✅ Major version (X) is only incremented manually
69+
- ✅ Documentation and dependency updates don't trigger releases
70+
- ✅ No manual version management needed

.github/WORKFLOWS.md

Lines changed: 79 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
11
# GitHub Actions Workflows Documentation
22

3-
This repository uses a comprehensive GitHub Actions setup with different workflows for different purposes.
3+
This repository uses: Fully automated release creation with zero manual intervention
4+
- ✅ Detects when releases are needed (new commits to master, excluding docs/deps)
5+
- ✅ Analyzes commit messages for semantic versioning
6+
- ✅ Calculates next version automatically (major/minor)
7+
- ✅ Creates release branches with version updates using own action
8+
- ✅ Relies on PUSH-OTHER.yml for PR creation
9+
- ✅ Supports manual triggering for custom releases
10+
- ✅ Skips releases for documentation and dependency updates
411

12+
This repository uses a comprehensive GitHub Actions setup with different workflows for different purposes.
513
## Workflow Overview
614

715
### 1. PUSH-MASTER.yml
@@ -24,38 +32,69 @@ This repository uses a comprehensive GitHub Actions setup with different workflo
2432
- ✅ Update repository labels (dry run)
2533
- ✅ Run Hadolint linting on Dockerfile
2634
- ✅ Build Docker image (test only for regular branches)
27-
- ✅ Build & push test Docker images for `test/*` branches
35+
- ✅ Build & push test Docker images for `test*` branches
2836
- ✅ Create Pull Requests based on branch naming conventions
2937

3038
**Special handling for test branches**:
31-
- Branches starting with `test/` → Build and push Docker images with `test-` prefix
39+
- Branches starting with `test` → Build and push Docker images with `test-` prefix
3240
- Other branches → Build test only (no push)
3341

3442
**Branch naming conventions for auto-PR creation**:
35-
- `bug/*` → Creates PR with "bugfix" label
36-
- `dep/*` → Creates PR with "dependency" label
37-
- `doc/*` → Creates PR with "documentation" label
38-
- `feat/*` → Creates PR with "feature" label
39-
- `test/*` → Creates draft PR with "test" label + pushes test Docker images
43+
- `bug*` → Creates PR with "bugfix" label
44+
- `dep*` → Creates PR with "dependency" label
45+
- `doc*` → Creates PR with "documentation" label
46+
- `feat*` → Creates PR with "feature" label
47+
- `test*` → Creates draft PR with "test" label + pushes test Docker images
4048
- Other branches → Creates PR with "feature" label
4149

4250
### 3. RELEASE.yml
43-
**Trigger**: GitHub release published
44-
45-
**Purpose**: Production deployment
46-
- ✅ Build multi-architecture Docker images (amd64, arm64)
47-
- ✅ Push images to Docker Hub with release version tag
51+
**Trigger**:
52+
- Push to `release/vX.Y.Z` branches (creates release PR)
53+
- Pull request merge from `release/vX.Y.Z` branches to master (publishes release)
54+
55+
**Purpose**: Handle release branch workflows and Docker image publishing
56+
- ✅ Create release PRs with version updates when pushing to `release/vX.Y.Z` branches
57+
- ✅ Build multi-architecture Docker images (amd64, arm64) when release PRs are merged
58+
- ✅ Push images to Docker Hub with release version tag and `latest`
4859
- ✅ Push images to GitHub Container Registry
60+
- ✅ Create GitHub release with version tag
4961
- ✅ Update Docker Hub description
50-
- ✅ Update `action.yml` with new image version
51-
52-
**Release Process**:
53-
1. Create GitHub release with version tag (e.g., `v0.11.0`)
54-
2. Workflow automatically builds and pushes Docker images
55-
3. Images are tagged with the release version
56-
4. `action.yml` is updated to reference the new version
57-
58-
### 4. CRON.yml
62+
- ✅ Clean up release branch after merge
63+
64+
### 4. AUTO-VERSION.yml
65+
**Trigger**:
66+
- Push to `master` branch (automatic)
67+
- Manual workflow dispatch (optional)
68+
69+
**Purpose**: Fully automated release creation with zero manual intervention
70+
- ✅ Detects when releases are needed (new commits to master)
71+
- ✅ Analyzes commit messages for semantic versioning
72+
- ✅ Calculates next version automatically (major/minor/patch)
73+
- ✅ Creates release branches with version updates
74+
- ✅ Opens detailed release PRs
75+
- ✅ Supports manual triggering for custom releases
76+
77+
**Automated Release Process**:
78+
1. New commits pushed to master (excluding docs/dependencies)
79+
2. System analyzes merged branch names and commit messages:
80+
- Merged from "feat" branches → minor version (v0.10.2 → v0.11.0)
81+
- Other changes → patch version (v0.10.2 → v0.10.3)
82+
3. Automatically creates `release/vX.Y.Z` branch using own action
83+
4. Updates version in `action.yml` and `Makefile`
84+
5. PUSH-OTHER.yml workflow creates PR automatically
85+
6. When merged → triggers RELEASE.yml workflow for publishing
86+
87+
### 5. AUTO-RELEASE.yml
88+
**Trigger**: Manual workflow dispatch only
89+
90+
**Purpose**: Manual release creation with version input
91+
- ✅ Allows manual specification of release version
92+
- ✅ Supports minor/major release types
93+
- ✅ Creates release branches using own action
94+
- ✅ Relies on PUSH-OTHER.yml for PR creation
95+
- ✅ Validates version format and availability
96+
97+
### 6. CRON.yml
5998
**Trigger**: Weekly schedule (Sundays at 5:00 AM UTC)
6099

61100
**Purpose**: Weekly health check and test image refresh
@@ -85,13 +124,23 @@ This repository uses a comprehensive GitHub Actions setup with different workflo
85124
### Development Flow
86125
1. Create feature branch with appropriate naming convention
87126
2. Push changes → Triggers build test and auto-PR creation
88-
3. Review and merge PR to master → Triggers master build test
89-
4. Create GitHub release → Triggers production deployment
127+
3. Review and merge PR to master → Triggers automatic release detection
128+
4. System automatically creates release (if new commits warrant it)
129+
5. Review and merge release PR → Triggers production deployment
90130

91131
### Production Deployment
92-
- Only happens on GitHub releases
93-
- Ensures only tested, reviewed code reaches production
94-
- Automatic versioning and tagging
95-
- Docker Hub and GitHub Container Registry deployment
96-
97-
This setup ensures a safe, automated, and well-tested deployment pipeline while maintaining development velocity.
132+
- **Fully automated**: No manual release creation needed
133+
- **Smart detection**: Only releases when there are actual changes
134+
- **Semantic versioning**: Automatic version calculation from commit messages
135+
- **Safe process**: Release PRs provide review opportunity before publishing
136+
- **GitHub release creation**: Automated with release notes
137+
- **Docker Hub and GitHub Container Registry**: Automatic multi-architecture deployment
138+
139+
### Release Automation Strategy
140+
- **Zero manual work**: Push to master → automatic release detection → release PR → merge → publish
141+
- **Semantic commits**: Commit message analysis determines version type
142+
- **Branch protection**: All releases go through PR review process
143+
- **Failsafe mechanisms**: Version validation, duplicate prevention, format checking
144+
- **Clean automation**: Automatic branch cleanup and proper tagging
145+
146+
This setup provides **complete automation** while maintaining safety through the PR review process. No manual release management required!

.github/workflows/AUTO-RELEASE.yml

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
name: Automated Release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: 'Release version (e.g., v0.12.0)'
8+
required: true
9+
type: string
10+
release_type:
11+
description: 'Type of release'
12+
required: true
13+
default: 'patch'
14+
type: choice
15+
options:
16+
- patch
17+
- minor
18+
- major
19+
20+
jobs:
21+
create_automated_release:
22+
name: Create Automated Release
23+
runs-on: ubuntu-24.04-arm
24+
steps:
25+
- name: Checkout
26+
uses: actions/checkout@v4
27+
with:
28+
fetch-depth: 0
29+
30+
- name: Validate version format
31+
run: |
32+
VERSION="${{ github.event.inputs.version }}"
33+
if [[ ! $VERSION =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
34+
echo "❌ Invalid version format. Use format: v1.2.3"
35+
exit 1
36+
fi
37+
echo "✅ Version format is valid: $VERSION"
38+
39+
- name: Check if version already exists
40+
run: |
41+
VERSION="${{ github.event.inputs.version }}"
42+
if git tag -l | grep -q "^${VERSION}$"; then
43+
echo "❌ Version $VERSION already exists"
44+
exit 1
45+
fi
46+
echo "✅ Version $VERSION is available"
47+
48+
- name: Get current date
49+
id: date
50+
run: echo "date=$(date +'%Y-%m-%d %H:%M:%S UTC')" >> $GITHUB_OUTPUT
51+
52+
- name: Update version in action.yml
53+
run: |
54+
VERSION="${{ github.event.inputs.version }}"
55+
sed -i "s|image: docker://devopsinfra/action-commit-push:.*|image: docker://devopsinfra/action-commit-push:${VERSION}|" action.yml
56+
echo "✅ Updated action.yml to use version: ${VERSION}"
57+
58+
- name: Update version in Makefile
59+
run: |
60+
VERSION="${{ github.event.inputs.version }}"
61+
# Update the fallback version in Makefile
62+
sed -i "s|echo \"v[0-9]\+\.[0-9]\+\.[0-9]\+\"|echo \"${VERSION}\"|" Makefile
63+
echo "✅ Updated Makefile fallback version to: ${VERSION}"
64+
65+
- name: Create release branch and commit changes
66+
uses: devops-infra/action-commit-push@master
67+
with:
68+
github_token: ${{ secrets.GITHUB_TOKEN }}
69+
target_branch: release/${{ github.event.inputs.version }}
70+
commit_message: |
71+
Automated Release ${{ github.event.inputs.version }}
72+
73+
This is an **automated release** created via workflow dispatch.
74+
75+
Release Details
76+
- **Version**: `${{ github.event.inputs.version }}`
77+
- **Type**: `${{ github.event.inputs.release_type }}`
78+
- **Triggered by**: @${{ github.actor }}
79+
- **Date**: ${{ steps.date.outputs.date }}
80+
81+
Changes in this release
82+
- ✅ Updated `action.yml` to reference Docker image `${{ github.event.inputs.version }}`
83+
- ✅ Updated `Makefile` fallback version to `${{ github.event.inputs.version }}`
84+
85+
What happens when this PR is merged?
86+
1. 🐳 Docker images will be built and pushed to Docker Hub and GitHub Packages
87+
2. 🏷️ A GitHub release will be created with tag `${{ github.event.inputs.version }}`
88+
3. 📝 Docker Hub description will be updated
89+
4. 🧹 Release branch will be cleaned up automatically
90+
91+
Auto-merge Information
92+
This PR can be safely merged as it only contains version updates.
93+
94+
**⚠️ Important:** Once merged, this will immediately publish Docker images to production registries.
95+
96+
---
97+
*This release was created automatically. No manual intervention required.*

0 commit comments

Comments
 (0)