2 Commits

Author SHA1 Message Date
!verity
b2a08a2c30 Update README with GitHub Packages installation guide and enhance project configuration
- Add installation instructions for Gradle and Maven in the README.
- Update `.idea/misc.xml` for Java 21 compatibility.
- Improve release workflow with clearer build and publish step naming.
2026-03-13 20:54:37 +01:00
!verity
ac1e1f1ece Enhance release workflow: enable publishing to GitHub Packages and integrate versioning from tags 2026-03-13 20:47:19 +01:00
4 changed files with 79 additions and 5 deletions

View File

@@ -1,4 +1,4 @@
# On push of a version tag (e.g. v1.0.0): build, create GitHub Release, upload JARs.
# On push of a version tag (e.g. v1.0.0): build, publish to GitHub Packages, create Release, upload JARs.
name: Release
on:
@@ -8,10 +8,13 @@ on:
permissions:
contents: write
packages: write
jobs:
release:
runs-on: ubuntu-latest
env:
RELEASE_VERSION: ${{ github.ref_name }}
steps:
- name: Checkout
uses: actions/checkout@v4
@@ -23,7 +26,13 @@ jobs:
java-version: 21
cache: gradle
- run: chmod +x gradlew && ./gradlew build --no-daemon
- name: Strip v from version
run: echo "RELEASE_VERSION=${RELEASE_VERSION#v}" >> $GITHUB_ENV
- name: Build and publish to GitHub Packages
run: chmod +x gradlew && ./gradlew build publish --no-daemon
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create Release
uses: softprops/action-gh-release@v2

2
.idea/misc.xml generated
View File

@@ -4,7 +4,7 @@
<component name="FrameworkDetectionExcludesConfiguration">
<file type="web" url="file://$PROJECT_DIR$" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" project-jdk-name="corretto-21" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="corretto-21" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

View File

@@ -8,6 +8,50 @@ Java library for terminal UI: tables, rules, colors, prompts, menus, SelectList,
[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/jakubbbdev/terminal-ui)
## Install
Published to [GitHub Packages](https://github.com/jakubbbdev/terminal-ui/packages). Replace `VERSION` with a [release](https://github.com/jakubbbdev/terminal-ui/releases) tag (e.g. `1.0.0`).
**Gradle (Kotlin DSL):**
```kotlin
repositories {
mavenCentral()
maven { url = uri("https://maven.pkg.github.com/jakubbbdev/terminal-ui") }
}
dependencies {
implementation("dev.jakub.terminal:terminal-ui:VERSION")
}
```
**Gradle (Groovy):**
```groovy
repositories {
mavenCentral()
maven { url "https://maven.pkg.github.com/jakubbbdev/terminal-ui" }
}
dependencies {
implementation "dev.jakub.terminal:terminal-ui:VERSION"
}
```
**Maven:**
```xml
<repository>
<id>github</id>
<url>https://maven.pkg.github.com/jakubbbdev/terminal-ui</url>
</repository>
<dependency>
<groupId>dev.jakub.terminal</groupId>
<artifactId>terminal-ui</artifactId>
<version>VERSION</version>
</dependency>
```
For public packages, read access usually works without credentials. If your tool asks for auth, use a [GitHub PAT](https://github.com/settings/tokens) with `read:packages` as username and the token as password.
## Requirements
- **Java 21**

View File

@@ -2,15 +2,15 @@ plugins {
id("java")
id("java-library")
id("application")
id("maven-publish")
}
tasks.named<JavaExec>("run") {
jvmArgs("-Ddev.jakub.terminal.ansi=true", "-Dfile.encoding=UTF-8")
}
group = "dev.jakub.terminal"
version = "1.0-SNAPSHOT"
version = System.getenv("RELEASE_VERSION") ?: "1.0-SNAPSHOT"
java {
sourceCompatibility = JavaVersion.VERSION_21
@@ -29,4 +29,25 @@ dependencies {
tasks.test {
useJUnitPlatform()
}
publishing {
publications {
create<MavenPublication>("maven") {
groupId = project.group.toString()
artifactId = "terminal-ui"
version = project.version.toString()
from(components["java"])
}
}
repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/jakubbbdev/terminal-ui")
credentials {
username = System.getenv("GITHUB_ACTOR") ?: project.findProperty("gpr.user")?.toString()
password = System.getenv("GITHUB_TOKEN") ?: project.findProperty("gpr.token")?.toString()
}
}
}
}