diff --git a/.github/workflows/hotfix.yml b/.github/workflows/hotfix.yml new file mode 100644 index 00000000..0f452166 --- /dev/null +++ b/.github/workflows/hotfix.yml @@ -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 \ No newline at end of file diff --git a/.github/workflows/on_pull_request.yml b/.github/workflows/pull_request.yml similarity index 87% rename from .github/workflows/on_pull_request.yml rename to .github/workflows/pull_request.yml index 840087f5..46622f65 100644 --- a/.github/workflows/on_pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -1,8 +1,10 @@ -name: Pull request +name: Pull Request on: pull_request: - branches: [ main ] + branches: + - 'main' + - 'hotfix/v*.*.*' jobs: build: @@ -23,7 +25,7 @@ jobs: distribution: 'temurin' cache: maven - - name: Check Style + - name: Check style run: mvn checkstyle:check - name: Build @@ -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: diff --git a/.github/workflows/on_push_main.yml b/.github/workflows/push_main.yml similarity index 93% rename from .github/workflows/on_push_main.yml rename to .github/workflows/push_main.yml index 7a020743..ba9282cd 100644 --- a/.github/workflows/on_push_main.yml +++ b/.github/workflows/push_main.yml @@ -1,8 +1,9 @@ -name: Continuous integration +name: Push Main on: push: - branches: [ main ] + branches: + - 'main' jobs: build: @@ -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 @@ -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: diff --git a/.github/workflows/tag.yml b/.github/workflows/tag.yml index 37d40b8a..bfddaf82 100644 --- a/.github/workflows/tag.yml +++ b/.github/workflows/tag.yml @@ -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