Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed dokkaJavadocJar Dependency, CHANGELOG.md & Improved Env Loader #90

Merged
merged 4 commits into from
Feb 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/gradle-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
SONATYPE_PASSWORD: '${{ secrets.SONATYPE_PASSWORD }}'
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
# Set environment
env: 'prod'
ENV: 'prod'
steps:
# Checkout the Code
- name: Checkout Code
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/gradle-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
# Set up environment variables
env:
env: 'local' # Set to local, so it won't deploy the jar to the repos
ENV: 'local' # Set to local, so it won't deploy the jar to the repos
steps:
# Checkout code
- name: Checkout Code
Expand Down
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
## v0.6.2 - Snapshot
* Improved .env loader
* Fixed "ENV" variable to be uppercase
* Fixed dokkaJavadocJar task dependency
* Fixed CHANGELOG.md

## v0.6.1 - Snapshot
* Added Maven Central Repository
* Updated SECURITY.md

## v0.6.0 - Snapshot
* Added Standalone support
* Improved velocity SoftwareType check
Expand Down
26 changes: 8 additions & 18 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,11 @@ plugins {
id("org.jetbrains.dokka") version "1.7.20"
}

val env = emptyMap<String, String>().toMutableMap()
env.putAll(System.getenv())
if(project.rootProject.file(".env").exists()) {
env.putAll(
project.rootProject
.file(".env")
.inputStream()
.bufferedReader()
.readLines()
.filter { it.isNotBlank() && !it.startsWith("#") }
.map { it.split("=") }
.associate { it[0] to it[1] }
)
}
val projectVersion = env["VERSION"] ?: "0.6.1-SNAPSHOT"
val env = project.rootProject.file(".env").let { file ->
if(file.exists()) file.readLines().filter { it.isNotBlank() && !it.startsWith("#") && it.split("=").size == 2 }.associate { it.split("=")[0] to it.split("=")[1] } else emptyMap()
}.toMutableMap().apply { putAll(System.getenv()) }

val projectVersion = env["VERSION"] ?: "0.6.2-SNAPSHOT"

group = "xyz.theprogramsrc"
version = projectVersion.replaceFirst("v", "").replace("/", "")
Expand All @@ -44,7 +34,7 @@ repositories {
}

dependencies {
compileOnly("org.spigotmc:spigot-api:1.19.2-R0.1-SNAPSHOT")
compileOnly("org.spigotmc:spigot-api:1.19.3-R0.1-SNAPSHOT")
compileOnly("net.md-5:bungeecord-api:1.19-R0.1-SNAPSHOT")
compileOnly("com.velocitypowered:velocity-api:3.1.2-SNAPSHOT")

Expand Down Expand Up @@ -130,14 +120,14 @@ configurations {
}

val dokkaJavadocJar by tasks.register<Jar>("dokkaJavadocJar") {
dependsOn(tasks.dokkaJavadoc)
dependsOn(tasks.dokkaJavadoc, tasks.dokkaHtml)
from(tasks.dokkaJavadoc.flatMap { it.outputDirectory })
archiveClassifier.set("javadoc")
}

publishing {
repositories {
if (env["env"] == "prod") {
if (env["ENV"] == "prod") {
if (env.containsKey("GITHUB_ACTOR") && env.containsKey("GITHUB_TOKEN")) {
maven {
name = "GithubPackages"
Expand Down