Skip to content

Commit

Permalink
feat: initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
duruer committed Jul 12, 2024
1 parent d455a82 commit 0c2bc4d
Show file tree
Hide file tree
Showing 13 changed files with 746 additions and 0 deletions.
81 changes: 81 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle

name: Parsek Auth Register Notify Webhook Plugin Release

on:
push:
branches: [ "dev", "main" ]

permissions:
contents: read

jobs:
get-next-version:
runs-on: ubuntu-latest
permissions:
contents: write # to be able to publish a GitHub release
issues: write # to be able to comment on released issues
pull-requests: write # to be able to comment on released pull requests
id-token: write # to enable use of OIDC for npm provenance
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v3
with:
node-version: "lts/*"

- name: Dry run to get next release version
id: get-next-version
run: |
export NEXT_TAG_VERSION=$(npx semantic-release --dry-run | grep 'next release version is ' | awk -F"next release version is " '{print $2}')
echo "new_tag_version=${NEXT_TAG_VERSION}" >> $GITHUB_OUTPUT
env:
GITHUB_TOKEN: ${{ secrets.TOKEN_GITHUB }}

- name: Echo new_tag_version
run: |
echo "Extracted Tag Version: ${{ steps.get-next-version.outputs.new_tag_version }}"
env:
GITHUB_TOKEN: ${{ secrets.TOKEN_GITHUB }}
outputs:
new_tag_version: ${{ steps.get-next-version.outputs.new_tag_version }}

build-and-release:
runs-on: ubuntu-latest
needs: get-next-version
if: ${{needs.get-next-version.outputs.new_tag_version != ''}}
permissions:
contents: write # to be able to publish a GitHub release
issues: write # to be able to comment on released issues
pull-requests: write # to be able to comment on released pull requests
id-token: write # to enable use of OIDC for npm provenance
steps:
- uses: actions/checkout@v4

- uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 8

- name: Build with Gradle
uses: gradle/actions/setup-gradle@v3
with:
arguments: |
build
-Pversion=${{ needs.get-next-version.outputs.new_tag_version }}
-PtimeStamp=${{ steps.time.outputs.time }}
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: "lts/*"

- name: Release
env:
GITHUB_TOKEN: ${{ secrets.TOKEN_GITHUB }}
run: npx semantic-release
16 changes: 16 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
.gradle
.idea
.vertx
build
.directory

config.json
config.conf

/*.jar

.docker

file-uploads

clickhouse/database
29 changes: 29 additions & 0 deletions .releaserc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"branches": [
{
"name": "dev",
"prerelease": true
},
"main"
],
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
[
"@semantic-release/github",
{
"assets": [
{
"path": "build/libs/*.jar",
"label": false
},
{
"path": "LICENSE",
"label": false
}
]
}
]
],
"repositoryUrl": "https://github.com/StatuParsek/parsek-plugin-auth-register-notify-webhook.git"
}
118 changes: 118 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
plugins {
kotlin("jvm") version "1.9.20"
kotlin("kapt") version "1.9.20"
id("com.github.johnrengelman.shadow") version "8.1.1"
`maven-publish`
}

group = "co.statu.rule"
version =
(if (project.hasProperty("version") && project.findProperty("version") != "unspecified") project.findProperty("version") else "local-build")!!

val pf4jVersion: String by project
val vertxVersion: String by project
val springContextVersion: String by project

val bootstrap = (project.findProperty("bootstrap") as String?)?.toBoolean() ?: false
val pluginsDir: File? by rootProject.extra

repositories {
mavenCentral()
maven("https://jitpack.io")
}

dependencies {
if (bootstrap) {
compileOnly(project(mapOf("path" to ":Parsek")))
compileOnly(project(mapOf("path" to ":plugins:parsek-plugin-auth")))
compileOnly(project(mapOf("path" to ":plugins:parsek-plugin-database")))
} else {
compileOnly("com.github.StatuParsek:Parsek:main-SNAPSHOT")
compileOnly("com.github.StatuParsek:parsek-plugin-auth:v2.4.2")
compileOnly("com.github.StatuParsek:parsek-plugin-database:v1.2.1")
}

compileOnly(kotlin("stdlib-jdk8"))

compileOnly("org.pf4j:pf4j:${pf4jVersion}")
kapt("org.pf4j:pf4j:${pf4jVersion}")

compileOnly("io.vertx:vertx-web:$vertxVersion")
compileOnly("io.vertx:vertx-lang-kotlin:$vertxVersion")
compileOnly("io.vertx:vertx-lang-kotlin-coroutines:$vertxVersion")
compileOnly("io.vertx:vertx-jdbc-client:$vertxVersion")
compileOnly("io.vertx:vertx-json-schema:$vertxVersion")
compileOnly("io.vertx:vertx-web-client:$vertxVersion")
compileOnly("io.vertx:vertx-web-client:$vertxVersion")

// https://mvnrepository.com/artifact/org.springframework/spring-context
compileOnly("org.springframework:spring-context:$springContextVersion")
}

tasks {
shadowJar {
val pluginId: String by project
val pluginClass: String by project
val pluginProvider: String by project
val pluginDependencies: String by project

manifest {
attributes["Plugin-Class"] = pluginClass
attributes["Plugin-Id"] = pluginId
attributes["Plugin-Version"] = version
attributes["Plugin-Provider"] = pluginProvider
attributes["Plugin-Dependencies"] = pluginDependencies
}

archiveFileName.set("$pluginId-$version.jar")

dependencies {
exclude(dependency("io.vertx:vertx-core"))
exclude {
it.moduleGroup == "io.netty" || it.moduleGroup == "org.slf4j"
}
}
}

register("copyJar") {
pluginsDir?.let {
doLast {
copy {
from(shadowJar.get().archiveFile.get().asFile.absolutePath)
into(it)
}
}
}

outputs.upToDateWhen { false }
mustRunAfter(shadowJar)
}

jar {
enabled = false
dependsOn(shadowJar)
dependsOn("copyJar")
}
}

publishing {
repositories {
maven {
name = "parsek-plugin-auth-register-notify-webhook"
url = uri("https://maven.pkg.github.com/StatuParsek/parsek-plugin-auth-register-notify-webhook")
credentials {
username = project.findProperty("gpr.user") as String? ?: System.getenv("USERNAME_GITHUB")
password = project.findProperty("gpr.token") as String? ?: System.getenv("TOKEN_GITHUB")
}
}
}

publications {
create<MavenPublication>("shadow") {
project.extensions.configure<com.github.jengelman.gradle.plugins.shadow.ShadowExtension> {
artifactId = "parsek-plugin-auth-register-notify-webhook"
component(this@create)
}
}
}
}
10 changes: 10 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version=1.0.0
pluginId=parsek-plugin-auth-register-notify-webhook
pluginClass=co.statu.rule.plugins.registerNotifyWebhook.RegisterNotifyWebhookPlugin
pluginProvider=Rule
pluginDependencies=parsek-plugin-database, parsek-plugin-auth
pf4jVersion=3.10.0
vertxVersion=4.5.1
gsonVersion=2.10.1
handlebarsVersion=4.3.1
springContextVersion=5.3.33
Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
7 changes: 7 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit 0c2bc4d

Please sign in to comment.