-
Notifications
You must be signed in to change notification settings - Fork 28
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
20 changed files
with
290 additions
and
94 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: 17 | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,4 +27,6 @@ replay_pid* | |
.idea/* | ||
.DS_Store | ||
*/build/* | ||
build | ||
build | ||
|
||
application.yml |
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.
Oops, something went wrong.