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
48 changes: 39 additions & 9 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
name: Release to Maven Central
name: Increment Version and Release

on:
push:
tags:
- 'v*.*.*'
branches:
- main
paths-ignore:
- 'gradle.properties'

jobs:
release:
bump-and-release:
runs-on: ubuntu-latest
permissions:
contents: write

steps:
- name: Checkout
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0
Expand All @@ -20,9 +25,34 @@ jobs:
java-version: '21'
distribution: 'temurin'

- name: Extract Version
id: vars
run: echo "tag_version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
- name: Bump Version and Push Tag
id: versioning
run: |
# Extract current version
VERSION_LINE=$(grep "release.version=" gradle.properties)
CURRENT_VERSION=$(echo $VERSION_LINE | cut -d'=' -f2)
BASE_VERSION=${CURRENT_VERSION%-SNAPSHOT}
RELEASE_TAG="v$BASE_VERSION"

# Calculate next snapshot
NEXT_VERSION=$(echo $BASE_VERSION | awk -F. '{$NF = $NF + 1;} 1' OFS=. | sed 's/$/-SNAPSHOT/')

# Update file
sed -i "s/release.version=.*/release.version=$NEXT_VERSION/" gradle.properties

# Git config
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"

# Commit, Tag, and Push
git add gradle.properties
git commit -m "chore: bump version to $NEXT_VERSION [skip ci]"
git tag -a "$RELEASE_TAG" -m "Release $RELEASE_TAG"
git push origin main --tags

# Pass variables to next steps
echo "release_version=$BASE_VERSION" >> $GITHUB_OUTPUT
echo "release_tag=$RELEASE_TAG" >> $GITHUB_OUTPUT

- name: Stage Artifacts
run: ./gradlew publish
Expand All @@ -31,4 +61,4 @@ jobs:
env:
JRELEASER_MAVENCENTRAL_USERNAME: ${{ secrets.MAVENCENTRAL_USERNAME }}
JRELEASER_MAVENCENTRAL_PASSWORD: ${{ secrets.MAVENCENTRAL_PASSWORD }}
run: ./gradlew jreleaserDeploy -Prelease.version=${{ steps.vars.outputs.tag_version }}
run: ./gradlew jreleaserDeploy -Prelease.version=${{ steps.versioning.outputs.release_version }}
45 changes: 0 additions & 45 deletions .github/workflows/version-increase.yaml

This file was deleted.

Loading