From eceb674e2977aee0558b687cf2e05ed7f9585d1c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C5=82=20Czopek?=
<44530932+Grabsky@users.noreply.github.com>
Date: Thu, 13 Jun 2024 16:01:04 +0200
Subject: [PATCH] publish release on push, update dependencies, update
README.md
---
.github/workflows/gradle.yml | 16 ++++++++++++-
README.md | 39 +++++++++++++++---------------
build.gradle | 46 ++++++++++++++++++++----------------
3 files changed, 60 insertions(+), 41 deletions(-)
diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml
index 4c0e52b..b9275ea 100644
--- a/.github/workflows/gradle.yml
+++ b/.github/workflows/gradle.yml
@@ -12,16 +12,30 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
+ # Checkout
- uses: actions/checkout@v3
+ # JDK 17
- name: JDK 17
uses: actions/setup-java@v3
with:
java-version: "17"
distribution: "temurin"
+ # Publish
- name: Publish
uses: gradle/gradle-build-action@v2
with:
arguments: publish
env:
- # GitHub Packages
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ # Expose Release Name
+ - name: Expose Release Name
+ run: echo "PROJECT_RELEASE_NAME=$( ./gradlew release -q --no-rebuild )" >> $GITHUB_ENV
+ # Expose Tag
+ - name: Expose Tag
+ run: echo "PROJECT_TAG=$( ./gradlew tag -q --no-rebuild )" >> $GITHUB_ENV
+ # Release
+ - name: Release
+ uses: ncipollo/release-action@v1
+ with:
+ name: "${{ env.PROJECT_RELEASE_NAME }}"
+ tag: "${{ env.PROJECT_TAG }}"
diff --git a/README.md b/README.md
index e965917..74f2a26 100644
--- a/README.md
+++ b/README.md
@@ -1,14 +1,12 @@
# commands
-
-
-
-
-
-
+
+[![Latest Release](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fapi.github.com%2Frepos%2FGrabsky%2Fcommands%2Freleases%2Flatest&query=tag_name&logo=gradle&style=for-the-badge&label=%20&labelColor=%231C2128&color=%23454F5A)](https://github.com/Grabsky/commands/packages/1935522)
+[![Build Status](https://img.shields.io/github/actions/workflow/status/Grabsky/commands/gradle.yml?style=for-the-badge&logo=github&logoColor=white&label=%20)](https://github.com/Grabsky/commands/actions)
+[![CodeFactor Grade](https://img.shields.io/codefactor/grade/github/Grabsky/commands/main?style=for-the-badge&logo=codefactor&logoColor=white&label=%20)](https://www.codefactor.io/repository/github/grabsky/commands)
Simple, no non-sense command framework for **[Paper](https://github.com/PaperMC/Paper)** servers.
-Brigadier is not currently supported, nor is it guaranteed to be supported in the future.
+Brigadier is not currently supported, nor is it guaranteed to be supported in the future. Contributions are welcome.
@@ -18,20 +16,23 @@ Requires **Java 17** (or higher) and **Paper 1.20.1** (or higher).
## Getting Started
-To use this project in your plugin, add following repository:
+Library is published to the **[GitHub Packages Registry](https://github.com/Grabsky/commands/packages/)** and may require additional configuration. You can find more details **[here](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-gradle-registry#using-a-published-package)**.
```groovy
repositories {
- maven { url = 'https://repo.grabsky.cloud/releases' }
+ maven { url = "https://maven.pkg.github.com/grabsky/commands"
+ credentials {
+ username = findProperty("gpr.actor") ?: System.getenv("GITHUB_ACTOR")
+ password = findProperty("gpr.token") ?: System.getenv("GITHUB_TOKEN")
+ }
+ }
}
```
-Then specify dependency:
+
```groovy
dependencies {
implementation 'cloud.grabsky:commands:[_VERSION_]'
}
```
-You can also use [GitHub Packages](https://github.com/Grabsky/commands/packages/) - read more about that [here](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-gradle-registry#using-a-published-package).
-
@@ -40,17 +41,17 @@ Documentation and examples are available **[here](https://github.com/Grabsky/com
-## Building (Linux)
+## Building
```bash
-# Cloning repository
+# Cloning the repository.
$ git clone https://github.com/Grabsky/commands.git
-# Entering cloned repository
-$ cd ./commands
-# Compiling and publishing to maven local
-$ ./gradlew clean publishToMavenLocal
+# Entering the cloned repository.
+$ cd commands
+# Compiling and publishing to maven local.
+$ gradlew clean publishToMavenLocal
```
## Contributing
-This project is open for contributions. Help in regards of improving performance, adding new features or fixing bugs is greatly appreciated.
+This project is open for contributions. I'm currently looking for help in implementing presence and parameter flags for commands.
\ No newline at end of file
diff --git a/build.gradle b/build.gradle
index 0ada53e..813669b 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,13 +1,25 @@
plugins {
- id "java-library"
- id "maven-publish"
+ id("java-library")
+ id("maven-publish")
}
group = "cloud.grabsky"
version = "1.20.1-${System.getenv("GITHUB_RUN_NUMBER") ?: "DEV"}"
-sourceCompatibility = JavaVersion.VERSION_17
-targetCompatibility = JavaVersion.VERSION_17
+repositories {
+ mavenCentral()
+ maven { url = "https://repo.papermc.io/repository/maven-public/" }
+}
+
+dependencies {
+ // JetBrains Annotations
+ compileOnly("org.jetbrains:annotations:24.1.0")
+ // Lombok
+ compileOnly("org.projectlombok:lombok:1.18.32")
+ annotationProcessor("org.projectlombok:lombok:1.18.32")
+ // Paper API
+ compileOnly("io.papermc.paper:paper-api:1.20.1-R0.1-SNAPSHOT")
+}
publishing {
repositories {
@@ -20,35 +32,27 @@ publishing {
}
}
publications {
- maven(MavenPublication) { from components.java }
+ register("maven", MavenPublication.class) {
+ from components.java
+ }
}
}
java {
withJavadocJar()
withSourcesJar()
+ sourceCompatibility = JavaVersion.VERSION_17
+ targetCompatibility = JavaVersion.VERSION_17
}
javadoc {
(options as CoreJavadocOptions).addStringOption("Xdoclint:none", "-quiet")
}
-repositories {
- mavenCentral()
- maven { url = "https://repo.papermc.io/repository/maven-public/" }
-}
-
-dependencies {
- // JetBrains Annotations
- compileOnly("org.jetbrains:annotations:24.0.0")
- // Lombok
- compileOnly("org.projectlombok:lombok:1.18.24")
- annotationProcessor("org.projectlombok:lombok:1.18.24")
- // Paper API
- compileOnly("io.papermc.paper:paper-api:1.20.1-R0.1-SNAPSHOT")
+tasks.register("release") {
+ print("${version.toString().split('-')[0]} #${System.getenv("GITHUB_RUN_NUMBER")}")
}
-gradle.buildFinished {
- println()
- println("> " + version)
+tasks.register("tag") {
+ print(version)
}