Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
6f7e549
ci: github action for automated releasing to stage (#445)
karel-rehor Sep 17, 2026
6b070df
chore: replace ossrh references with maven central.
karel-rehor Sep 18, 2026
6f4b4df
chore: prioritize pom version checks in on-release.sh
karel-rehor Sep 18, 2026
471133f
chore: add CRLF to error message.
karel-rehor Sep 18, 2026
4f67eac
Merge branch 'main' into ci/stage-automated-releasing
karel-rehor Sep 18, 2026
6676686
docs: fix PR number in CHANGELOG.md
karel-rehor Sep 18, 2026
efb0d75
docs: fix phantom space in CHANGELOG.md
karel-rehor Sep 18, 2026
7c64374
chore: workflow security fixes
karel-rehor Sep 21, 2026
7b42611
chore: start scm-settings.xml
karel-rehor Sep 21, 2026
1577811
chore: protect gpg-passphrase in workflow.
karel-rehor Sep 21, 2026
aada4b6
chore: add license to scm-settings.xml
karel-rehor Sep 21, 2026
54563a8
chore: switch repository secrets to environment secrets.
karel-rehor Sep 21, 2026
9c05e23
chore: remove tag filter for release event - not applicable to 'relea…
karel-rehor Sep 21, 2026
47afe9b
chore: revert workflow env back to secrets
karel-rehor Sep 21, 2026
994733a
chore: match envirionment in workflow to gerun releasing
karel-rehor Sep 21, 2026
a910045
build(deps): bump com.google.protobuf:protobuf-java (#447)
dependabot[bot] Sep 21, 2026
698050d
build(deps): bump github/codeql-action from 4.38.0 to 4.38.1 (#448)
dependabot[bot] Sep 21, 2026
33cfd77
Merge branch 'main' into ci/stage-automated-releasing
karel-rehor Sep 22, 2026
76c6be9
chore: fix changes to git operations after security fixes.
karel-rehor Sep 22, 2026
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
258 changes: 258 additions & 0 deletions .github/workflows/maven-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,258 @@
name: Maven Releasing

on:

release:
types: [published]

jobs:
release:
permissions:
contents: write # may want to update version
runs-on: ubuntu-latest
environment: releasing
env:
MAVEN_SETTINGS_EXPERIM: ${{ vars.MAVEN_SETTINGS_FILE }}
RELEASE_TAG_NAME: ${{ github.event.release.tag_name }}
IS_PRERELEASE: ${{ github.event.release.prerelease }}
GITHUB_REPO: ${{ github.repository }}
steps:
- name: Checkout
uses: actions/checkout@v6
Comment thread
karel-rehor marked this conversation as resolved.
with:
persist-credentials: false
- name: Setup JDK 21
uses: actions/setup-java@v5
with:
java-version: '21'
distribution: 'temurin'
cache: maven
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
- name: Add dependencies
run: |
sudo apt-get update
sudo apt-get -y install libxml2-utils
- name: Verify Env
env:
GPG_PASSPHRASE_PRELIM: ${{ secrets.GPG_PASSPHRASE }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
run: |
if [[ -z "${{ secrets.GPG_PRIVATE_KEY }}" ]]
then
echo "ERROR GPG_PRIVATE_KEY is missing."
exit 1
fi
# ensure scm properties match current project - don't want to modify other repository inadvertently
POM_SITE_URL=$(xmllint --xpath "//*[local-name()='distributionManagement']/*[local-name()='site']/*[local-name()='url']/text()" ./pom.xml)
POM_SCM_CONNECTION=$(xmllint --xpath "//*[local-name()='scm']/*[local-name()='connection']/text()" ./pom.xml)
POM_SCM_DEVELOPER_CONNECTION=$(xmllint --xpath "//*[local-name()='scm']/*[local-name()='developerConnection']/text()" ./pom.xml)

if [[ "${POM_SITE_URL}" != "scm:git:https://github.com/${GITHUB_REPOSITORY}" ]]
then
echo "POM_SITE_URL ${POM_SITE_URL} does not match GITHUB_REPOSITORY ${GITHUB_REPOSITORY}"
exit 1
else
echo "POM_SITE_URL OK ✓."
fi

if [[ ! "${POM_SCM_CONNECTION}" =~ .*${GITHUB_REPOSITORY}\.git$ ]]
then
echo "POM_SCM_CONNECTION ${POM_SCM_CONNECTION} does not match GITHUB_REPOSITORY ${GITHUB_REPOSITORY}"
exit 1
else
echo "POM_SCM_CONNECTION OK ✓."
fi

if [[ ! "${POM_SCM_DEVELOPER_CONNECTION}" =~ .*${GITHUB_REPOSITORY}\.git$ ]]
then
echo "POM_SCM_DEVELOPER_CONNECTION ${POM_SCM_DEVELOPER_CONNECTION} does not match GITHUB_REPOSITORY ${GITHUB_REPOSITORY}"
exit 1
else
echo "POM_SCM_DEVELOPER_CONNECTION OK ✓."
fi

if [[ -n "$SONATYPE_USERNAME" ]]
then
echo "have SONATYPE_USERNAME"
else
echo "Release requires SONATYPE_USERNAME, which was not found. exiting"
exit 1
fi

if [[ -n "$SONATYPE_PASSWORD" ]]
then
echo "have SONATYPE_PASSWORD"
else
echo "Release requires SONATYPE_PASSWORD, which was not found. exiting"
exit 1
fi

if [[ -n "$GPG_PASSPHRASE_PRELIM" ]]
then
echo "have GPG_PASSPHRASE_PRELIM"
else
echo "Release requires GPG_PASSPHRASE, which was not found. exiting"
exit 1
fi

# Verify GPG2 environment
if ! command -v gpg2 &> /dev/null
then
echo "Failed to locate gpg2 on this host. GPG2 is required to continue."
exit 1
fi

gpg2 --version
GPG_EXECUTABLE=$(command -v gpg2)
export GPG_EXECUTABLE
echo "GPG_EXECUTABLE=${GPG_EXECUTABLE}" >> "$GITHUB_ENV"

# Verify tag and next version
if ! echo "${RELEASE_TAG_NAME}" | grep -Ei '^v[0-9]+\.[0-9]+\.[0-9]+(-(rc|beta)[0-9]*)?$'
then
echo "RELEASE_TAG_NAME ${RELEASE_TAG_NAME} does not match expected pattern, e.g. (v1.9.0). Exiting."
exit 1
fi
VERSION_CLEAN="${RELEASE_TAG_NAME:1}"
# shellcheck disable=SC2206
PARTS=(${VERSION_CLEAN//./ })
# TODO Check if PARTS[2] starts with 0 or [1-9] if not 0 then this is hot release and should not trigger publishing
if ! echo "${PARTS[2]}" | grep -q "^0.*"
then
echo "Detected hot fix release ${RELEASE_TAG_NAME}"
echo "IS_HOT_FIX=true" >> "${GITHUB_ENV}"
fi
NEW_MINOR=$((PARTS[1]+1))
NEXT_RELEASE="${PARTS[0]}.${NEW_MINOR}.0"
echo "NEXT_RELEASE=${NEXT_RELEASE}" >> "${GITHUB_ENV}"
NEXT_RELEASE_BRANCH="ci/next-cycle-${NEXT_RELEASE}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
git config user.name "${GITHUB_ACTOR}"

if [[ "${IS_PRERELEASE}" != "true" && "${RELEASE_TAG_NAME,,}" =~ ^v[0-9]+\.[0-9]+\.0$ ]]
then
BRANCH_CHECK=$(git ls-remote --heads origin "refs/heads/${NEXT_RELEASE_BRANCH}")
if [ -n "${BRANCH_CHECK}" ]
then
echo "branch ${NEXT_RELEASE_BRANCH} already exists in project. Cannot recreate it automatically."
echo "If you wish to use this automatically created branch, please delete the existing branch and start the release again"
exit 1
fi
else
echo "Skipping next release cycle branch check because this is either a pre-release or a patch fix."
fi

echo "NEXT_RELEASE_BRANCH=${NEXT_RELEASE_BRANCH}" >> "$GITHUB_ENV"

- name: Script
run: |
. ./scripts/on-release.sh
echo "RC_OR_BETA=${RC_OR_BETA}" >> "$GITHUB_ENV"
- name: Release
env:
GPG_PASSPHRASE_PRELIM: ${{ secrets.GPG_PASSPHRASE }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
run: |
if [[ "${IS_PRERELEASE}" == "true" ]]; then
echo "This is a pre release and will not be deployed to Maven Central."
exit 0
fi
if [[ "${RC_OR_BETA}" == "true" ]]
then
echo "This is an RC or BETA release and will not be deployed to Maven Central."
exit 0
fi
if [[ "$GPG_PASSPHRASE_PRELIM" == "EMPTY" ]]; then
echo "GPG_PASSPHRASE empty requested"
GPG_PASSPHRASE=""
else
GPG_PASSPHRASE="$GPG_PASSPHRASE_PRELIM"
fi
export GPG_PASSPHRASE
cat << EOF > release.properties
scm.url=scm\:git\:https\://github.com/${GITHUB_REPOSITORY}.git
scm.tag=${RELEASE_TAG_NAME}
EOF
cat release.properties
mvn release:perform \
-Dgoals=deploy \
-s ./deploy-settings.xml \
-Darguments="-DskipTests -DskipITs -DperformRelease=true"
- name: Prepare next cycle
run: |
if [[ "${IS_PRERELEASE}" == "true" ]]; then
echo "This is a prerelease so the next release cycle will not be prepared."
exit 0
fi
if [[ "${RC_OR_BETA}" == "true" ]]
then
echo "This is an RC or BETA release so next release cycle will not be prepared."
exit 0
fi
if [[ "${IS_HOT_FIX}" == "true" ]]
then
echo "This is a hot fix release ${RELEASE_TAG_NAME}, so next release cycle will not be prepared."
exit 0
fi

echo "Preparing next release cycle"

git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
git config user.name "${GITHUB_ACTOR}"
echo "checking out next release branch ${NEXT_RELEASE_BRANCH}"
git checkout -b "${NEXT_RELEASE_BRANCH}"
mvn versions:set-scm-tag -DnewTag="HEAD"
mvn versions:set -DnextSnapshot=true -DnextSnapshotIndexToIncrement=1
sed -i "1s/^/## ${NEXT_RELEASE} [unreleased]\n\n/" CHANGELOG.md
sed -i -e "s/<version>${RELEASE_TAG_NAME:1}<\/version>/<version>${NEXT_RELEASE}-SNAPSHOT<\/version>/" examples/pom.xml
git add pom.xml examples/pom.xml CHANGELOG.md
git commit -m "ci: setting up release cycle ${NEXT_RELEASE}"
gh auth setup-git
git push --set-upstream origin "${NEXT_RELEASE_BRANCH}"
Comment thread
bednar marked this conversation as resolved.
# The following requires special permissions on the organizational and project level to work. Switching off for now.
# gh pr create -B main -H ${NEXT_RELEASE_BRANCH} --title "Merge ${NEXT_RELEASE_BRANCH} into main" --body 'Created by GitHub action'
# The alternative is to create the PR by hand
echo "The branch ${NEXT_RELEASE_BRANCH} has been created. You can create and merge a PR manually from it to start the next release cycle."
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Prepare documentation
run: |
if [[ "${IS_PRERELEASE}" == "true" ]]; then
echo "This is a pre release, so site documentation will not be updated to GitHub pages."
exit 0
fi
if [[ "${RC_OR_BETA}" == "true" ]]
then
echo "This is an RC or BETA release, so site documentation will not be updated to GitHub pages."
exit 0
fi
if [[ "${IS_HOT_FIX}" == "true" ]]
then
echo "This is a hot fix release ${RELEASE_TAG_NAME}, so site documentation will not be updated to GitHub pages."
exit 0
fi
git checkout "${RELEASE_TAG_NAME}"
mvn clean site site:stage -DskipTests
- name: Publish documentation
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if [[ "${IS_PRERELEASE}" == "true" ]]; then
echo "This is a pre release, so site documentation will not be updated to GitHub pages."
exit 0
fi
if [[ "${RC_OR_BETA}" == "true" ]]
then
echo "This is an RC or BETA release, so site documentation will not be updated to GitHub pages."
exit 0
fi
if [[ "${IS_HOT_FIX}" == "true" ]]
then
echo "This is a hot fix release ${RELEASE_TAG_NAME}, so site documentation will not be updated to GitHub pages."
exit 0
fi
git config --global user.email "${GITHUB_ACTOR}@noreply.github.com"
git config --global user.name "GitHub Action"
mvn -s scm-settings.xml --batch-mode scm-publish:publish-scm -Dscmpublish.serverId=github
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
## 1.12.0 [unreleased]

### CI

1. [#446](https://github.com/InfluxCommunity/influxdb3-java/pull/446): Sets up automated releasing to Maven Central

### Documentation

1. [#439](https://github.com/InfluxCommunity/influxdb3-java/pull/439): Fix unresolved variables in generated site documentation.
Expand Down
Loading
Loading