From f258130ff29460bf154bd55b29f5693924ba1d68 Mon Sep 17 00:00:00 2001 From: ChristophShyper <45788587+ChristophShyper@users.noreply.github.com> Date: Thu, 17 Jul 2025 17:26:45 +0200 Subject: [PATCH 01/20] Update workflows and documentation for improved release process --- .github/WORKFLOWS.md | 7 +++---- .github/workflows/RELEASE.yml | 30 ------------------------------ Makefile | 4 ++-- README.md | 30 ++++++++++++++++-------------- action.yml | 2 +- 5 files changed, 22 insertions(+), 51 deletions(-) diff --git a/.github/WORKFLOWS.md b/.github/WORKFLOWS.md index a09d3fe..78f6c9f 100644 --- a/.github/WORKFLOWS.md +++ b/.github/WORKFLOWS.md @@ -44,16 +44,15 @@ This repository uses a comprehensive GitHub Actions setup with different workflo **Purpose**: Production deployment - ✅ Build multi-architecture Docker images (amd64, arm64) -- ✅ Push images to Docker Hub with release version tag +- ✅ Push images to Docker Hub with release version tag and `latest` - ✅ Push images to GitHub Container Registry - ✅ 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 +3. Images are tagged with both the release version and `latest` +4. Action uses `latest` tag, so new releases are immediately available ### 4. CRON.yml **Trigger**: Weekly schedule (Sundays at 5:00 AM UTC) diff --git a/.github/workflows/RELEASE.yml b/.github/workflows/RELEASE.yml index 6f599d8..34cde62 100644 --- a/.github/workflows/RELEASE.yml +++ b/.github/workflows/RELEASE.yml @@ -46,33 +46,3 @@ jobs: password: ${{ secrets.DOCKER_TOKEN }} repository: ${{ vars.DOCKER_ORG_NAME }}/${{ github.event.repository.name }} short-description: ${{ github.event.repository.description }} - - update_action_yml: - name: Update action.yml with new version - needs: build_and_push - runs-on: ubuntu-24.04-arm - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - token: ${{ secrets.GITHUB_TOKEN }} - - - name: Extract version from tag - id: version - run: | - VERSION=${GITHUB_REF#refs/tags/} - echo "version=${VERSION}" >> $GITHUB_OUTPUT - echo "Version: ${VERSION}" - - - name: Update action.yml with new version - run: | - VERSION=${{ steps.version.outputs.version }} - sed -i "s|image: docker://devopsinfra/action-commit-push:.*|image: docker://devopsinfra/action-commit-push:${VERSION}|" action.yml - git diff action.yml - - - name: Commit updated action.yml - uses: ./ - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - commit_message: "Update action.yml to use release version ${{ steps.version.outputs.version }}" - amend: false diff --git a/Makefile b/Makefile index 700ea02..a3fe17c 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,8 @@ .PHONY: phony phony: help -# Release tag for the action -VERSION := $(or $(VERSION),v0.11.0) +# Release tag for the action - use environment variable or fall back to latest git tag +VERSION := $(or $(VERSION),$(shell git describe --tags --abbrev=0 2>/dev/null || echo "v0.11.0")) # GitHub Actions bogus variables GITHUB_REF ?= refs/heads/null diff --git a/README.md b/README.md index f880dd1..62b7ce8 100644 --- a/README.md +++ b/README.md @@ -214,25 +214,27 @@ This action follows a **release-based Docker image deployment strategy**: 1. Create a new GitHub release with a version tag (e.g., `v0.11.0`) 2. The release workflow automatically: - Builds multi-architecture Docker images (`amd64`, `arm64`) - - Pushes images to Docker Hub with the release version tag - - Updates the `action.yml` file to reference the new Docker image version + - Pushes images to Docker Hub with both the release version tag and `latest` tag - Updates Docker Hub description -### 🧪 Testing with Test Branches +**📌 Note**: The action uses the `latest` tag by default, so new releases are automatically available to all users. For users who want to pin to specific versions, they can reference the exact version tag (e.g., `@v0.11.0`). -For testing changes before creating a release: +## 🎯 Version Usage Options -1. Create a branch starting with `test/` (e.g., `test/new-feature`) -2. Push your changes to this branch -3. The workflow automatically builds and pushes Docker images with `test-` prefix -4. Use the test image in other workflows: `devopsinfra/action-commit-push:test-latest` +You can use this action in different ways depending on your needs: + +### 🔄 Latest Version (Recommended) +```yaml +- uses: devops-infra/action-commit-push@master +``` +Always uses the latest release. Automatically gets new features and fixes. + +### 📌 Pinned Version (Stable) +```yaml +- uses: devops-infra/action-commit-push@v0.11.0 +``` +Uses a specific version. More predictable but requires manual updates. -**This ensures that:** -- ✅ Master branch merges don't accidentally publish untested images -- ✅ Test branches provide safe testing environments -- ✅ Only stable, released versions are available on Docker Hub -- ✅ Users can pin to specific, tested versions -- ✅ Development and testing don't interfere with production images ## ⚠️ Force Push Options diff --git a/action.yml b/action.yml index fc2f0d1..9241d52 100644 --- a/action.yml +++ b/action.yml @@ -49,7 +49,7 @@ outputs: description: Name of the branch code was pushed into runs: using: docker - image: docker://devopsinfra/action-commit-push:v0.10.0 + image: docker://devopsinfra/action-commit-push:latest env: GITHUB_TOKEN: ${{ inputs.github_token }} branding: From f5e12cb28599ff2818a383107af1030ac387eb27 Mon Sep 17 00:00:00 2001 From: ChristophShyper <45788587+ChristophShyper@users.noreply.github.com> Date: Thu, 17 Jul 2025 17:33:39 +0200 Subject: [PATCH 02/20] Add testing guidelines for branches in README.md --- README.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/README.md b/README.md index 62b7ce8..dcaf372 100644 --- a/README.md +++ b/README.md @@ -217,8 +217,25 @@ This action follows a **release-based Docker image deployment strategy**: - Pushes images to Docker Hub with both the release version tag and `latest` tag - Updates Docker Hub description +### 🧪 Testing with Test Branches + +For testing changes before creating a release: + +1. Create a branch starting with `test/` (e.g., `test/new-feature`) +2. Push your changes to this branch +3. The workflow automatically builds and pushes Docker images with `test-` prefix +4. Use the test image in other workflows: `devopsinfra/action-commit-push:test-latest` + +**This ensures that:** +- ✅ Master branch merges don't accidentally publish untested images +- ✅ Test branches provide safe testing environments +- ✅ Only stable, released versions are available on Docker Hub +- ✅ Users can pin to specific, tested versions +- ✅ Development and testing don't interfere with production images + **📌 Note**: The action uses the `latest` tag by default, so new releases are automatically available to all users. For users who want to pin to specific versions, they can reference the exact version tag (e.g., `@v0.11.0`). + ## 🎯 Version Usage Options You can use this action in different ways depending on your needs: From 7910183862aa1ffe1c8b05a13c6832ee2d06318e Mon Sep 17 00:00:00 2001 From: ChristophShyper <45788587+ChristophShyper@users.noreply.github.com> Date: Sun, 20 Jul 2025 22:30:02 +0200 Subject: [PATCH 03/20] Add automated version detection and release workflows with comprehensive documentation --- .github/VERSION-DETECTION.md | 69 +++++++++++ .github/WORKFLOWS.md | 103 +++++++++++----- .github/workflows/AUTO-RELEASE.yml | 96 +++++++++++++++ .github/workflows/AUTO-VERSION.yml | 182 +++++++++++++++++++++++++++++ .github/workflows/PUSH-OTHER.yml | 5 +- .github/workflows/RELEASE.yml | 119 ++++++++++++++++++- README.md | 93 ++++++++++++--- action.yml | 2 +- 8 files changed, 616 insertions(+), 53 deletions(-) create mode 100644 .github/VERSION-DETECTION.md create mode 100644 .github/workflows/AUTO-RELEASE.yml create mode 100644 .github/workflows/AUTO-VERSION.yml diff --git a/.github/VERSION-DETECTION.md b/.github/VERSION-DETECTION.md new file mode 100644 index 0000000..f8569fb --- /dev/null +++ b/.github/VERSION-DETECTION.md @@ -0,0 +1,69 @@ +# Version Detection Test Examples + +This file demonstrates how the automated version detection works with different branch merges and commit patterns. + +## Branch-Based Version Detection + +### ✅ Major 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 major version bump v0.10.2 → v0.11.0 +``` + +### ✅ Minor 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 major version bump + +2. **Everything else** (default) + - All other branch merges and commits + - Results in minor version bump + +## Example Scenarios + +| Branch Name | Commit Message | Version Change | Reason | +|-------------|----------------|----------------|---------| +| `feat/auth` | "add login system" | v0.10.2 → v0.11.0 | feat branch | +| `fix/bug` | "fix: resolve crash" | v0.10.2 → v0.10.3 | non-feat branch | +| `docs/readme` | "docs: update guide" | v0.10.2 → v0.10.3 | non-feat branch | +| `fix/bug` | "feat: add new feature" | v0.10.2 → v0.11.0 | feat in commit | +| `refactor/code` | "refactor: improve structure" | v0.10.2 → v0.10.3 | non-feat branch | + +This ensures that: +- ✅ New features always increment major version (minor number) +- ✅ Bug fixes and other changes increment minor version (patch number) +- ✅ Documentation and dependency updates don't trigger releases +- ✅ No manual version management needed diff --git a/.github/WORKFLOWS.md b/.github/WORKFLOWS.md index 78f6c9f..fcd71bf 100644 --- a/.github/WORKFLOWS.md +++ b/.github/WORKFLOWS.md @@ -1,6 +1,13 @@ # GitHub Actions Workflows Documentation -This repository uses a comprehensive GitHub Actions setup with different workflows for different purposes. +This repository us**Purpose**: 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 updatesmprehensive GitHub Actions setup with different workflows for different purposes. ## Workflow Overview @@ -24,37 +31,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 +**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**: Production deployment -- ✅ Build multi-architecture Docker images (amd64, arm64) +**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 - -**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 both the release version and `latest` -4. Action uses `latest` tag, so new releases are immediately available - -### 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 → major version (v0.10.2 → v0.11.0) + - Other changes → minor 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 @@ -84,13 +123,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! diff --git a/.github/workflows/AUTO-RELEASE.yml b/.github/workflows/AUTO-RELEASE.yml new file mode 100644 index 0000000..ade8162 --- /dev/null +++ b/.github/workflows/AUTO-RELEASE.yml @@ -0,0 +1,96 @@ +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: 'minor' + type: choice + options: + - 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.* diff --git a/.github/workflows/AUTO-VERSION.yml b/.github/workflows/AUTO-VERSION.yml new file mode 100644 index 0000000..028cbe4 --- /dev/null +++ b/.github/workflows/AUTO-VERSION.yml @@ -0,0 +1,182 @@ +name: Auto-Version Release + +on: + push: + branches: + - master + paths-ignore: + - 'README.md' + - '.github/WORKFLOWS.md' + - '.github/VERSION-DETECTION.md' + - 'LICENSE' + - '*.md' + workflow_dispatch: + inputs: + release_type: + description: 'Type of release (auto-detects from commits if not specified)' + required: false + default: 'auto' + type: choice + options: + - auto + - patch + - minor + - major + +jobs: + check_for_release: + name: Check if Release Needed + runs-on: ubuntu-24.04-arm + outputs: + should_release: ${{ steps.check.outputs.should_release }} + version_type: ${{ steps.check.outputs.version_type }} + new_version: ${{ steps.check.outputs.new_version }} + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Check for release triggers + id: check + run: | + # Get the latest tag + LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0") + echo "Latest tag: $LATEST_TAG" + + # Get commits since last tag + COMMITS_SINCE_TAG=$(git rev-list ${LATEST_TAG}..HEAD --count) + echo "Commits since last tag: $COMMITS_SINCE_TAG" + + # If no new commits, don't release + if [ "$COMMITS_SINCE_TAG" -eq 0 ]; then + echo "No new commits since last tag" + echo "should_release=false" >> $GITHUB_OUTPUT + exit 0 + fi + + # Get branch names that were merged since last tag + MERGED_BRANCHES=$(git log ${LATEST_TAG}..HEAD --merges --pretty=format:"%s" | grep -o "from [^']*" | sed 's/from //' || echo "") + echo "Merged branches since last tag:" + echo "$MERGED_BRANCHES" + + # Also check commit messages for manual detection + COMMIT_MESSAGES=$(git log ${LATEST_TAG}..HEAD --pretty=format:"%s" || git log --pretty=format:"%s") + echo "Commit messages:" + echo "$COMMIT_MESSAGES" + + # Skip release for dependency and docs updates + if echo "$MERGED_BRANCHES" | grep -i "^dep\|^dependabot\|^docs\|/dep\|/docs"; then + echo "Skipping release for dependency/docs updates" + echo "should_release=false" >> $GITHUB_OUTPUT + exit 0 + fi + + if echo "$COMMIT_MESSAGES" | grep -i "^dep:\|^docs:\|dependabot\|dependencies"; then + echo "Skipping release for dependency/docs commits" + echo "should_release=false" >> $GITHUB_OUTPUT + exit 0 + fi + + # Determine version type + VERSION_TYPE="${{ github.event.inputs.release_type }}" + if [ "$VERSION_TYPE" = "auto" ] || [ -z "$VERSION_TYPE" ]; then + # Check for feat branches first (major version bump) + if echo "$MERGED_BRANCHES" | grep -i "^feat\|/feat"; then + VERSION_TYPE="major" + # Check for feat in commit messages as fallback + elif echo "$COMMIT_MESSAGES" | grep -i "^feat\|feat:"; then + VERSION_TYPE="major" + # Everything else is minor + else + VERSION_TYPE="minor" + fi + fi + + echo "Detected version type: $VERSION_TYPE" + + # Calculate new version + CURRENT_VERSION=${LATEST_TAG#v} + IFS='.' read -ra VERSION_PARTS <<< "$CURRENT_VERSION" + MAJOR=${VERSION_PARTS[0]:-0} + MINOR=${VERSION_PARTS[1]:-0} + PATCH=${VERSION_PARTS[2]:-0} + + case $VERSION_TYPE in + major) + NEW_VERSION="v${MAJOR}.$((MINOR + 1)).0" + ;; + minor) + NEW_VERSION="v${MAJOR}.${MINOR}.$((PATCH + 1))" + ;; + patch) + NEW_VERSION="v${MAJOR}.${MINOR}.$((PATCH + 1))" + ;; + esac + + echo "New version: $NEW_VERSION" + + # Set outputs + echo "should_release=true" >> $GITHUB_OUTPUT + echo "version_type=$VERSION_TYPE" >> $GITHUB_OUTPUT + echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT + + create_release: + name: Create Automated Release + needs: check_for_release + if: needs.check_for_release.outputs.should_release == 'true' + runs-on: ubuntu-24.04-arm + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Update version in action.yml + run: | + VERSION="${{ needs.check_for_release.outputs.new_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="${{ needs.check_for_release.outputs.new_version }}" + 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/${{ needs.check_for_release.outputs.new_version }} + commit_message: | + 🤖 Fully Automated Release ${{ needs.check_for_release.outputs.new_version }} + + This release was **automatically created** and requires **no manual intervention**. + + 📊 Release Details + - **Version**: `${{ needs.check_for_release.outputs.new_version }}` + - **Type**: `${{ needs.check_for_release.outputs.version_type }}` (auto-detected) + - **Trigger**: `${{ github.event_name }}` + - **Actor**: @${{ github.actor }} + - **Date**: $(date +'%Y-%m-%d %H:%M:%S UTC') + + 🔄 Automated Changes + - ✅ Updated `action.yml` Docker image reference + - ✅ Updated `Makefile` fallback version + - ✅ Version auto-detected from commit messages + + 🚀 What happens when merged? + 1. 🐳 Multi-architecture Docker images built and pushed + 2. 🏷️ GitHub release created with auto-generated notes + 3. 📝 Docker Hub description updated + 4. 🧹 Release branch automatically cleaned up + + 🔍 Version Detection Logic + - `major`: Merges from feat* branches or feat: in commits (v0.10.2 → v0.11.0) + - `minor`: All other changes (v0.10.2 → v0.10.3) + + **This PR is safe to auto-merge - it only contains version updates.** + + --- + *🤖 Fully automated release - zero manual intervention required!* diff --git a/.github/workflows/PUSH-OTHER.yml b/.github/workflows/PUSH-OTHER.yml index e92b24d..4e47b36 100644 --- a/.github/workflows/PUSH-OTHER.yml +++ b/.github/workflows/PUSH-OTHER.yml @@ -41,7 +41,7 @@ jobs: build_test: name: Build test - if: ${{ !startsWith(github.ref, 'refs/heads/dependabot') && !startsWith(github.ref, 'refs/heads/test/') }} + if: ${{ !startsWith(github.ref, 'refs/heads/dependabot') && !startsWith(github.ref, 'refs/heads/test') && !startsWith(github.ref, 'refs/heads/release') }} runs-on: ubuntu-24.04-arm steps: - name: Checkout @@ -66,7 +66,7 @@ jobs: build_and_push_test: name: Build & push test image - if: ${{ startsWith(github.ref, 'refs/heads/test/') }} + if: ${{ startsWith(github.ref, 'refs/heads/test') }} runs-on: ubuntu-24.04-arm steps: - name: Checkout @@ -93,6 +93,7 @@ jobs: pull_request: name: Create Pull Request + if: ${{ !startsWith(github.ref, 'refs/heads/release') }} runs-on: ubuntu-24.04-arm steps: - name: Checkout diff --git a/.github/workflows/RELEASE.yml b/.github/workflows/RELEASE.yml index 34cde62..28e77de 100644 --- a/.github/workflows/RELEASE.yml +++ b/.github/workflows/RELEASE.yml @@ -1,12 +1,87 @@ name: Release +# Trigger on pushes to release/vX.Y.Z branches to create release PRs +# Trigger on PR merges from release/vX.Y.Z branches to publish release images on: - release: - types: [published] + push: + branches: + - 'release/v*' + pull_request: + types: [closed] + branches: + - master jobs: - build_and_push: - name: Build & push release + create_release_pr: + name: Create Release PR + # Only run on push to release/vX.Y.Z branches + if: github.event_name == 'push' && startsWith(github.ref, 'refs/heads/release/v') + runs-on: ubuntu-24.04-arm + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Extract version from branch name + id: version + run: | + BRANCH_NAME=${GITHUB_REF#refs/heads/} + VERSION=${BRANCH_NAME#release/} + echo "version=${VERSION}" >> $GITHUB_OUTPUT + echo "branch=${BRANCH_NAME}" >> $GITHUB_OUTPUT + echo "Version: ${VERSION}" + echo "Branch: ${BRANCH_NAME}" + + - name: Update action.yml with new version + run: | + VERSION=${{ steps.version.outputs.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 Makefile with new version + run: | + VERSION=${{ steps.version.outputs.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 Pull Request + uses: peter-evans/create-pull-request@v7.0.5 + with: + token: ${{ secrets.GITHUB_TOKEN }} + commit-message: "Update version to ${{ steps.version.outputs.version }} in action.yml and Makefile" + title: "🚀 Release ${{ steps.version.outputs.version }}" + body: | + ## Release ${{ steps.version.outputs.version }} + + This PR prepares a new release version ${{ steps.version.outputs.version }}. + + ### Changes in this release + - Updated `action.yml` to reference Docker image `${{ steps.version.outputs.version }}` + - Updated `Makefile` fallback version to `${{ steps.version.outputs.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 `${{ steps.version.outputs.version }}` + 3. ✅ Docker Hub description will be updated + + ### Review Checklist + - [ ] Version number is correct + - [ ] CHANGELOG.md is updated (if applicable) + - [ ] Breaking changes are documented + - [ ] All tests pass + + **⚠️ Important:** Once merged, this will immediately publish Docker images to production registries. + base: master + + build_and_publish: + name: Build & Publish Release + # Only run when PR from release/vX.Y.Z branch is merged to master + if: | + github.event_name == 'pull_request' && + github.event.pull_request.merged == true && + startsWith(github.event.pull_request.head.ref, 'release/v') runs-on: ubuntu-24.04-arm steps: - name: Checkout @@ -23,10 +98,11 @@ jobs: image: tonistiigi/binfmt:latest platforms: amd64,arm64 - - name: Extract version from tag + - name: Extract version from PR branch id: version run: | - VERSION=${GITHUB_REF#refs/tags/} + BRANCH_NAME="${{ github.event.pull_request.head.ref }}" + VERSION=${BRANCH_NAME#release/} echo "version=${VERSION}" >> $GITHUB_OUTPUT echo "Version: ${VERSION}" @@ -39,6 +115,32 @@ jobs: VERSION: ${{ steps.version.outputs.version }} run: make push + - name: Create GitHub Release + uses: softprops/action-gh-release@v2.0.8 + with: + tag_name: ${{ steps.version.outputs.version }} + name: Release ${{ steps.version.outputs.version }} + body: | + ## Release ${{ steps.version.outputs.version }} + + This release was automatically created after merging the release PR. + + ### Docker Images + - **Docker Hub:** `devopsinfra/action-commit-push:${{ steps.version.outputs.version }}` + - **GitHub Packages:** `ghcr.io/devops-infra/action-commit-push:${{ steps.version.outputs.version }}` + + Both images are built for `amd64` and `arm64` architectures. + + ### Usage + ```yaml + - uses: devops-infra/action-commit-push@${{ steps.version.outputs.version }} + ``` + + For full documentation, see the [README](https://github.com/devops-infra/action-commit-push#readme). + generate_release_notes: true + draft: false + prerelease: false + - name: Docker Hub Description uses: peter-evans/dockerhub-description@v4.0.2 with: @@ -46,3 +148,8 @@ jobs: password: ${{ secrets.DOCKER_TOKEN }} repository: ${{ vars.DOCKER_ORG_NAME }}/${{ github.event.repository.name }} short-description: ${{ github.event.repository.description }} + + - name: Clean up release branch + run: | + # Delete the release branch since it's now merged + git push origin --delete ${{ github.event.pull_request.head.ref }} || true diff --git a/README.md b/README.md index dcaf372..88671d0 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,7 @@ - **Force behavior updated**: `force: true` now uses `git push --force` (breaking change) - **New parameter**: `force_with_lease` for safer force pushing with `--force-with-lease` - **Amend improvements**: Can now combine `amend: true` with `commit_message` to change commit messages +- **Release process**: Fully automated releases - zero manual work required! A powerful GitHub Action for automatically committing and pushing changes back to your repository. Perfect for automation workflows and integrates seamlessly with [devops-infra/action-pull-request](https://github.com/devops-infra/action-pull-request). @@ -201,25 +202,83 @@ When using `amend: true`, you have several options for handling the commit messa ## 🚀 Release Process -This action follows a **release-based Docker image deployment strategy**: +This action follows a **fully automated release workflow** with zero manual intervention: - **Development branches**: Only build and test Docker images (no push to Docker Hub) - **Test branches (`test/*`)**: Build and push Docker images with `test-` prefix for integration testing - **Master branch**: Only build and test Docker images (no push to Docker Hub) -- **Releases**: Docker images are built and pushed to Docker Hub only when a new GitHub release is created +- **Automatic releases**: Triggered by pushes to master - no manual steps required! - **Weekly builds**: Automated test builds run weekly and push test images -### 🏷️ Creating a New Release +### 🤖 Fully Automated Releases -1. Create a new GitHub release with a version tag (e.g., `v0.11.0`) -2. The release workflow automatically: - - Builds multi-architecture Docker images (`amd64`, `arm64`) - - Pushes images to Docker Hub with both the release version tag and `latest` tag - - Updates Docker Hub description +**No manual work required!** The system automatically: + +1. **Detects when a release is needed** (new commits to master, excluding docs/dependencies) +2. **Determines version type** from merged branch names and commit messages: + - `major`: Merges from `feat*` branches or "feat:" in commits (v0.10.2 → v0.11.0) + - `minor`: All other changes (v0.10.2 → v0.10.3) +3. **Calculates next version** using semantic versioning +4. **Creates release branch** with version updates using own action +5. **PUSH-OTHER.yml creates the PR** automatically +6. **Publishes when PR is merged** - Docker images, GitHub release, etc. + +### 🚫 **Smart Release Filtering** + +The system **skips releases** for: +- Documentation updates (`docs*` branches, `docs:` commits) +- Dependency updates (`dep*`, `dependabot/*` branches, `dep:` commits) +- README and other markdown file changes +- License updates + +### 🎯 Manual Release Trigger (Optional) + +You can also trigger releases manually via GitHub Actions UI: + +1. Go to **Actions** → **Auto-Version Release** → **Run workflow** +2. Choose release type: "minor" or "major" (or leave as "auto" for detection) +3. Click **Run workflow** +4. System handles the rest automatically! + +### 📝 Commit Message Conventions + +To help with automatic version detection, use these patterns: + +```bash +# Minor version (v0.10.2 → v0.10.3) - Most common +git commit -m "fix: resolve issue with force push" +git commit -m "docs: update README" +git commit -m "refactor: improve code structure" + +# Major version (v0.10.2 → v0.11.0) - Feature branches or feat commits +# Create feature branch: +git checkout -b feat/new-functionality +git commit -m "add new amend functionality" +# OR use feat prefix in commits: +git commit -m "feat: add new amend functionality" +``` + +### 🌿 Branch-Based Version Detection + +The system prioritizes **branch names** for version detection: + +- **`feat/*` branches** → **Major version bump** (v0.10.2 → v0.11.0) + ```bash + git checkout -b feat/new-feature + # When merged to master → major version bump + ``` + +- **Other branches** → **Minor version bump** (v0.10.2 → v0.10.3) + ```bash + git checkout -b fix/bug-fix + git checkout -b docs/update-readme + git checkout -b refactor/cleanup + # When merged to master → minor version bump + ``` ### 🧪 Testing with Test Branches -For testing changes before creating a release: +For testing changes before they reach master: 1. Create a branch starting with `test/` (e.g., `test/new-feature`) 2. Push your changes to this branch @@ -227,14 +286,14 @@ For testing changes before creating a release: 4. Use the test image in other workflows: `devopsinfra/action-commit-push:test-latest` **This ensures that:** -- ✅ Master branch merges don't accidentally publish untested images -- ✅ Test branches provide safe testing environments -- ✅ Only stable, released versions are available on Docker Hub -- ✅ Users can pin to specific, tested versions -- ✅ Development and testing don't interfere with production images - -**📌 Note**: The action uses the `latest` tag by default, so new releases are automatically available to all users. For users who want to pin to specific versions, they can reference the exact version tag (e.g., `@v0.11.0`). - +- ✅ Zero manual release work - everything is automated +- ✅ Semantic versioning based on branch names and commit messages +- ✅ Test branches provide safe testing environments +- ✅ Only reviewed master commits trigger releases +- ✅ Docker images published only after PR review +- ✅ No human errors in version management + +**📌 Note**: The action references specific versions in `action.yml` for stability, and the release process keeps these up-to-date automatically. ## 🎯 Version Usage Options diff --git a/action.yml b/action.yml index 9241d52..7e62dea 100644 --- a/action.yml +++ b/action.yml @@ -49,7 +49,7 @@ outputs: description: Name of the branch code was pushed into runs: using: docker - image: docker://devopsinfra/action-commit-push:latest + image: docker://devopsinfra/action-commit-push:v0.11.0 env: GITHUB_TOKEN: ${{ inputs.github_token }} branding: From c6233a3c063b38bc9249c6d969648329224c30cd Mon Sep 17 00:00:00 2001 From: Krzysztof Szyper <45788587+ChristophShyper@users.noreply.github.com> Date: Sun, 20 Jul 2025 22:48:02 +0200 Subject: [PATCH 04/20] Update .github/WORKFLOWS.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .github/WORKFLOWS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/WORKFLOWS.md b/.github/WORKFLOWS.md index fcd71bf..b2675b4 100644 --- a/.github/WORKFLOWS.md +++ b/.github/WORKFLOWS.md @@ -1,6 +1,6 @@ # GitHub Actions Workflows Documentation -This repository us**Purpose**: Fully automated release creation with zero manual intervention +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) From d3673f37c8f3f175e8c70e8c4bbfee5747a9cba2 Mon Sep 17 00:00:00 2001 From: ChristophShyper <45788587+ChristophShyper@users.noreply.github.com> Date: Mon, 21 Jul 2025 20:36:06 +0200 Subject: [PATCH 05/20] Update version detection logic and documentation for accurate version bumping --- .github/VERSION-DETECTION.md | 25 +++++++++++++------------ .github/workflows/AUTO-RELEASE.yml | 3 ++- .github/workflows/AUTO-VERSION.yml | 19 ++++++++++--------- README.md | 17 +++++++++++------ 4 files changed, 36 insertions(+), 28 deletions(-) diff --git a/.github/VERSION-DETECTION.md b/.github/VERSION-DETECTION.md index f8569fb..135b2ce 100644 --- a/.github/VERSION-DETECTION.md +++ b/.github/VERSION-DETECTION.md @@ -4,7 +4,7 @@ This file demonstrates how the automated version detection works with different ## Branch-Based Version Detection -### ✅ Major Version Bump (v0.10.2 → v0.11.0) +### ✅ Minor Version Bump (v0.10.2 → v0.11.0) **Trigger**: Merging from `feat*` branches ```bash @@ -16,10 +16,10 @@ git commit -m "add user profile management" git push origin feat/new-user-authentication # Create PR and merge to master -# Result: Automatic major version bump v0.10.2 → v0.11.0 +# Result: Automatic minor version bump v0.10.2 → v0.11.0 ``` -### ✅ Minor Version Bump (v0.10.2 → v0.10.3) +### ✅ Patch Version Bump (v0.10.2 → v0.10.3) **Trigger**: Merging from any other branch ```bash @@ -46,24 +46,25 @@ 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 major version bump + - Results in minor version bump (Y) 2. **Everything else** (default) - All other branch merges and commits - - Results in minor version bump + - 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 | -| `fix/bug` | "fix: resolve crash" | v0.10.2 → v0.10.3 | non-feat branch | -| `docs/readme` | "docs: update guide" | v0.10.2 → v0.10.3 | non-feat branch | -| `fix/bug` | "feat: add new feature" | v0.10.2 → v0.11.0 | feat in commit | -| `refactor/code` | "refactor: improve structure" | v0.10.2 → v0.10.3 | non-feat branch | +| `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 major version (minor number) -- ✅ Bug fixes and other changes increment minor version (patch number) +- ✅ 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 diff --git a/.github/workflows/AUTO-RELEASE.yml b/.github/workflows/AUTO-RELEASE.yml index ade8162..c311677 100644 --- a/.github/workflows/AUTO-RELEASE.yml +++ b/.github/workflows/AUTO-RELEASE.yml @@ -10,9 +10,10 @@ on: release_type: description: 'Type of release' required: true - default: 'minor' + default: 'patch' type: choice options: + - patch - minor - major diff --git a/.github/workflows/AUTO-VERSION.yml b/.github/workflows/AUTO-VERSION.yml index 028cbe4..0a0f293 100644 --- a/.github/workflows/AUTO-VERSION.yml +++ b/.github/workflows/AUTO-VERSION.yml @@ -81,15 +81,15 @@ jobs: # Determine version type VERSION_TYPE="${{ github.event.inputs.release_type }}" if [ "$VERSION_TYPE" = "auto" ] || [ -z "$VERSION_TYPE" ]; then - # Check for feat branches first (major version bump) + # Check for feat branches first (minor version bump - Y) if echo "$MERGED_BRANCHES" | grep -i "^feat\|/feat"; then - VERSION_TYPE="major" + VERSION_TYPE="minor" # Check for feat in commit messages as fallback elif echo "$COMMIT_MESSAGES" | grep -i "^feat\|feat:"; then - VERSION_TYPE="major" - # Everything else is minor - else VERSION_TYPE="minor" + # Everything else is patch (Z) + else + VERSION_TYPE="patch" fi fi @@ -104,10 +104,10 @@ jobs: case $VERSION_TYPE in major) - NEW_VERSION="v${MAJOR}.$((MINOR + 1)).0" + NEW_VERSION="v$((MAJOR + 1)).0.0" ;; minor) - NEW_VERSION="v${MAJOR}.${MINOR}.$((PATCH + 1))" + NEW_VERSION="v${MAJOR}.$((MINOR + 1)).0" ;; patch) NEW_VERSION="v${MAJOR}.${MINOR}.$((PATCH + 1))" @@ -173,8 +173,9 @@ jobs: 4. 🧹 Release branch automatically cleaned up 🔍 Version Detection Logic - - `major`: Merges from feat* branches or feat: in commits (v0.10.2 → v0.11.0) - - `minor`: All other changes (v0.10.2 → v0.10.3) + - `major`: Manual releases only (v0.10.2 → v1.0.0) + - `minor`: Merges from feat* branches or feat: in commits (v0.10.2 → v0.11.0) + - `patch`: All other changes (v0.10.2 → v0.10.3) **This PR is safe to auto-merge - it only contains version updates.** diff --git a/README.md b/README.md index 88671d0..1494883 100644 --- a/README.md +++ b/README.md @@ -245,12 +245,12 @@ You can also trigger releases manually via GitHub Actions UI: To help with automatic version detection, use these patterns: ```bash -# Minor version (v0.10.2 → v0.10.3) - Most common +# Patch version (v0.10.2 → v0.10.3) - Most common git commit -m "fix: resolve issue with force push" git commit -m "docs: update README" git commit -m "refactor: improve code structure" -# Major version (v0.10.2 → v0.11.0) - Feature branches or feat commits +# Minor version (v0.10.2 → v0.11.0) - Feature branches or feat commits # Create feature branch: git checkout -b feat/new-functionality git commit -m "add new amend functionality" @@ -262,20 +262,25 @@ git commit -m "feat: add new amend functionality" The system prioritizes **branch names** for version detection: -- **`feat/*` branches** → **Major version bump** (v0.10.2 → v0.11.0) +- **`feat/*` branches** → **Minor version bump** (v0.10.2 → v0.11.0) ```bash git checkout -b feat/new-feature - # When merged to master → major version bump + # When merged to master → minor version bump ``` -- **Other branches** → **Minor version bump** (v0.10.2 → v0.10.3) +- **Other branches** → **Patch version bump** (v0.10.2 → v0.10.3) ```bash git checkout -b fix/bug-fix git checkout -b docs/update-readme git checkout -b refactor/cleanup - # When merged to master → minor version bump + # When merged to master → patch version bump ``` +**🔢 Major Version Handling** +- **Major versions** (X in vX.Y.Z) are only incremented manually +- Use **Actions** → **Auto-Release** → **Run workflow** and select "major" +- This is reserved for breaking changes or significant API changes + ### 🧪 Testing with Test Branches For testing changes before they reach master: From 1bc2e16bfb00c0b33b6e1d724f381bc842bfc3e0 Mon Sep 17 00:00:00 2001 From: Krzysztof Szyper <45788587+ChristophShyper@users.noreply.github.com> Date: Mon, 21 Jul 2025 22:27:01 +0200 Subject: [PATCH 06/20] Limit `git log` to 50 entries Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .github/workflows/AUTO-VERSION.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/AUTO-VERSION.yml b/.github/workflows/AUTO-VERSION.yml index 0a0f293..351555b 100644 --- a/.github/workflows/AUTO-VERSION.yml +++ b/.github/workflows/AUTO-VERSION.yml @@ -61,7 +61,7 @@ jobs: echo "$MERGED_BRANCHES" # Also check commit messages for manual detection - COMMIT_MESSAGES=$(git log ${LATEST_TAG}..HEAD --pretty=format:"%s" || git log --pretty=format:"%s") + COMMIT_MESSAGES=$(git log ${LATEST_TAG}..HEAD --pretty=format:"%s" --max-count=50 || git log --pretty=format:"%s" --max-count=50) echo "Commit messages:" echo "$COMMIT_MESSAGES" From 8d758ea4bc253a84bf3bc595d6cc2e920a746d0a Mon Sep 17 00:00:00 2001 From: Krzysztof Szyper <45788587+ChristophShyper@users.noreply.github.com> Date: Mon, 21 Jul 2025 22:28:46 +0200 Subject: [PATCH 07/20] Fix naming in README.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 1494883..9893dfe 100644 --- a/README.md +++ b/README.md @@ -216,8 +216,8 @@ This action follows a **fully automated release workflow** with zero manual inte 1. **Detects when a release is needed** (new commits to master, excluding docs/dependencies) 2. **Determines version type** from merged branch names and commit messages: - - `major`: Merges from `feat*` branches or "feat:" in commits (v0.10.2 → v0.11.0) - - `minor`: All other changes (v0.10.2 → v0.10.3) + - `minor`: Merges from `feat*` branches or "feat:" in commits (v0.10.2 → v0.10.3) + - `patch`: All other changes (v0.10.2 → v0.10.4) 3. **Calculates next version** using semantic versioning 4. **Creates release branch** with version updates using own action 5. **PUSH-OTHER.yml creates the PR** automatically From 72d59f4b46235e02a1af8c1dc420acd9fe0f4de4 Mon Sep 17 00:00:00 2001 From: Krzysztof Szyper <45788587+ChristophShyper@users.noreply.github.com> Date: Mon, 21 Jul 2025 22:29:34 +0200 Subject: [PATCH 08/20] Improve release branch delete Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .github/workflows/RELEASE.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/RELEASE.yml b/.github/workflows/RELEASE.yml index 28e77de..ce2bf03 100644 --- a/.github/workflows/RELEASE.yml +++ b/.github/workflows/RELEASE.yml @@ -151,5 +151,10 @@ jobs: - name: Clean up release branch run: | - # Delete the release branch since it's now merged - git push origin --delete ${{ github.event.pull_request.head.ref }} || true + # Check if the release branch exists before attempting to delete it + if git ls-remote --exit-code origin ${{ github.event.pull_request.head.ref }}; then + echo "Deleting branch ${{ github.event.pull_request.head.ref }}..." + git push origin --delete ${{ github.event.pull_request.head.ref }} + else + echo "Branch ${{ github.event.pull_request.head.ref }} does not exist. Skipping deletion." + fi From 631610afd6bcabc493aebc2d4ac4de85b4e4b9b9 Mon Sep 17 00:00:00 2001 From: ChristophShyper <45788587+ChristophShyper@users.noreply.github.com> Date: Mon, 21 Jul 2025 22:46:30 +0200 Subject: [PATCH 09/20] Fix release trigger to skip dependency and documentation commits --- .github/workflows/AUTO-VERSION.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/AUTO-VERSION.yml b/.github/workflows/AUTO-VERSION.yml index 351555b..afc3360 100644 --- a/.github/workflows/AUTO-VERSION.yml +++ b/.github/workflows/AUTO-VERSION.yml @@ -71,8 +71,8 @@ jobs: echo "should_release=false" >> $GITHUB_OUTPUT exit 0 fi - - if echo "$COMMIT_MESSAGES" | grep -i "^dep:\|^docs:\|dependabot\|dependencies"; then + + if echo "$COMMIT_MESSAGES" | grep -i "^dep:\|^docs:\|^dependencies:\|^dependency:\"; then echo "Skipping release for dependency/docs commits" echo "should_release=false" >> $GITHUB_OUTPUT exit 0 From 0bbd9e82f1ffc30ffef75a41ff4ea6f021bd8d3b Mon Sep 17 00:00:00 2001 From: Krzysztof Szyper <45788587+ChristophShyper@users.noreply.github.com> Date: Mon, 21 Jul 2025 22:54:05 +0200 Subject: [PATCH 10/20] Update README.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9893dfe..bc03895 100644 --- a/README.md +++ b/README.md @@ -216,7 +216,7 @@ This action follows a **fully automated release workflow** with zero manual inte 1. **Detects when a release is needed** (new commits to master, excluding docs/dependencies) 2. **Determines version type** from merged branch names and commit messages: - - `minor`: Merges from `feat*` branches or "feat:" in commits (v0.10.2 → v0.10.3) + - `minor`: Merges from `feat*` branches or "feat:" in commits (v0.10.2 → v0.11.0) - `patch`: All other changes (v0.10.2 → v0.10.4) 3. **Calculates next version** using semantic versioning 4. **Creates release branch** with version updates using own action From 5490dd09e8644e474a16e369639a81302ceab696 Mon Sep 17 00:00:00 2001 From: Krzysztof Szyper <45788587+ChristophShyper@users.noreply.github.com> Date: Mon, 21 Jul 2025 22:54:29 +0200 Subject: [PATCH 11/20] Update README.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index bc03895..0f0d169 100644 --- a/README.md +++ b/README.md @@ -217,7 +217,7 @@ This action follows a **fully automated release workflow** with zero manual inte 1. **Detects when a release is needed** (new commits to master, excluding docs/dependencies) 2. **Determines version type** from merged branch names and commit messages: - `minor`: Merges from `feat*` branches or "feat:" in commits (v0.10.2 → v0.11.0) - - `patch`: All other changes (v0.10.2 → v0.10.4) + - `patch`: All other changes (v0.10.2 → v0.10.3) 3. **Calculates next version** using semantic versioning 4. **Creates release branch** with version updates using own action 5. **PUSH-OTHER.yml creates the PR** automatically From a0cf55c2ac6b483003e17e97dda503bebc6d3d78 Mon Sep 17 00:00:00 2001 From: Krzysztof Szyper <45788587+ChristophShyper@users.noreply.github.com> Date: Mon, 21 Jul 2025 22:55:10 +0200 Subject: [PATCH 12/20] Update .github/workflows/AUTO-VERSION.yml Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .github/workflows/AUTO-VERSION.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/AUTO-VERSION.yml b/.github/workflows/AUTO-VERSION.yml index afc3360..b7e62c3 100644 --- a/.github/workflows/AUTO-VERSION.yml +++ b/.github/workflows/AUTO-VERSION.yml @@ -61,7 +61,11 @@ jobs: echo "$MERGED_BRANCHES" # Also check commit messages for manual detection - COMMIT_MESSAGES=$(git log ${LATEST_TAG}..HEAD --pretty=format:"%s" --max-count=50 || git log --pretty=format:"%s" --max-count=50) + COMMIT_MESSAGES=$(git log ${LATEST_TAG}..HEAD --pretty=format:"%s" --max-count=50) + if [ $? -ne 0 ]; then + echo "Error: Failed to retrieve commit messages for range ${LATEST_TAG}..HEAD" >&2 + exit 1 + fi echo "Commit messages:" echo "$COMMIT_MESSAGES" From dc3b18a11afc042a877aabe56bbf0c8a736227bf Mon Sep 17 00:00:00 2001 From: Krzysztof Szyper <45788587+ChristophShyper@users.noreply.github.com> Date: Mon, 21 Jul 2025 22:56:41 +0200 Subject: [PATCH 13/20] Update .github/workflows/AUTO-VERSION.yml Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .github/workflows/AUTO-VERSION.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/AUTO-VERSION.yml b/.github/workflows/AUTO-VERSION.yml index b7e62c3..6ae0795 100644 --- a/.github/workflows/AUTO-VERSION.yml +++ b/.github/workflows/AUTO-VERSION.yml @@ -76,7 +76,7 @@ jobs: exit 0 fi - if echo "$COMMIT_MESSAGES" | grep -i "^dep:\|^docs:\|^dependencies:\|^dependency:\"; then + if echo "$COMMIT_MESSAGES" | grep -i "^dep:\|^docs:\|^dependencies:\|^dependency:"; then echo "Skipping release for dependency/docs commits" echo "should_release=false" >> $GITHUB_OUTPUT exit 0 From 0e9651d75d0b38161a343b34c966568663d8d069 Mon Sep 17 00:00:00 2001 From: Krzysztof Szyper <45788587+ChristophShyper@users.noreply.github.com> Date: Mon, 21 Jul 2025 22:57:12 +0200 Subject: [PATCH 14/20] Update .github/WORKFLOWS.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .github/WORKFLOWS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/WORKFLOWS.md b/.github/WORKFLOWS.md index b2675b4..2663f16 100644 --- a/.github/WORKFLOWS.md +++ b/.github/WORKFLOWS.md @@ -76,7 +76,7 @@ This repository uses: Fully automated release creation with zero manual interven **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 → major version (v0.10.2 → v0.11.0) + - Merged from "feat" branches → minor version (v0.10.2 → v0.11.0) - Other changes → minor 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` From 3043cd39fe558fe2030731f98a50943c6388bf0f Mon Sep 17 00:00:00 2001 From: Krzysztof Szyper <45788587+ChristophShyper@users.noreply.github.com> Date: Mon, 21 Jul 2025 23:02:32 +0200 Subject: [PATCH 15/20] Update .github/WORKFLOWS.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .github/WORKFLOWS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/WORKFLOWS.md b/.github/WORKFLOWS.md index 2663f16..5e00332 100644 --- a/.github/WORKFLOWS.md +++ b/.github/WORKFLOWS.md @@ -77,7 +77,7 @@ This repository uses: Fully automated release creation with zero manual interven 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 → minor version (v0.10.2 → v0.10.3) + - 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 From 2fe22b3993048b46fe73b2a9d0fa68b148b23aa2 Mon Sep 17 00:00:00 2001 From: Krzysztof Szyper <45788587+ChristophShyper@users.noreply.github.com> Date: Mon, 21 Jul 2025 23:06:59 +0200 Subject: [PATCH 16/20] Update .github/WORKFLOWS.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .github/WORKFLOWS.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/WORKFLOWS.md b/.github/WORKFLOWS.md index 5e00332..fbf6070 100644 --- a/.github/WORKFLOWS.md +++ b/.github/WORKFLOWS.md @@ -7,8 +7,9 @@ This repository uses: Fully automated release creation with zero manual interven - ✅ 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 updatesmprehensive GitHub Actions setup with different workflows for different purposes. +- ✅ 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 From 675099172721751ab989a1cfdc2f77033650e9b0 Mon Sep 17 00:00:00 2001 From: Krzysztof Szyper <45788587+ChristophShyper@users.noreply.github.com> Date: Mon, 21 Jul 2025 23:39:52 +0200 Subject: [PATCH 17/20] Update .github/workflows/AUTO-VERSION.yml Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .github/workflows/AUTO-VERSION.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/AUTO-VERSION.yml b/.github/workflows/AUTO-VERSION.yml index 6ae0795..300a60f 100644 --- a/.github/workflows/AUTO-VERSION.yml +++ b/.github/workflows/AUTO-VERSION.yml @@ -70,7 +70,7 @@ jobs: echo "$COMMIT_MESSAGES" # Skip release for dependency and docs updates - if echo "$MERGED_BRANCHES" | grep -i "^dep\|^dependabot\|^docs\|/dep\|/docs"; then + if echo "$MERGED_BRANCHES" | grep -iE "^dep|^dependabot|^docs|/dep|/docs"; then echo "Skipping release for dependency/docs updates" echo "should_release=false" >> $GITHUB_OUTPUT exit 0 From 3093de9ca6828097c5ab89d319972bdbc90133d4 Mon Sep 17 00:00:00 2001 From: Krzysztof Szyper <45788587+ChristophShyper@users.noreply.github.com> Date: Mon, 21 Jul 2025 23:40:09 +0200 Subject: [PATCH 18/20] Update .github/workflows/AUTO-VERSION.yml Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .github/workflows/AUTO-VERSION.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/AUTO-VERSION.yml b/.github/workflows/AUTO-VERSION.yml index 300a60f..9171464 100644 --- a/.github/workflows/AUTO-VERSION.yml +++ b/.github/workflows/AUTO-VERSION.yml @@ -86,7 +86,7 @@ jobs: VERSION_TYPE="${{ github.event.inputs.release_type }}" if [ "$VERSION_TYPE" = "auto" ] || [ -z "$VERSION_TYPE" ]; then # Check for feat branches first (minor version bump - Y) - if echo "$MERGED_BRANCHES" | grep -i "^feat\|/feat"; then + if echo "$MERGED_BRANCHES" | grep -iE "^feat|/feat"; then VERSION_TYPE="minor" # Check for feat in commit messages as fallback elif echo "$COMMIT_MESSAGES" | grep -i "^feat\|feat:"; then From 67d335b1a568a398aea4ba196ad23a20bbce1065 Mon Sep 17 00:00:00 2001 From: Krzysztof Szyper <45788587+ChristophShyper@users.noreply.github.com> Date: Mon, 21 Jul 2025 23:41:04 +0200 Subject: [PATCH 19/20] Update .github/workflows/RELEASE.yml Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .github/workflows/RELEASE.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/RELEASE.yml b/.github/workflows/RELEASE.yml index ce2bf03..c4a8689 100644 --- a/.github/workflows/RELEASE.yml +++ b/.github/workflows/RELEASE.yml @@ -152,9 +152,9 @@ jobs: - name: Clean up release branch run: | # Check if the release branch exists before attempting to delete it - if git ls-remote --exit-code origin ${{ github.event.pull_request.head.ref }}; then - echo "Deleting branch ${{ github.event.pull_request.head.ref }}..." - git push origin --delete ${{ github.event.pull_request.head.ref }} + if git ls-remote --exit-code origin "${{ github.event.pull_request.head.ref }}"; then + echo "Deleting branch \"${{ github.event.pull_request.head.ref }}\"..." + git push origin --delete "${{ github.event.pull_request.head.ref }}" else echo "Branch ${{ github.event.pull_request.head.ref }} does not exist. Skipping deletion." fi From 713a861d47037629b1cd62c77fa794451d549782 Mon Sep 17 00:00:00 2001 From: Krzysztof Szyper <45788587+ChristophShyper@users.noreply.github.com> Date: Mon, 21 Jul 2025 23:41:25 +0200 Subject: [PATCH 20/20] Update README.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0f0d169..fb47fa4 100644 --- a/README.md +++ b/README.md @@ -220,7 +220,7 @@ This action follows a **fully automated release workflow** with zero manual inte - `patch`: All other changes (v0.10.2 → v0.10.3) 3. **Calculates next version** using semantic versioning 4. **Creates release branch** with version updates using own action -5. **PUSH-OTHER.yml creates the PR** automatically +5. **PUSH-OTHER.yml creates the PR** automatically 6. **Publishes when PR is merged** - Docker images, GitHub release, etc. ### 🚫 **Smart Release Filtering**