From 6686e988369b6fcddb48029bb637e0f64402dea8 Mon Sep 17 00:00:00 2001 From: Pyrbu Date: Mon, 19 Jun 2023 13:45:32 +0200 Subject: [PATCH] switch from using gradle.properties to enviroment variables for repository auth --- .gitignore | 2 -- api/build.gradle | 12 ++++++------ 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index 14a95dd..bb5a603 100644 --- a/.gitignore +++ b/.gitignore @@ -44,5 +44,3 @@ bin/ /plugin/run/ /.idea/ - -gradle.properties diff --git a/api/build.gradle b/api/build.gradle index ce72828..1804836 100644 --- a/api/build.gradle +++ b/api/build.gradle @@ -22,13 +22,13 @@ publishing { } repositories { maven { - if (properties.containsKey("DIST_USERNAME") && properties.containsKey("DIST_PASSWORD")) { - credentials { - username properties.get("DIST_USERNAME") - password properties.get("DIST_PASSWORD") - } + Map systemProperties = System.getenv() + credentials { + if (systemProperties.containsKey("DIST_USERNAME")) username systemProperties.get("DIST_USERNAME") + if (systemProperties.containsKey("DIST_PASSWORD")) password systemProperties.get("DIST_PASSWORD") } - url = uri("https://repo.pyr.lol/releases/") + // If the BUILD_ID enviroment variable is present that means its a Jenkins build & that it should go into the snapshots repo + url = systemProperties.containsKey("BUILD_ID") ? uri("https://repo.pyr.lol/snapshots/") : uri("https://repo.pyr.lol/releases/") } } } \ No newline at end of file