feat: add workflow to publish extension to maven
This commit is contained in:
parent
4ae1f9a720
commit
df2718b530
2 changed files with 58 additions and 1 deletions
35
.forgejo/workflows/publish.yml
Normal file
35
.forgejo/workflows/publish.yml
Normal file
|
@ -0,0 +1,35 @@
|
|||
name: Push plugin to maven
|
||||
|
||||
on:
|
||||
release:
|
||||
types:
|
||||
- published
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
~/.gradle/caches
|
||||
~/.gradle/wrapper
|
||||
key: gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
|
||||
restore-keys: |
|
||||
gradle-
|
||||
- name: Set up JDK
|
||||
uses: github.com/actions/setup-java@v1
|
||||
with:
|
||||
java-version: 21
|
||||
|
||||
- name: Grant execute permission for gradlew
|
||||
run: chmod +x gradlew
|
||||
|
||||
- name: Build and publish with gradle
|
||||
run: ./gradlew publish
|
||||
env:
|
||||
MAVEN_URL: ${{ secrets.MAVEN_URL }}
|
||||
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
|
||||
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
|
|
@ -1,9 +1,10 @@
|
|||
plugins {
|
||||
id("java")
|
||||
id("maven-publish")
|
||||
}
|
||||
|
||||
group = "gay.shorks"
|
||||
version = "1.0-SNAPSHOT"
|
||||
version = "1.0.0+kc.24"
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
|
@ -14,3 +15,24 @@ dependencies {
|
|||
implementation(libs.keycloak.server.spi)
|
||||
implementation(libs.keycloak.services)
|
||||
}
|
||||
|
||||
publishing {
|
||||
publications.create<MavenPublication>("maven") {
|
||||
from(components["java"])
|
||||
}
|
||||
|
||||
repositories {
|
||||
if (System.getenv("MAVEN_URL") != null) {
|
||||
maven {
|
||||
name = "ashhhleyyy"
|
||||
setUrl(System.getenv("MAVEN_URL"))
|
||||
credentials {
|
||||
username = System.getenv("MAVEN_USERNAME")
|
||||
password = System.getenv("MAVEN_PASSWORD")
|
||||
}
|
||||
}
|
||||
} else {
|
||||
mavenLocal()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue