Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
f258130
Update workflows and documentation for improved release process
ChristophShyper Jul 17, 2025
f5e12cb
Add testing guidelines for branches in README.md
ChristophShyper Jul 17, 2025
7910183
Add automated version detection and release workflows with comprehens…
ChristophShyper Jul 20, 2025
c6233a3
Update .github/WORKFLOWS.md
ChristophShyper Jul 20, 2025
d3673f3
Update version detection logic and documentation for accurate version…
ChristophShyper Jul 21, 2025
1bc2e16
Limit `git log` to 50 entries
ChristophShyper Jul 21, 2025
8d758ea
Fix naming in README.md
ChristophShyper Jul 21, 2025
72d59f4
Improve release branch delete
ChristophShyper Jul 21, 2025
631610a
Fix release trigger to skip dependency and documentation commits
ChristophShyper Jul 21, 2025
0bbd9e8
Update README.md
ChristophShyper Jul 21, 2025
5490dd0
Update README.md
ChristophShyper Jul 21, 2025
a0cf55c
Update .github/workflows/AUTO-VERSION.yml
ChristophShyper Jul 21, 2025
dc3b18a
Update .github/workflows/AUTO-VERSION.yml
ChristophShyper Jul 21, 2025
0e9651d
Update .github/WORKFLOWS.md
ChristophShyper Jul 21, 2025
3043cd3
Update .github/WORKFLOWS.md
ChristophShyper Jul 21, 2025
2fe22b3
Update .github/WORKFLOWS.md
ChristophShyper Jul 21, 2025
6750991
Update .github/workflows/AUTO-VERSION.yml
ChristophShyper Jul 21, 2025
3093de9
Update .github/workflows/AUTO-VERSION.yml
ChristophShyper Jul 21, 2025
67d335b
Update .github/workflows/RELEASE.yml
ChristophShyper Jul 21, 2025
713a861
Update README.md
ChristophShyper Jul 21, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 70 additions & 0 deletions .github/VERSION-DETECTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# Version Detection Test Examples

This file demonstrates how the automated version detection works with different branch merges and commit patterns.

## Branch-Based Version Detection

### ✅ Minor Version Bump (v0.10.2 → v0.11.0)
**Trigger**: Merging from `feat*` branches

```bash
# Developer workflow:
git checkout master
git checkout -b feat/new-user-authentication
git commit -m "add OAuth login support"
git commit -m "add user profile management"
git push origin feat/new-user-authentication

# Create PR and merge to master
# Result: Automatic minor version bump v0.10.2 → v0.11.0
```

### ✅ Patch Version Bump (v0.10.2 → v0.10.3)
**Trigger**: Merging from any other branch

```bash
# Bug fix:
git checkout -b fix/login-timeout
git commit -m "fix: resolve session timeout issue"
# Result: v0.10.2 → v0.10.3

# Documentation:
git checkout -b docs/update-api-guide
git commit -m "docs: update API documentation"
# Result: v0.10.2 → v0.10.3

# Refactoring:
git checkout -b refactor/cleanup-auth
git commit -m "refactor: simplify authentication flow"
# Result: v0.10.2 → v0.10.3
```

## Detection Priority

The system checks in this order:

1. **Feature branches** (highest priority)
- Checks merged branch names for `feat*` pattern
- Also checks commit messages for `feat:` prefix
- Results in minor version bump (Y)

2. **Everything else** (default)
- All other branch merges and commits
- Results in patch version bump (Z)

## Example Scenarios

| Branch Name | Commit Message | Version Change | Reason |
|-------------|----------------|----------------|---------|
| `feat/auth` | "add login system" | v0.10.2 → v0.11.0 | feat branch (minor) |
| `fix/bug` | "fix: resolve crash" | v0.10.2 → v0.10.3 | non-feat branch (patch) |
| `docs/readme` | "docs: update guide" | v0.10.2 → v0.10.3 | non-feat branch (patch) |
| `fix/bug` | "feat: add new feature" | v0.10.2 → v0.11.0 | feat in commit (minor) |
| `refactor/code` | "refactor: improve structure" | v0.10.2 → v0.10.3 | non-feat branch (patch) |

