From 919a5af1142ff40eaebd6493d9faa97785f0bdc5 Mon Sep 17 00:00:00 2001
From: Tucker Siegel <tgsiegel@terpmail.umd.edu>
Date: Sun, 26 Mar 2023 01:14:59 -0400
Subject: [PATCH] makefile

---
 Makefile          |  6 ++++++
 build.gradle      | 23 +++++++++++++++++++++++
 gradle.properties |  4 +++-
 3 files changed, 32 insertions(+), 1 deletion(-)
 create mode 100644 Makefile

diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..f969aec
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,6 @@
+TAG := $(shell git describe --tags)
+
+dist:
+	sed -i "s/CHANGE_ME/${GITLAB_DEPLOY_TOKEN}/g" gradle.properties
+	sed -i "s/CHANGE_ME/${TAG}/g" build.gradle
+	gradlew publish
\ No newline at end of file
diff --git a/build.gradle b/build.gradle
index f514c7e..2284c60 100644
--- a/build.gradle
+++ b/build.gradle
@@ -6,6 +6,7 @@ buildscript {
 
 plugins {
     id 'java'
+    id 'maven-publish'
     id 'org.springframework.boot' version '3.0.4'
     id 'io.spring.dependency-management' version '1.1.0'
     id "io.freefair.lombok" version "8.0.0-rc2"
@@ -16,6 +17,7 @@ apply plugin: 'com.palantir.java-format'
 
 group = 'edu.umd.dawn'
 sourceCompatibility = '17'
+version = 'CHANGE_ME'
 
 repositories {
     mavenCentral()
@@ -39,4 +41,25 @@ tasks.named('test') {
 
 configurations {
     all*.exclude module : 'spring-boot-starter-logging'
+}
+
+
+publishing {
+    publications {
+        library(MavenPublication) {
+            from components.java
+        }
+    }
+    repositories {
+        maven {
+            url "https://gitlab.com/api/v4/projects/28471/packages/maven"
+            credentials(HttpHeaderCredentials) {
+                name = "deploy-token"
+                value = gitlabDeployToken // the token is stored in ~/.gradle/gradle.properties
+            }
+            authentication {
+                header(HttpHeaderAuthentication)
+            }
+        }
+    }
 }
\ No newline at end of file
diff --git a/gradle.properties b/gradle.properties
index 6c8ce48..9c85ffc 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -3,4 +3,6 @@ org.gradle.jvmargs=--add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNN
                     --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED \
                     --add-exports=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED \
                     --add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED \
-                    --add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED 
\ No newline at end of file
+                    --add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED 
+
+gitlabDeployToken=CHANGE_ME
\ No newline at end of file
-- 
GitLab