Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle hotfix branch #281

Merged
merged 1 commit into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
32 changes: 32 additions & 0 deletions .github/workflows/hotfix.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Hotfix

on:
workflow_dispatch:
inputs:
tag_version:
description: 'Tag version'
required: true

jobs:
create-branch:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
steps:
- name: Checkout project
uses: actions/checkout@v4
with:
token: ${{ secrets.CI_CD_TOKEN }}

- name: Create hotfix branch
run: |
START_TAG=v${{ github.event.inputs.tag_version }}
echo "Start from tag $START_TAG"
MAJOR_MINOR_DIGIT=$(echo "$START_TAG" | cut -d '.' -f 1-2)
PATCH_DIGIT=$(echo "$START_TAG" | cut -d '.' -f 3)
NEW_PATCH_DIGIT=$((PATCH_DIGIT + 1))
HOTFIX_VERSION="${MAJOR_MINOR_DIGIT}.${NEW_PATCH_DIGIT}"
HOTFIX_BRANCH_NAME="hotfix/$HOTFIX_VERSION"
echo "Create hotfix branch $HOTFIX_BRANCH_NAME"
git fetch --all
git checkout tags/$START_TAG -b $HOTFIX_BRANCH_NAME
git push origin $HOTFIX_BRANCH_NAME
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
name: Pull request
name: Pull Request

on:
pull_request:
branches: [ main ]
branches:
- 'main'
- 'hotfix/v*.*.*'

jobs:
build:
Expand All @@ -23,7 +25,7 @@ jobs:
distribution: 'temurin'
cache: maven

- name: Check Style
- name: Check style
run: mvn checkstyle:check

- name: Build
Expand All @@ -32,7 +34,7 @@ jobs:
- name: Test
run: mvn test

- name: Publish Test Report
- name: Publish test report
if: always()
uses: mikepenz/action-junit-report@v4
with:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
name: Continuous integration
name: Push Main

on:
push:
branches: [ main ]
branches:
- 'main'

jobs:
build:
Expand All @@ -28,7 +29,7 @@ jobs:
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE

- name: Check Style
- name: Check style
run: mvn checkstyle:check

- name: Build
Expand All @@ -40,7 +41,7 @@ jobs:
- name: Test
run: mvn test

- name: Publish Test Report
- name: Publish test report
if: always()
uses: mikepenz/action-junit-report@v4
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
jobs:
tag:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/hotfix/v')
steps:
- name: Checkout project
uses: actions/checkout@v4
Expand Down