Skip to content

Bump version

Bump version #21

Workflow file for this run

name: Create Release and Publish Artifacts
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout the code
uses: actions/checkout@v2
- name: Set up Java 11
uses: actions/setup-java@v2
with:
java-version: '17'
distribution: 'zulu'
- name: Cache Maven dependencies
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Build with Maven
run: mvn clean install -DskipTests
- name: Extract version from pom.xml using sed
id: version
run: |
VERSION=$(sed -n 's/.*<version>\([^<]*\)<\/version>.*/\1/p' pom.xml | head -n 1)
echo "Extracted VERSION: $VERSION"
if [[ -z "$VERSION" ]]; then
echo "Failed to extract version from pom.xml"
exit 1
fi
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Check if the version already exists
id: check_release
run: |
RELEASE_EXISTS=$(gh release view ${{ env.VERSION }} --json tagName --jq '.tagName' || echo "")
echo "Release exists: $RELEASE_EXISTS"
if [[ -n "$RELEASE_EXISTS" ]]; then
echo "Release already exists. Skipping..."
exit 0
fi
- name: Create GitHub Release
id: create_release
run: |
gh release create ${{ env.VERSION }} target/*.jar --title "Release ${{ env.VERSION }}" --notes "Release created automatically from GitHub Actions"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload JARs as artifacts
uses: actions/upload-artifact@v4
with:
name: keycloakify-logging-artifacts
path: target/*.jar