This ensures that:
- ✅ New features always increment minor version (Y number)
- ✅ Bug fixes and other changes increment patch version (Z number)
- ✅ Major version (X) is only incremented manually
- ✅ Documentation and dependency updates don't trigger releases
- ✅ No manual version management needed
109 changes: 79 additions & 30 deletions .github/WORKFLOWS.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
# GitHub Actions Workflows Documentation

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

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

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

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

**Branch naming conventions for auto-PR creation**:
- `bug/*` → Creates PR with "bugfix" label
- `dep/*` → Creates PR with "dependency" label
- `doc/*` → Creates PR with "documentation" label
- `feat/*` → Creates PR with "feature" label
- `test/*` → Creates draft PR with "test" label + pushes test Docker images
- `bug*` → Creates PR with "bugfix" label
- `dep*` → Creates PR with "dependency" label
- `doc*` → Creates PR with "documentation" label
- `feat*` → Creates PR with "feature" label
- `test*` → Creates draft PR with "test" label + pushes test Docker images
- Other branches → Creates PR with "feature" label

### 3. RELEASE.yml
**Trigger**: GitHub release published

**Purpose**: Production deployment
- ✅ Build multi-architecture Docker images (amd64, arm64)
- ✅ Push images to Docker Hub with release version tag
**Trigger**:
- Push to `release/vX.Y.Z` branches (creates release PR)
- Pull request merge from `release/vX.Y.Z` branches to master (publishes release)

**Purpose**: Handle release branch workflows and Docker image publishing
- ✅ Create release PRs with version updates when pushing to `release/vX.Y.Z` branches
- ✅ Build multi-architecture Docker images (amd64, arm64) when release PRs are merged
- ✅ Push images to Docker Hub with release version tag and `latest`
- ✅ Push images to GitHub Container Registry
- ✅ Create GitHub release with version tag
- ✅ Update Docker Hub description
- ✅ Update `action.yml` with new image version

**Release Process**:
1. Create GitHub release with version tag (e.g., `v0.11.0`)
2. Workflow automatically builds and pushes Docker images
3. Images are tagged with the release version
4. `action.yml` is updated to reference the new version

### 4. CRON.yml
- ✅ Clean up release branch after merge

### 4. AUTO-VERSION.yml
**Trigger**:
- Push to `master` branch (automatic)
- Manual workflow dispatch (optional)

**Purpose**: Fully automated release creation with zero manual intervention
- ✅ Detects when releases are needed (new commits to master)
- ✅ Analyzes commit messages for semantic versioning
- ✅ Calculates next version automatically (major/minor/patch)
- ✅ Creates release branches with version updates
- ✅ Opens detailed release PRs
- ✅ Supports manual triggering for custom releases

**Automated Release Process**:
1. New commits pushed to master (excluding docs/dependencies)
2. System analyzes merged branch names and commit messages:
- Merged from "feat" branches → minor version (v0.10.2 → v0.11.0)
- Other changes → patch version (v0.10.2 → v0.10.3)
3. Automatically creates `release/vX.Y.Z` branch using own action
4. Updates version in `action.yml` and `Makefile`
5. PUSH-OTHER.yml workflow creates PR automatically
6. When merged → triggers RELEASE.yml workflow for publishing

### 5. AUTO-RELEASE.yml
**Trigger**: Manual workflow dispatch only

**Purpose**: Manual release creation with version input
- ✅ Allows manual specification of release version
- ✅ Supports minor/major release types
- ✅ Creates release branches using own action
- ✅ Relies on PUSH-OTHER.yml for PR creation
- ✅ Validates version format and availability

### 6. CRON.yml
**Trigger**: Weekly schedule (Sundays at 5:00 AM UTC)

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

### Production Deployment
- Only happens on GitHub releases
- Ensures only tested, reviewed code reaches production
- Automatic versioning and tagging
- Docker Hub and GitHub Container Registry deployment

