Skip to content
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
37 changes: 37 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# .github/workflows/publish.yml
name: Publish
on:
release:
types: [released, prereleased]

jobs:
publish:
name: Release build and publish
runs-on: macOS-latest
permissions:
contents: read
packages: write
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 21
- name: Publish SNAPSHOT to snapshot repo
if: github.event.action == 'prereleased'
run: ./gradlew publishAllPublicationsToSnapshotsRepository --no-configuration-cache
env:
GITHUB_ACTOR: ${{ github.actor }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Publish release to Maven Central
if: github.event.action == 'released'
run: ./gradlew publishToMavenCentral --no-configuration-cache
env:
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.SIGNING_KEY_ID }}
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSWORD }}
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.GPG_KEY_CONTENTS }}
71 changes: 45 additions & 26 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,28 +1,20 @@
plugins {
java
application
id("com.github.johnrengelman.shadow") version "8.1.1"
id("maven-publish")
id("com.gradleup.shadow") version "9.4.3"
id("com.vanniktech.maven.publish") version "0.37.0"
}

group = "igs-landstuhl"
group = "io.github.learn-monitor"

version = "v2.0.0-SNAPSHOT-2"
version = "s2607b1-SNAPSHOT"

application {
mainClass.set("de.igslandstuhl.database.Application")
}

repositories {
mavenCentral()
maven {
name = "Plugin Loader Repository"
url = uri("https://maven.pkg.github.com/Learn-Monitor/plugin-loader/")
credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
}
}
}

dependencies {
Expand All @@ -37,12 +29,15 @@ dependencies {
implementation("ch.qos.logback:logback-classic:1.5.6")

// built-in plugins
implementation("de.igs-landstuhl:plugin-loader:v1.0.5")
implementation("io.github.learn-monitor:plugin-loader:v1.0.5")

testImplementation("org.junit.jupiter:junit-jupiter:5.13.4") // using JUnit 5 (latest)
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
}

tasks.javadoc {
classpath = sourceSets.main.get().compileClasspath
}
tasks.test {
useJUnitPlatform()
systemProperty("test.environment", "true")
Expand All @@ -67,25 +62,49 @@ java {
}
}

publishing {
publications {
create<MavenPublication>("mavenJava") {
from(components["java"])
mavenPublishing {
publishToMavenCentral()

groupId = "igs-landstuhl"
artifactId = "student-database"
version = project.version.toString()
signAllPublications()

coordinates(group.toString(), "student-database", version.toString())

pom {
name = "Student database"
description = "A Java-based application designed to manage and store student information efficiently. It allows admins to perform CRUD (Create, Read, Update, Delete) operations on student records, classes, subjects, and other school-related data, making it a valuable tool for educational institutions. Students can view their progress, and teachers can assign them topics, based on subjects."
url = "https://github.com/Learn-Monitor/student-database"

licenses {
license {
name = "GNU General Public License v3.0"
url = "http://www.gnu.org/licenses/gpl-3.0.txt"
}
}
developers {
developer {
id = "schlaumeier5"
name = "Lukas Morgenstern"
url = "https://github.com/schlaumeier5"
}
}
scm {
url = "https://github.com/Learn-Monitor/student-database"
connection = "scm:git:https://github.com/Learn-Monitor/student-database.git"
developerConnection = "scm:git:ssh://[email protected]/Learn-Monitor/student-database.git"
}
}

}
tasks.withType<AbstractPublishToMaven>().configureEach {
dependsOn(tasks.withType<Sign>())
}
publishing {
repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/Learn-Monitor/student-database/")

name = "snapshots"
url = uri("https://maven.pkg.github.com/Learn-Monitor/student-database")
credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
username = System.getenv("GITHUB_ACTOR") ?: findProperty("gpr.user") as String?
password = System.getenv("GITHUB_TOKEN") ?: findProperty("gpr.key") as String?
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.6.0-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
184 changes: 92 additions & 92 deletions gradlew.bat

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions src/main/java/de/igslandstuhl/database/Application.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,29 @@
* It will later replace Server as main class.
*/
public final class Application {
/** The delimiter for topics in LPT save files. */
public static final String TOPIC_DELIMITER = "\n";
/** The delimiter for titles in LPT save files. */
public static final String TITLE_DELIMITER = "¶";
/** The delimiter for task titles in LPT save files. */
public static final String TASK_TITLE_DELIMITER = "\\|";
/** The delimiter for tasks in LPT save files. */
public static final String TASK_DELIMITER = "¤";

/**
* The application main logger
*/
public static final Logger LOGGER = LoggerFactory.getLogger(Application.class);
/**
* The logger for the student-database api
*/
public static final Logger LOGGER_API = LoggerFactory.getLogger("de.igslandstuhl.database.api");

private static Application instance = new Application(new String[] {"--test-environment", "true"});
/**
* Returns the singleton instance of the Application.
* @return the singleton instance of the Application
*/
public static Application getInstance() {
return instance;
}
Expand Down
7 changes: 7 additions & 0 deletions src/main/java/de/igslandstuhl/database/api/APIObject.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
package de.igslandstuhl.database.api;

/**
* An interface representing any object that is part of the student-database API
*/
public interface APIObject {
/**
* Returns a JSON representation of the object.
* @return a JSON representation of the object.
*/
public String toJSON();
}
Loading
Loading