-
Notifications
You must be signed in to change notification settings - Fork 1
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
18 changed files
with
1,217 additions
and
201 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,71 @@ | ||
name: Publish | ||
on: | ||
push: | ||
release: | ||
types: [ published ] | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
env: | ||
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} | ||
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }} | ||
LAVALINK_MAVEN_USERNAME: ${{ secrets.LAVALINK_MAVEN_USERNAME }} | ||
LAVALINK_MAVEN_PASSWORD: ${{ secrets.LAVALINK_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 -PLAVALINK_MAVEN_USERNAME=$LAVALINK_MAVEN_USERNAME -PLAVALINK_MAVEN_PASSWORD=$LAVALINK_MAVEN_PASSWORD | ||
|
||
- name: Upload main Artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: LavaQueue.jar | ||
path: main/build/libs/lavaqueue-*.jar | ||
|
||
- name: Upload plugin Artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: LavaQueue-Plugin.jar | ||
path: plugin/build/libs/lavaqueue-plugin-*.jar | ||
|
||
release: | ||
needs: build | ||
runs-on: ubuntu-latest | ||
if: github.event_name == 'release' | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Download main Artifact | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: LavaQueue.jar | ||
|
||
- name: Download plugin Artifact | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: LavaQueue-Plugin.jar | ||
|
||
- name: Upload Artifacts to GitHub Release | ||
uses: ncipollo/release-action@v1 | ||
with: | ||
artifacts: lavaqueue-*.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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.idea/ | ||
.gradle/ | ||
build/ | ||
application.yml | ||
logs/ |
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,84 @@ | ||
import java.io.ByteArrayOutputStream | ||
|
||
plugins { | ||
`maven-publish` | ||
id("org.jetbrains.kotlin.jvm") version "1.9.0" apply false | ||
id("org.jetbrains.kotlin.plugin.serialization") version "1.9.0" apply false | ||
} | ||
|
||
val (gitVersion, release) = versionFromGit() | ||
logger.lifecycle("Version: $gitVersion (release: $release)") | ||
|
||
allprojects { | ||
group = "com.github.topi314.lavaqueue" | ||
|
||
version = gitVersion | ||
|
||
repositories { | ||
mavenLocal() | ||
mavenCentral() | ||
maven("https://maven.arbjerg.dev/releases") | ||
maven("https://maven.arbjerg.dev/snapshots") | ||
maven("https://jitpack.io") | ||
jcenter() | ||
} | ||
} | ||
|
||
val isMavenDefined = findProperty("MAVEN_USERNAME") != null && findProperty("MAVEN_PASSWORD") != null | ||
val isLavalinkMavenDefined = findProperty("LAVALINK_MAVEN_USERNAME") != null && findProperty("LAVALINK_MAVEN_PASSWORD") != null | ||
subprojects { | ||
apply<MavenPublishPlugin>() | ||
|
||
configure<PublishingExtension> { | ||
if (isMavenDefined) { | ||
repositories { | ||
val snapshots = "https://maven.topi.dev/snapshots" | ||
val releases = "https://maven.topi.dev/releases" | ||
|
||
maven(if (release) releases else snapshots) { | ||
credentials { | ||
password = findProperty("MAVEN_PASSWORD") as String? | ||
username = findProperty("MAVEN_USERNAME") as String? | ||
} | ||
} | ||
} | ||
} | ||
if (isLavalinkMavenDefined && name === "main") { | ||
repositories { | ||
val snapshots = "https://maven.lavalink.dev/snapshots" | ||
val releases = "https://maven.lavalink.dev/releases" | ||
|
||
maven(if (release) releases else snapshots) { | ||
credentials { | ||
password = findProperty("LAVALINK_MAVEN_PASSWORD") as String? | ||
username = findProperty("LAVALINK_MAVEN_USERNAME") as String? | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
fun versionFromGit(): Pair<String, Boolean> { | ||
var versionStr = ByteArrayOutputStream() | ||
var result = exec { | ||
standardOutput = versionStr | ||
isIgnoreExitValue = true | ||
commandLine = listOf("git", "describe", "--exact-match", "--tags") | ||
} | ||
if (result.exitValue == 0) { | ||
return Pair(versionStr.toString().trim(), true) | ||
} | ||
|
||
versionStr = ByteArrayOutputStream() | ||
result = exec { | ||
standardOutput = versionStr | ||
isIgnoreExitValue = true | ||
commandLine = listOf("git", "rev-parse", "--short", "HEAD") | ||
} | ||
if (result.exitValue != 0) { | ||
throw GradleException("Failed to get git version") | ||
} | ||
|
||
return Pair(versionStr.toString().trim(), false) | ||
} |
Binary file not shown.
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,5 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
Oops, something went wrong.