This setup ensures a safe, automated, and well-tested deployment pipeline while maintaining development velocity.
- **Fully automated**: No manual release creation needed
- **Smart detection**: Only releases when there are actual changes
- **Semantic versioning**: Automatic version calculation from commit messages
- **Safe process**: Release PRs provide review opportunity before publishing
- **GitHub release creation**: Automated with release notes
- **Docker Hub and GitHub Container Registry**: Automatic multi-architecture deployment

### Release Automation Strategy
- **Zero manual work**: Push to master → automatic release detection → release PR → merge → publish
- **Semantic commits**: Commit message analysis determines version type
- **Branch protection**: All releases go through PR review process
- **Failsafe mechanisms**: Version validation, duplicate prevention, format checking
- **Clean automation**: Automatic branch cleanup and proper tagging

This setup provides **complete automation** while maintaining safety through the PR review process. No manual release management required!
97 changes: 97 additions & 0 deletions .github/workflows/AUTO-RELEASE.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
name: Automated Release

on:
workflow_dispatch:
inputs:
version:
description: 'Release version (e.g., v0.12.0)'
required: true
type: string
release_type:
description: 'Type of release'
required: true
default: 'patch'
type: choice
options:
- patch
- minor
- major

jobs:
create_automated_release:
name: Create Automated Release
runs-on: ubuntu-24.04-arm
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Validate version format
run: |
VERSION="${{ github.event.inputs.version }}"
if [[ ! $VERSION =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "❌ Invalid version format. Use format: v1.2.3"
exit 1
fi
echo "✅ Version format is valid: $VERSION"

- name: Check if version already exists
run: |
VERSION="${{ github.event.inputs.version }}"
if git tag -l | grep -q "^${VERSION}$"; then
echo "❌ Version $VERSION already exists"
exit 1
fi
echo "✅ Version $VERSION is available"

- name: Get current date
id: date
run: echo "date=$(date +'%Y-%m-%d %H:%M:%S UTC')" >> $GITHUB_OUTPUT

- name: Update version in action.yml
run: |
VERSION="${{ github.event.inputs.version }}"
sed -i "s|image: docker://devopsinfra/action-commit-push:.*|image: docker://devopsinfra/action-commit-push:${VERSION}|" action.yml
echo "✅ Updated action.yml to use version: ${VERSION}"

- name: Update version in Makefile
run: |
VERSION="${{ github.event.inputs.version }}"
# Update the fallback version in Makefile
sed -i "s|echo \"v[0-9]\+\.[0-9]\+\.[0-9]\+\"|echo \"${VERSION}\"|" Makefile
echo "✅ Updated Makefile fallback version to: ${VERSION}"

- name: Create release branch and commit changes
uses: devops-infra/action-commit-push@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
target_branch: release/${{ github.event.inputs.version }}
commit_message: |
Automated Release ${{ github.event.inputs.version }}

This is an **automated release** created via workflow dispatch.

Release Details
- **Version**: `${{ github.event.inputs.version }}`
- **Type**: `${{ github.event.inputs.release_type }}`
- **Triggered by**: @${{ github.actor }}
- **Date**: ${{ steps.date.outputs.date }}

Changes in this release
- ✅ Updated `action.yml` to reference Docker image `${{ github.event.inputs.version }}`
- ✅ Updated `Makefile` fallback version to `${{ github.event.inputs.version }}`

What happens when this PR is merged?
1. 🐳 Docker images will be built and pushed to Docker Hub and GitHub Packages
2. 🏷️ A GitHub release will be created with tag `${{ github.event.inputs.version }}`
3. 📝 Docker Hub description will be updated
4. 🧹 Release branch will be cleaned up automatically

Auto-merge Information
This PR can be safely merged as it only contains version updates.

**⚠️ Important:** Once merged, this will immediately publish Docker images to production registries.

---
*This release was created automatically. No manual intervention required.*
Loading