Skip to content

Commit 2fc817f

Browse files
committed
build: flatten project and add Maven Central tag release workflow
1 parent 8214a4f commit 2fc817f

14 files changed

Lines changed: 99 additions & 46 deletions

File tree

.github/workflows/ci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,8 @@ jobs:
1919
java-version: '17'
2020
cache: gradle
2121

22+
- name: Validate Gradle Wrapper
23+
uses: gradle/actions/wrapper-validation@v4
24+
2225
- name: Build
2326
run: ./gradlew build
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Publish Release
2+
3+
on:
4+
push:
5+
tags:
6+
- '*'
7+
8+
env:
9+
RELEASE_SIGNING_ENABLED: true
10+
11+
jobs:
12+
publish:
13+
runs-on: ubuntu-latest
14+
if: github.repository == 'Commit451/PicoUrl'
15+
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
20+
- name: Install JDK
21+
uses: actions/setup-java@v4
22+
with:
23+
distribution: zulu
24+
java-version: '17'
25+
cache: gradle
26+
27+
- name: Set version
28+
run: sed -i "s/VERSION_NAME=2.0.1/VERSION_NAME=$GITHUB_REF_NAME/" gradle.properties
29+
30+
- name: Release to Maven Central
31+
run: ./gradlew publishAndReleaseToMavenCentral --no-configuration-cache
32+
env:
33+
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
34+
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
35+
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_PRIVATE_KEY }}
36+
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSWORD }}

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# PicoUrl
22

3+
[![Build](https://github.com/Commit451/PicoUrl/actions/workflows/ci.yml/badge.svg)](https://github.com/Commit451/PicoUrl/actions/workflows/ci.yml) [![Maven Central](https://img.shields.io/maven-central/v/com.commit451/picourl.svg?label=Maven%20Central)](https://central.sonatype.com/artifact/com.commit451/picourl)
4+
35
Create tiny shareable URLs that can be parsed back into the original URLs.
46

57
This is now a **pure Kotlin/JVM** library and uses **Ktor client + CIO**.

build.gradle.kts

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,38 @@
1+
import com.vanniktech.maven.publish.SonatypeHost
2+
13
plugins {
2-
kotlin("jvm") version "2.1.10" apply false
4+
kotlin("jvm") version "2.1.10"
5+
id("com.vanniktech.maven.publish") version "0.30.0"
6+
}
7+
8+
group = findProperty("GROUP") as String
9+
version = findProperty("VERSION_NAME") as String
10+
11+
repositories {
12+
mavenCentral()
13+
}
14+
15+
dependencies {
16+
implementation("io.ktor:ktor-client-core:2.3.12")
17+
implementation("io.ktor:ktor-client-cio:2.3.12")
18+
19+
testImplementation(kotlin("test"))
20+
testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.10.1")
21+
testImplementation("io.ktor:ktor-client-mock:2.3.12")
22+
}
23+
24+
tasks.test {
25+
useJUnitPlatform()
26+
}
27+
28+
kotlin {
29+
jvmToolchain(17)
330
}
431

5-
tasks.register<Delete>("clean") {
6-
delete(rootProject.layout.buildDirectory)
32+
mavenPublishing {
33+
coordinates("com.commit451", "picourl", version.toString())
34+
publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL)
35+
if (System.getenv("RELEASE_SIGNING_ENABLED") == "true") {
36+
signAllPublications()
37+
}
738
}

gradle.properties

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,26 @@
11
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
22
kotlin.code.style=official
3+
4+
GROUP=com.commit451
5+
POM_ARTIFACT_ID=picourl
6+
VERSION_NAME=2.0.1
7+
8+
POM_NAME=PicoUrl
9+
POM_DESCRIPTION=Create tiny shareable URLs that can be parsed back into original URLs
10+
POM_INCEPTION_YEAR=2017
11+
POM_URL=https://github.com/Commit451/PicoUrl/
12+
13+
POM_LICENSE_NAME=The Apache Software License, Version 2.0
14+
POM_LICENSE_URL=https://www.apache.org/licenses/LICENSE-2.0.txt
15+
POM_LICENSE_DIST=repo
16+
17+
POM_SCM_URL=https://github.com/Commit451/PicoUrl/
18+
POM_SCM_CONNECTION=scm:git:git://github.com/Commit451/PicoUrl.git
19+
POM_SCM_DEV_CONNECTION=scm:git:ssh://git@github.com/Commit451/PicoUrl.git
20+
21+
POM_DEVELOPER_ID=Commit451
22+
POM_DEVELOPER_NAME=Commit 451
23+
POM_DEVELOPER_URL=https://github.com/Commit451/
24+
25+
SONATYPE_CONNECT_TIMEOUT_SECONDS=60
26+
SONATYPE_CLOSE_TIMEOUT_SECONDS=900

picourl/.gitignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

picourl/build.gradle.kts

Lines changed: 0 additions & 24 deletions
This file was deleted.

picourl/proguard-rules.pro

Lines changed: 0 additions & 17 deletions
This file was deleted.

settings.gradle.kts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11
rootProject.name = "PicoUrl"
2-
include(":picourl")
File renamed without changes.

0 commit comments

Comments
 (0)