Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
72 changes: 72 additions & 0 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Publish Nightly Build

on:
schedule:
- cron: '10 7 * * *'
workflow_dispatch:

jobs:
should-build-change:
runs-on: ubuntu-latest
outputs:
repo-cache-hit: ${{ steps.cache-last-commit.outputs.cache-hit }}
steps:
- name: Fetch Sources
uses: actions/checkout@v4
- run: |
git rev-parse HEAD >> lastCommit
- name: Check New Changes
id: cache-last-commit
uses: actions/cache@v4
with:
path: lastCommit
key: lastCommit-${{ hashFiles('lastCommit') }}

release-snapshot-job:
needs: should-build-change
if: ${{ needs.should-build-change.outputs.repo-cache-hit != 'true' || github.event_name != 'schedule' }}
name: Publish Snapshot
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
# Check out current repository
- name: Fetch Sources
uses: actions/checkout@v4

# Set up Java environment for the next steps
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 17
cache: 'gradle'

# Setup Gradle
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4

# Build plugin
- name: Build Plugin
run: ./gradlew build

# Publish to Maven repo
- name: Checkout Maven Repo
uses: actions/checkout@v4
with:
ref: repository
path: mvn-repo

- name: Deploy to Maven Repository
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
CURRENT_VERSION=$(grep "projectVersion=" gradle.properties | cut -d'=' -f2)
./gradlew publish

git config --global user.email "[email protected]"
git config --global user.name "GitHub Action Bot"
mv build/repository mvn-repo
git commit -am "Publish ${CURRENT_VERSION} (${{github.run_number}})"
git push -f origin repository
107 changes: 107 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
name: Release
run-name: Release ${{ inputs.release_version }}

#Only one job at a time
concurrency: release

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

jobs:
release:
name: Publish
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
# Check out current repository
- name: Fetch Sources
uses: actions/checkout@v4

# Set up Java environment for the next steps
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 17
cache: 'gradle'

# Setup Gradle
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4

- name: Tag Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config user.email "[email protected]"
git config user.name "GitHub Action"
if git diff --quiet; then
echo "No changes to commit."
else
git commit -sam "chore(skip-release): set version to ${{ inputs.release_version }}"
fi
git tag ${{ inputs.release_version }}
git push origin ${{ inputs.release_version }}

- name: Set Release Version
shell: bash
run: |
CURRENT_VERSION=$(grep "projectVersion=" gradle.properties | cut -d'=' -f2)
NEW_VERSION=${{ inputs.release_version }}
awk -v current="$CURRENT_VERSION" -v new="$NEW_VERSION" 'BEGIN {FS=OFS="="} $1 == "projectVersion" { $2 = new }1' gradle.properties > tmpfile && mv tmpfile gradle.properties
echo "Release version: $NEW_VERSION"
echo "PLUGIN_VERSION=${NEW_VERSION}" >> $GITHUB_ENV

# Publish the plugin to local release repo
- name: Publish Library
run: |
./gradlew publish
echo "Published $PLUGIN_VERSION."

# Set next SNAPSHOT version
- name: Increment Plugin Version
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
CURRENT_VERSION=$(grep "projectVersion=" gradle.properties | cut -d'=' -f2)
IFS="-" read -ra VERSION_PARTS <<< "$CURRENT_VERSION"
IFS="." read -ra VERSION_NUM <<< "${VERSION_PARTS[0]}"
((VERSION_NUM[2]+=1))
NEW_VERSION="${VERSION_NUM[0]}.${VERSION_NUM[1]}.${VERSION_NUM[2]}-SNAPSHOT"
awk -v new_version="$NEW_VERSION" '/projectVersion=/{sub(/=.*/, "=" new_version)}1' gradle.properties > tmpfile && mv tmpfile gradle.properties
echo "Set $NEW_VERSION in gradle.properties"
git checkout -b $NEW_VERSION
git commit -sam "chore(skip-release): set version to $NEW_VERSION"
git push -u origin $NEW_VERSION

- name: Simple conventional changelog
uses: redhat-developer/simple-conventional-changelog@0a6db1ac3910c2cf66f2e1a530951dba1ece8540 #0.0.12
id: changelog
with:
token: ${{ secrets.GITHUB_TOKEN }}
current-tag: ${{ inputs.release_version }}
types-mapping: 'feat:Features,fix:Bug Fixes,docs:Documentation,refactor:Refactoring,build:Build,chore:Other'

# Create a new GitHub release
- name: Create GitHub Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create ${{ inputs.release_version }} \
--title "${{ inputs.release_version }}" \
--notes "$(cat << 'EOM'
${{ steps.changelog.outputs.changelog }}
EOM
)"

- name: Upload Release Asset
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release upload ${{ inputs.release_version }} ./build/libs/*.jar
29 changes: 0 additions & 29 deletions Jenkinsfile

This file was deleted.

15 changes: 5 additions & 10 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
plugins {
id("java-library")
id("maven-publish")
alias(libs.plugins.gradleNexusPublishPlugin)
id("jacoco") // Code coverage
alias(libs.plugins.sonarqube) // SonarQube
}
Expand Down Expand Up @@ -89,16 +88,12 @@ publishing {
}
}
}
}

nexusPublishing {
packageGroup.set("JBoss Releases Staging Profile")
repositories {
create("jbossNexus") {
nexusUrl.set(uri("https://repository.jboss.org/nexus/service/local/"))
snapshotRepositoryUrl.set(uri("https://repository.jboss.org/nexus/content/repositories/snapshots/"))
username.set(project.properties["nexusUser"].toString()) // defaults to project.properties["myNexusUsername"]
password.set(project.properties["nexusPassword"].toString()) // defaults to project.properties["myNexusPassword"]
maven {
val baseUrl = layout.buildDirectory.dir("repository/").get()
val releasesRepoUrl = baseUrl.dir("releases")
val snapshotsRepoUrl = baseUrl.dir("snapshots")
url = uri(if (version.toString().endsWith("SNAPSHOT")) snapshotsRepoUrl else releasesRepoUrl)
}
}
}
2 changes: 0 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
projectVersion=0.4.4-SNAPSHOT
nexusUser=invalid
nexusPassword=invalid

# Gradle Releases -> https://github.com/gradle/gradle/releases
gradleVersion=8.5
2 changes: 0 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ kotlin = "2.1.0"
junit-jupiter = "5.11.3"

# plugins
gradleNexusPublishPlugin = "2.0.0"
sonarqube = "5.1.0.4882"

[libraries]
Expand All @@ -15,5 +14,4 @@ remote-robot = { group = "com.intellij.remoterobot", name = "remote-robot", vers
remote-fixtures = { group = "com.intellij.remoterobot", name = "remote-fixtures", version.ref = "remote-robot" }

[plugins]
gradleNexusPublishPlugin = { id = "io.github.gradle-nexus.publish-plugin", version.ref = "gradleNexusPublishPlugin" }
sonarqube = { id = "org.sonarqube", version.ref = "sonarqube" }