Add gitea publish workflow
All checks were successful
Build & Release / release-library (push) Successful in 3m37s

This commit is contained in:
2025-06-27 17:14:25 +02:00
parent e07d758f50
commit 19243b4707
4 changed files with 146 additions and 24 deletions

View File

@ -0,0 +1,38 @@
name: Build & Release
on:
push:
tags:
- '[0-9]+.[0-9]+.[0-9]+'
env:
ORG_GRADLE_PROJECT_BUILD_VERSION: ${{ gitea.ref_name }}
ORG_GRADLE_PROJECT_DEVSOAP_DEPLOY_TOKEN: ${{ secrets.DEVSOAP_DEPLOY_TOKEN }}
RUNNER_TOOL_CACHE: /toolcache
jobs:
release-library:
runs-on: node20
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ssh-key: ${{ secrets.SSH_JOHN_PRIVATE_KEY }}
- name: Configure Java project
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21'
cache: 'gradle'
- name: Cache Java dependencies
uses: actions/cache@v4
env:
cache-name: cache-java-dependencies
with:
path: ~/.gradle
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/build.gradle') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Upload to Devsoap Code
run: ./gradlew publishMavenJavaPublicationToDSCodeRepository

View File

@ -0,0 +1,33 @@
/**
* This is an example Gradle build file for demonstrating how to use the plugin in a theme project
*
* You can use this as a base when building your Keycloak theme with webjars
*/
apply plugin: 'java-library'
configurations {
webjar
}
dependencies {
// Examples of how to include webjars (these are not required to build the extension)
webjar 'org.webjars.npm:hyperscript.org:0.9.8'
webjar 'org.webjars.npm:htmx.org:1.9.2'
webjar 'org.webjars:uikit:3.17.9'
}
/**
* Example task to compose the provider plugin and all webjars into a single directory that can be mounted (or copy &
* pasted) into the Keycloak docker image. See docker-compose.yml for example.
*/
tasks.register("composeProviders", Copy) {
group = 'keycloak'
from project.configurations.webjar
from project.tasks.jar
into project.layout.buildDirectory.dir("providers")
duplicatesStrategy "exclude"
doFirst{
delete project.layout.buildDirectory.dir("providers")
}
}

View File

@ -13,24 +13,18 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
apply plugin: 'java-library'
configurations {
webjar
plugins {
id 'java-library'
id 'maven-publish'
}
repositories {
mavenCentral()
maven { url "https://code.devsoap.com/api/packages/john/maven" }
}
dependencies {
// Keycloak extension dependencies
compileOnly "org.keycloak:keycloak-services:${keycloakVersion}"
// Examples of how to include webjars (these are not required to build the extension)
webjar 'org.webjars.npm:hyperscript.org:0.9.8'
webjar 'org.webjars.npm:htmx.org:1.9.2'
webjar 'org.webjars:uikit:3.17.9'
}
java {
@ -39,17 +33,4 @@ java {
}
}
/**
* Composes the provider plugin and all webjars into a single directory that can be mounted (or copy & pasted) into
* the Keycloak docker image. See docker-compose.yml for example.
*/
tasks.register("composeProviders", Copy) {
group = 'keycloak'
from project.configurations.webjar
from project.tasks.jar
into project.layout.buildDirectory.dir("providers")
duplicatesStrategy "exclude"
doFirst{
delete project.layout.buildDirectory.dir("providers")
}
}
apply from: 'publish.gradle'

70
publish.gradle Normal file
View File

@ -0,0 +1,70 @@
/**
Copyright (c) 2024 John Ahlroos
Creative Commons Attribution-NoDerivatives 4.0 International Public License
By exercising the Licensed Rights (defined below), You accept and agree
to be bound by the terms and conditions of this Creative Commons
Attribution-NoDerivatives 4.0 International Public License ("Public
License"). To the extent this Public License may be interpreted as a
contract, You are granted the Licensed Rights in consideration of Your
acceptance of these terms and conditions, and the Licensor grants You
such rights in consideration of benefits the Licensor receives from
making the Licensed Material available under these terms and
conditions.
Refer to LICENSE file or https://creativecommons.org/licenses/by-nd/4.0 for full license.
*/
ext {
devsoapToken = findProperty("DEVSOAP_DEPLOY_TOKEN") as String
}
publishing {
repositories {
maven {
name = "DSCode"
url = uri("https://code.devsoap.com/api/packages/john/maven")
credentials(HttpHeaderCredentials) {
name = "Authorization"
value = "token ${devsoapToken}"
}
authentication {
header(HttpHeaderAuthentication)
}
}
}
publications {
mavenJava(MavenPublication) {
from components.java
pom {
groupId = 'com.devsoap'
name = 'keycloak-webjar-provider'
description = 'Keycloak Provider for including Webjar assets'
url = 'https://code.devsoap.com/john/keycloak.-webjar-provider'
licenses {
license {
name = 'Apache 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0'
}
}
scm {
url = 'https://code.devsoap.com/john/keycloak-webjar-provider'
connection = 'scm:git://code.devsoap.com/john/keycloak-webjar-provider.git'
developerConnection = 'scm:git://code.devsoap.com/john/keycloak-webjar-provider.git'
}
developers {
developer {
id = 'john'
name = 'John Ahlroos'
email = 'john@devsoap.com'
organizationUrl = 'https://devsoap.com'
}
}
}
}
}
}