-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
264 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
name: Publish | ||
on: | ||
push: | ||
release: | ||
types: [ published ] | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
env: | ||
MAVEN_USERNAME: ${{ vars.MAVEN_USERNAME }} | ||
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Setup Java | ||
uses: actions/setup-java@v3 | ||
with: | ||
distribution: zulu | ||
java-version: 11 | ||
cache: gradle | ||
|
||
- name: Setup Gradle | ||
uses: gradle/gradle-build-action@v2 | ||
|
||
- name: Build and Publish | ||
run: ./gradlew build publish --no-daemon -PMAVEN_USERNAME=$MAVEN_USERNAME -PMAVEN_PASSWORD=$MAVEN_PASSWORD | ||
|
||
- name: Upload common Artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: youtube-common.jar | ||
path: common/build/libs/youtube-common-*.jar | ||
|
||
- name: Upload lldevs Artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: youtube-v2.jar | ||
path: v2/build/libs/youtube-v2-*.jar | ||
|
||
- name: Upload plugin Artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: youtube-plugin.jar | ||
path: plugin/build/libs/youtube-plugin-*.jar | ||
|
||
release: | ||
needs: build | ||
runs-on: ubuntu-latest | ||
if: github.event_name == 'release' | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Download youtube-common Artifact | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: youtube-common.jar | ||
|
||
- name: Download youtube-v2 Artifact | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: youtube-v2.jar | ||
|
||
- name: Download youtube-plugin Artifact | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: youtube-plugin.jar | ||
|
||
- name: Upload Artifacts to GitHub Release | ||
uses: ncipollo/release-action@v1 | ||
with: | ||
artifacts: '*.jar' | ||
allowUpdates: true | ||
omitBodyDuringUpdate: true | ||
omitDraftDuringUpdate: true | ||
omitNameDuringUpdate: true | ||
omitPrereleaseDuringUpdate: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,72 @@ | ||
import org.ajoberstar.grgit.Grgit | ||
|
||
plugins { | ||
java | ||
`maven-publish` | ||
id("org.ajoberstar.grgit") version "5.2.0" | ||
alias(libs.plugins.maven.publish.base) apply false | ||
} | ||
|
||
group = "dev.lavalink.youtube" | ||
version = "1.0.7" | ||
val (gitVersion, release) = versionFromGit() | ||
logger.lifecycle("Version: $gitVersion (release: $release)") | ||
|
||
allprojects { | ||
group = rootProject.group | ||
version = rootProject.version | ||
group = "dev.lavalink.youtube" | ||
// The plugin project is the only one that should not have a snapshot version since lavalink expects the jar name to be specific | ||
version = if (project.name == "plugin") { | ||
gitVersion.removeSuffix("-SNAPSHOT") | ||
} else { | ||
gitVersion | ||
} | ||
|
||
|
||
repositories { | ||
mavenLocal() | ||
mavenCentral() | ||
maven(url = "https://maven.lavalink.dev/releases") | ||
maven(url = "https://jitpack.io") | ||
} | ||
} | ||
|
||
apply(plugin = "java") | ||
apply(plugin = "maven-publish") | ||
subprojects { | ||
apply<JavaPlugin>() | ||
apply<MavenPublishPlugin>() | ||
|
||
java { | ||
configure<JavaPluginExtension> { | ||
sourceCompatibility = JavaVersion.VERSION_1_8 | ||
targetCompatibility = JavaVersion.VERSION_1_8 | ||
} | ||
|
||
dependencies { | ||
implementation("org.mozilla:rhino-engine:1.7.14") | ||
implementation("com.grack:nanojson:1.7") | ||
compileOnly("org.slf4j:slf4j-api:1.7.25") | ||
compileOnly("org.jetbrains:annotations:24.1.0") | ||
configure<PublishingExtension> { | ||
if (findProperty("MAVEN_PASSWORD") != null && findProperty("MAVEN_USERNAME") != null) { | ||
repositories { | ||
val snapshots = "https://maven.lavalink.dev/snapshots" | ||
val releases = "https://maven.lavalink.dev/releases" | ||
|
||
maven(if (release) releases else snapshots) { | ||
credentials { | ||
password = findProperty("MAVEN_PASSWORD") as String? | ||
username = findProperty("MAVEN_USERNAME") as String? | ||
} | ||
} | ||
} | ||
} else { | ||
logger.lifecycle("Not publishing to maven.lavalink.dev because credentials are not set") | ||
} | ||
} | ||
} | ||
|
||
@SuppressWarnings("GrMethodMayBeStatic") | ||
fun versionFromGit(): Pair<String, Boolean> { | ||
Grgit.open(mapOf("currentDir" to project.rootDir)).use { git -> | ||
val headTag = git.tag | ||
.list() | ||
.find { it.commit.id == git.head().id } | ||
|
||
val clean = git.status().isClean || System.getenv("CI") != null | ||
if (!clean) { | ||
logger.lifecycle("Git state is dirty, version is a snapshot.") | ||
} | ||
|
||
return if (headTag != null && clean) headTag.name to true else "${git.head().id}-SNAPSHOT" to false | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,24 @@ | ||
import com.vanniktech.maven.publish.JavaLibrary | ||
import com.vanniktech.maven.publish.JavadocJar | ||
|
||
plugins { | ||
`java-library` | ||
`maven-publish` | ||
alias(libs.plugins.maven.publish.base) | ||
} | ||
|
||
val moduleName = "common" | ||
base { | ||
archivesName = "youtube-common" | ||
} | ||
|
||
dependencies { | ||
compileOnly("dev.arbjerg:lavaplayer:1.5.3") | ||
} | ||
compileOnly(libs.lavaplayer.v1) | ||
|
||
val sourcesJar by tasks.registering(Jar::class) { | ||
archiveClassifier.set("sources") | ||
from(sourceSets["main"].allSource) | ||
implementation(libs.rhino.engine) | ||
implementation(libs.nanojson) | ||
compileOnly(libs.slf4j) | ||
compileOnly(libs.annotations) | ||
} | ||
|
||
publishing { | ||
publications { | ||
create<MavenPublication>("mavenJava") { | ||
from(components["java"]) | ||
artifactId = moduleName | ||
artifact(sourcesJar) | ||
} | ||
} | ||
} | ||
mavenPublishing { | ||
configure(JavaLibrary(JavadocJar.Javadoc())) | ||
} |
Empty file.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,39 @@ | ||
import com.vanniktech.maven.publish.JavaLibrary | ||
import com.vanniktech.maven.publish.JavadocJar | ||
|
||
plugins { | ||
`java-library` | ||
`maven-publish` | ||
alias(libs.plugins.lavalink.gradle.plugin) | ||
alias(libs.plugins.maven.publish.base) | ||
} | ||
|
||
val moduleName = "plugin" | ||
lavalinkPlugin { | ||
name = "youtube-plugin" | ||
path = "dev.lavalink.youtube.plugin" | ||
apiVersion = libs.versions.lavalink | ||
serverVersion = "4.0.4" | ||
configurePublishing = false | ||
} | ||
|
||
base { | ||
archivesName = "youtube-plugin" | ||
} | ||
|
||
dependencies { | ||
implementation(project(":common")) | ||
implementation(project(":lldevs")) | ||
compileOnly("dev.arbjerg.lavalink:plugin-api:3.7.11") | ||
compileOnly("dev.arbjerg.lavalink:Lavalink-Server:3.7.11") | ||
compileOnly("dev.arbjerg:lavaplayer-ext-youtube-rotator:1.5.3") | ||
implementation(projects.common) | ||
implementation(projects.v2) | ||
compileOnly(libs.lavalink.server) | ||
compileOnly(libs.lavaplayer.ext.youtube.rotator) | ||
compileOnly(libs.slf4j) | ||
compileOnly(libs.annotations) | ||
} | ||
|
||
java { | ||
sourceCompatibility = JavaVersion.VERSION_11 | ||
targetCompatibility = JavaVersion.VERSION_11 | ||
} | ||
|
||
val sourcesJar by tasks.registering(Jar::class) { | ||
archiveClassifier.set("sources") | ||
from(sourceSets["main"].allSource) | ||
} | ||
|
||
tasks.jar { | ||
dependsOn(project(":common").tasks.jar) | ||
dependsOn(project(":lldevs").tasks.jar) | ||
from(configurations.runtimeClasspath.get().map(::zipTree)) | ||
duplicatesStrategy = DuplicatesStrategy.WARN | ||
} | ||
|
||
publishing { | ||
publications { | ||
create<MavenPublication>("mavenJava") { | ||
from(components["java"]) | ||
artifactId = moduleName | ||
artifact(sourcesJar) | ||
} | ||
} | ||
} | ||
mavenPublishing { | ||
coordinates("dev.lavalink.youtube", "youtube-plugin", version.toString()) | ||
configure(JavaLibrary(JavadocJar.None(), sourcesJar = false)) | ||
} |
3 changes: 0 additions & 3 deletions
3
plugin/src/main/resources/lavalink-plugins/youtube.properties
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.