Skip to content
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
21 changes: 17 additions & 4 deletions .github/workflows/on_push_master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,17 @@ on:

jobs:
build:
name: Build
runs-on: ubuntu-latest
outputs:
current_version: ${{ steps.metadata.outputs.current_version }}
steps:
- uses: actions/checkout@v5
- name: Checkout repository
uses: actions/checkout@v5
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- uses: actions/setup-java@v5
- name: Set up Java to JDK 11
uses: actions/setup-java@v5
with:
distribution: 'adopt'
java-version: '11'
Expand All @@ -25,8 +30,16 @@ jobs:
- name: Lint with Gradle
run: ./gradlew spotlessCheck
- name: Build and analyze
run: ./gradlew build
- uses: actions/upload-artifact@v5
run: ./gradlew build --info

- name: Publish test report
if: always()
uses: mikepenz/action-junit-report@v5
with:
report_paths: '**/build/test-results/test/TEST-*.xml'

- name: Upload build artifacts
uses: actions/upload-artifact@v5
with:
name: kafka-connect-plugins
path: ${{ github.workspace }}/build/libs/*.jar
44 changes: 34 additions & 10 deletions .github/workflows/on_push_tag.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,57 @@
name: Release
on:
push:
tags: [ '*' ]
tags:
- 'v*.*.*'

jobs:
build:
name: Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Checkout repository
uses: actions/checkout@v5
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- uses: actions/setup-java@v5

- name: Set up Java to JDK 11
uses: actions/setup-java@v5
with:
distribution: 'adopt'
java-version: '11'

- name: Cache Gradle packages
uses: actions/cache@v4
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle

- name: Build and analyze
run: ./gradlew build
- name: Prepare Release
uses: softprops/action-gh-release@v2
run: ./gradlew build -x test --info

- name: Metadata
id: metadata
run: |
CURRENT_VERSION=$(./gradlew properties --no-daemon --console=plain -q | grep "^version:" | awk '{printf $2}')
LATEST_VERSION=$(git tag -l --sort=-version:refname | head -1 | cut -d 'v' -f 2)
echo current_version=$(echo $CURRENT_VERSION) >> $GITHUB_OUTPUT
echo is_latest_version=$(echo $(test "$LATEST_VERSION" == "$CURRENT_VERSION" && echo true || echo false)) >> $GITHUB_OUTPUT

- name: Generate release changelog
uses: mikepenz/release-changelog-builder-action@v5
id: build_changelog
with:
draft: true
prerelease: true
files: |
build/libs/*.jar
configuration: changelog-builder.json
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Create release
uses: ncipollo/release-action@v1.20.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
body: ${{ steps.build_changelog.outputs.changelog }}
artifacts: build/libs/michelin-connect-plugins-${{ steps.metadata.outputs.current_version }}.jar
draft: true
prerelease: true
allowUpdates: true
48 changes: 48 additions & 0 deletions .github/workflows/tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Tag

on:
workflow_dispatch:
inputs:
release_version:
description: 'Release version'
required: true

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

- name: Set up Java to JDK 11
uses: actions/setup-java@v5
with:
distribution: 'adopt'
java-version: '11'

- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}
git_user_signingkey: true
git_commit_gpgsign: true

- name: Validate release version format
run: |
if [[ ! "${{ github.event.inputs.release_version }}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Release version must follow SemVer format (X.Y.Z) and start with a digit"
echo "Current value: ${{ github.event.inputs.release_version }}"
echo "Expected format: 1.2.3, 2.0.0, etc."
echo "Note: The 'v' prefix will be added automatically to the tag. Do not include it manually"
exit 1
fi

- name: Create tag
run: |
git tag v${{ github.event.inputs.release_version }} -s -m "Create tag v${{ github.event.inputs.release_version }}"
git push origin v${{ github.event.inputs.release_version }}
48 changes: 48 additions & 0 deletions changelog-builder.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"categories": [
{
"title": "## :sparkles: New features",
"labels": [
"feature"
]
},
{
"title": "## :bug: Bug fixes",
"labels": [
"bug"
]
},
{
"title": "## :zap: Improvements",
"labels": [
"enhancement"
]
},
{
"title": "## :memo: Documentation",
"labels": [
"documentation"
]
},
{
"title": "## :arrow_up: Dependency updates",
"labels": [
"dependencies"
]
},
{
"title": "## :test_tube: Tests",
"labels": [
"test"
]
},
{
"title": "## :green_heart: CI/CD",
"labels": [
"ci/cd"
]
}
],
"template": "${{CHANGELOG}}\n\n<details>\n<summary>Uncategorized</summary>\n\n${{UNCATEGORIZED}}\n</details>",
"pr_template": "- ${{TITLE}} by @${{AUTHOR}} in #${{NUMBER}}"
}