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
118 changes: 118 additions & 0 deletions .github/workflows/create_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
#
# Copyright 2026 Aiven Oy and project contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
# SPDX-License-Identifier: Apache-2.0


name: Create release

on:
workflow_dispatch:
inputs:
commit_hash:
description: "Hash of 'Release version x.y.z' commit"
required: true

permissions:
contents: write
pull-requests: write
issues: write

jobs:
build:
name: Create Release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
ref: ${{ github.event.inputs.commit_hash }}

- name: Extract version info
run: |
export version=$(mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec);
echo "version=${version}" >> $GITHUB_OUTPUT;
echo "java_version=$(mvn -q -Dexec.executable=echo -Dexec.args='${jdk.version}' --non-recursive exec:exec)" >> $GITHUB_OUTPUT;
export release_version=$(mvn -q -Dexec.executable=echo -Dexec.args='${latestRelease}' --non-recursive exec:exec);
if [[ "${release_version}" == "${version}" ]]
then
echo "Creating draft release for ${release_version}"
echo "release_version=${release_version}" >> $GITHUB_OUTPUT;
else
echo "Invalid 'latestRelease' in pom. ${release_version} != ${version}"
exit 1
fi
export commit_title=$(git log --pretty=format:%s -1)
echo "Commit title: $commit_title"
if [[ ${commit_title} == "Release version ${release_version}" ]]; then
echo "release_hash=$(git rev-list -n 1 v${release_version})" >> $GITHUB_OUTPUT
else
echo "Invalid commit title: "${commit_title}
exit 1
fi

if [[ `grep -c "^## " CHANGE_LOG.md` -gt 1 ]]
then
grep -B 999 -m2 "^## " CHANGE_LOG.md | head -n -1 > /tmp/release_body.txt
else
cp CHANGE_LOG.md /tmp/release_body.txt
fi
id: project

- name: Create tag
run: |
git config --local user.name "GitHub Action"
git config --local user.email "action@github.com"
git tag -a "v${{ steps.project.outputs.version }}" -m "Release version ${{ steps.project.outputs.version }}"
git push origin "v${{ steps.project.outputs.version }}"

- name: Set up JDK ${{ steps.project.outputs.java_version }}
uses: actions/setup-java@v5
with:
distribution: 'adopt'
java-version: ${{ steps.project.outputs.java_version }}
cache: 'maven'

- name: Setup Maven settings.xml
uses: s4u/maven-settings-action@v4.0.0
with:
sonatypeSnapshots: false
servers: |
[{
"id": "central",
"username": "${{ secrets.SONATYPE_ID }}",
"password": "${{ secrets.SONATYPE_PASSWORD }}"
}]

- name: Publish ${{ steps.project.outputs.release_version }}
run: mvn -P sign -P publish -e -B -V -ntp -Dgpg.signer=bc deploy
env:
MAVEN_GPG_KEY: ${{ secrets.GPG_KEY }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSWORD }}

