From 06565b79d01eb71188ab6d78866b51f8cb1b0a68 Mon Sep 17 00:00:00 2001 From: ChristophShyper <45788587+ChristophShyper@users.noreply.github.com> Date: Wed, 13 Aug 2025 21:04:37 +0200 Subject: [PATCH] Update action versions --- .github/workflows/pull-request.yml | 2 +- .github/workflows/release.yml | 51 +++++++++++++- Dockerfile | 2 +- README.md | 107 ++--------------------------- 4 files changed, 57 insertions(+), 105 deletions(-) diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 0fed90d..5fa0a4b 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -77,7 +77,7 @@ jobs: curl -LsS https://raw.githubusercontent.com/devops-infra/.github/master/PULL_REQUEST_TEMPLATE.md -o .tmp/PULL_REQUEST_TEMPLATE.md - name: Create Pull Request - uses: devops-infra/action-pull-request@v0.6.1 + uses: devops-infra/action-pull-request@v0.6 with: github_token: ${{ secrets.GITHUB_TOKEN }} assignee: ${{ github.actor }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d33fe29..3c474e2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -36,7 +36,7 @@ jobs: fi echo "✅ Version $VERSION is available" - - name: Create and push tag + - name: Create and push full tag run: | VERSION="${{ github.event.inputs.version }}" git config user.name "github-actions[bot]" @@ -44,6 +44,55 @@ jobs: git tag -a "$VERSION" -m "$VERSION" git push origin "$VERSION" + - name: Extract version components + id: version + run: | + VERSION="${{ github.event.inputs.version }}" + # Remove 'v' prefix and split version + VERSION_NO_V="${VERSION#v}" + MAJOR=$(echo "$VERSION_NO_V" | cut -d. -f1) + MINOR=$(echo "$VERSION_NO_V" | cut -d. -f2) + + echo "major=v$MAJOR" >> $GITHUB_OUTPUT + echo "minor=v$MAJOR.$MINOR" >> $GITHUB_OUTPUT + echo "✅ Extracted versions - Major: v$MAJOR, Minor: v$MAJOR.$MINOR" + + - name: Create/update major version tag + run: | + MAJOR_TAG="${{ steps.version.outputs.major }}" + + # Check if major tag exists + if git tag -l | grep -q "^${MAJOR_TAG}$"; then + echo "ℹ️ Major tag $MAJOR_TAG exists, updating it" + git tag -d "$MAJOR_TAG" || true + git push origin ":refs/tags/$MAJOR_TAG" || true + else + echo "✅ Major tag $MAJOR_TAG is new" + fi + + # Create/update major tag + git tag -a "$MAJOR_TAG" -m "Major version $MAJOR_TAG" + git push origin "$MAJOR_TAG" + echo "✅ Created/updated major tag: $MAJOR_TAG" + + - name: Create/update minor version tag + run: | + MINOR_TAG="${{ steps.version.outputs.minor }}" + + # Check if minor tag exists + if git tag -l | grep -q "^${MINOR_TAG}$"; then + echo "ℹ️ Minor tag $MINOR_TAG exists, updating it" + git tag -d "$MINOR_TAG" || true + git push origin ":refs/tags/$MINOR_TAG" || true + else + echo "✅ Minor tag $MINOR_TAG is new" + fi + + # Create/update minor tag + git tag -a "$MINOR_TAG" -m "Minor version $MINOR_TAG" + git push origin "$MINOR_TAG" + echo "✅ Created/updated minor tag: $MINOR_TAG" + - name: Docker Buildx uses: docker/setup-buildx-action@v3 with: diff --git a/Dockerfile b/Dockerfile index a6af928..44964ca 100644 --- a/Dockerfile +++ b/Dockerfile @@ -44,7 +44,7 @@ ARG AUTHOR="Krzysztof Szyper / ChristophShyper / biotyk@mail.com" ARG HOMEPAGE="https://shyper.pro" ARG BUILD_DATE=2020-04-01T00:00:00Z ARG VCS_REF=abcdef1 -ARG VERSION=v0.0 +ARG VERSION LABEL \ com.github.actions.name="${NAME}" \ com.github.actions.author="${AUTHOR}" \ diff --git a/README.md b/README.md index fb47fa4..2c9431f 100644 --- a/README.md +++ b/README.md @@ -200,120 +200,24 @@ When using `amend: true`, you have several options for handling the commit messa **💡 Note:** Amending works even without file changes - useful for just changing commit messages! -## 🚀 Release Process - -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) -- **Automatic releases**: Triggered by pushes to master - no manual steps required! -- **Weekly builds**: Automated test builds run weekly and push test images - -### 🤖 Fully Automated Releases - -**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: - - `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) -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 -# 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" - -# 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" -# 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** → **Minor version bump** (v0.10.2 → v0.11.0) - ```bash - git checkout -b feat/new-feature - # When merged to master → minor version bump - ``` - -- **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 → 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: - -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:** -- ✅ 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 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: devops-infra/action-commit-push@v0.11 ``` + Uses a specific version. More predictable but requires manual updates. @@ -350,7 +254,6 @@ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file ## 🔗 Related Actions - [devops-infra/action-pull-request](https://github.com/devops-infra/action-pull-request) - Create pull requests automatically -- [devops-infra/.github](https://github.com/devops-infra/.github) - Shared GitHub configuration and templates ## 💬 Support