- name: Create release draft
id: create_release
uses: softprops/action-gh-release@v2.6.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: "v${{ steps.project.outputs.release_version }}"
target_commitish: ${{ github.event.inputs.commit_hash }}
draft: true
prerelease: false
files: target/*.jar
body_path: /tmp/release_body.txt

102 changes: 102 additions & 0 deletions .github/workflows/create_release_pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
#
# Copyright 2026 Aiven Oy and project contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
# SPDX-License-Identifier: Apache-2.0

name: Create release PR
on:
workflow_dispatch:
inputs:
release_version:
description: "Release version '0.1.2' (without 'v')"
required: true
snapshot_version:
description: "Next SNAPSHOT version '0.2.0-SNAPSHOT' (without 'v')"
required: true

permissions:
contents: write
pull-requests: write
issues: write

jobs:
create_release_pr:
name: Create release PR (job)
runs-on: ubuntu-latest
steps:
- name: Check versions
run: |
echo "Checking release version..."
if echo ${{ github.event.inputs.release_version }} | grep '^[0-9]+\.[0-9]+\.[0-9]+\(-\(alpha\|beta\|rc[0-9]\+\)\)\?\$' > /dev/null; then
echo "Release version is invalid"
exit 1
fi

echo "Checking snapshot version..."
if echo ${{ github.event.inputs.snapshot_version }} | grep '^[0-9]+\.[0-9]+\.[0-9]+-SNAPSHOT\$' > /dev/null; then
echo "Snapshot version is invalid"
exit 1
fi

- name: Checkout main
uses: actions/checkout@v6
with:
ref: main
fetch-depth: 0

- name: Extract version info
run: |
echo "version=$(mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec)" >> $GITHUB_OUTPUT;
echo "java_version=$(mvn -q -Dexec.executable=echo -Dexec.args='${jdk.version}' --non-recursive exec:exec)" >> $GITHUB_OUTPUT;
echo "# DO NOT SQUASH COMMITS" > /tmp/release_body.txt
if [[ `grep -c "^## " CHANGE_LOG.md` -gt 1 ]]
then
grep -B 999 -m2 "^## " CHANGE_LOG.md | head -n -1 >> /tmp/release_body.txt
else
cat CHANGE_LOG.md >> /tmp/release_body.txt
fi
id: project

- name: Set up Java ${{ steps.project.outputs.java_version }}
uses: actions/setup-java@v5
with:
distribution: 'adopt'
java-version: ${{ steps.project.outputs.java_version }}
cache: maven

- name: Create release commits
run: |
git config --local user.name "GitHub Action"
git config --local user.email "action@github.com"
mvn -e -B -V -ntp versions:set -DgenerateBackupPoms=false -DnewVersion=${{ github.event.inputs.release_version }} versions:set-property -Dproperty=latestRelease enforcer:enforce -Denforcer.rules=requireReleaseDeps
git add pom.xml
git commit -m "Release version ${{ github.event.inputs.release_version }}"
git tag -a "v${{ steps.project.outputs.version }}" -m "Release version ${{ steps.project.outputs.version }}"

mvn -e -B -V -ntp versions:set -DgenerateBackupPoms=false -DnewVersion=${{ github.event.inputs.snapshot_version }}
git add pom.xml
git commit -m "Bump version to ${{ github.event.inputs.snapshot_version }}"

- name: Create Pull Request
uses: peter-evans/create-pull-request@v8
with:
sign-commits: true
branch: release-${{ github.event.inputs.release_version }}
delete-branch: true
draft: true
title: Release version ${{ github.event.inputs.release_version }}
body-path: /tmp/releaseg_body.txt

17 changes: 17 additions & 0 deletions CHANGE_LOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
## v0.1.0
### What is changed

- Add EnumValidator fixed UrlValidator (#27)
- Add capability to hide config from documentation by using the internal config flag
- By default filtering out internal configuration
- Add setting ConfigDefBean with a property file (#38)

### Co-authored by

- Aindriu Lavelle
- Claude Warren
- Ryan Skraba


### Full Changelog
https://github.com/Aiven-Open/aiven-commons/compare/commons-1...v0.1.0
62 changes: 57 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<groupId>io.aiven.commons</groupId>
<artifactId>aiven-commons</artifactId>
<version>3-SNAPSHOT</version>
<version>3</version>
</parent>

<artifactId>kafka-config</artifactId>
Expand Down Expand Up @@ -87,7 +87,8 @@
</distributionManagement>

<properties>
<aiven.util.version>0.1.0-SNAPSHOT</aiven.util.version>
<latestRelease>none</latestRelease>
<aiven.util.version>0.1.0</aiven.util.version>
</properties>

<dependencyManagement>
Expand Down Expand Up @@ -272,19 +273,70 @@
</build>
<profiles>
<profile>
<id>release</id>
<id>publish</id>
<build>
<plugins>
<plugin>
<groupId>org.sonatype.central</groupId>
<artifactId>central-publishing-maven-plugin</artifactId>
<version>0.9.0</version>
<extensions>true</extensions>
<configuration>
<publishingServerId>central-snapshot</publishingServerId>
<publishingServerId>central</publishingServerId>
<ignorePublishedComponents>true</ignorePublishedComponents>
<centralSnapshotsUrl>https://central.sonatype.com/repository/maven-snapshots</centralSnapshotsUrl>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.6.2</version>
<executions>
<execution>
<id>enforce-versions</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireReleaseDeps>
<message>No Snapshots Allowed!</message>
</requireReleaseDeps>
<requireReleaseVersion>
<message>No Snapshots Allowed!</message>
</requireReleaseVersion>
</rules>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<!-- used to verify that there are no SNAPSHOT dependencies -->
<id>pre-release-check</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.6.2</version>
<executions>
<execution>
<id>enforce-versions</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireReleaseDeps>
<message>No Snapshots Allowed!</message>
</requireReleaseDeps>
</rules>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
Expand Down
Loading