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
26 changes: 26 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,29 @@ jobs:
cache: gradle
- name: Check formatting, lint, build and test
run: ./gradlew --no-daemon clean build -PjavaVersion=${{ matrix.java }}

publish:
if: startsWith(github.ref, 'refs/tags/')
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-java@v6
with:
distribution: temurin
java-version: "25"
cache: gradle
- name: Check release version
run: |
version=$(./gradlew --no-daemon -q properties --property version | sed -n 's/^version: //p')
if [ "$GITHUB_REF_NAME" != "$version" ]; then
echo "Tag $GITHUB_REF_NAME does not match project version $version" >&2
exit 1
fi
- name: Publish and release to Maven Central
run: ./gradlew --no-daemon publishAndReleaseToMavenCentral
env:
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_KEY }}
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_KEY_PASSWORD }}
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
# Changelog

## 0.1.0 — Sin publicar
## 0.1.0 — 2026-10-12

- Publicación en Maven Central como `py.com.ith:tu-ruc-client`, con JAR de
fuentes, Javadoc y firmas PGP. El `groupId` cambia de `org.ith` a `py.com.ith`,
el dominio de ITH; los paquetes Java `org.ith.*` no cambian.
- Licencia MIT.
- Cambio incompatible: el cliente deja de registrar por defecto cada petición y
respuesta completas (`HttpLoggingInterceptor.Level.BODY`). El nuevo
`TuRuc.withLogLevel(Level)` activa el logging de OkHttp con el nivel indicado;
Expand Down
54 changes: 53 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,26 @@ puedes añadir `-PjavaVersion=17` o `-PjavaVersion=21` a los comandos anteriores
Las herramientas de calidad son dependencias del build y no se publican como
dependencias del cliente.

## Probar desde otro proyecto

Para probar cambios sin publicar, clona este repositorio junto al proyecto
consumidor y agrega a su `settings.gradle`:

```groovy
includeBuild("../tu-ruc-java-client")
```

Gradle sustituye `py.com.ith:tu-ruc-client` por el checkout local. Con la
configuración por defecto necesitas JDK 25 instalado.

Para revisar los artefactos que se publicarían, sin firmarlos:

```bash
./gradlew publishToMavenLocal
```

Quedan en `~/.m2/repository/py/com/ith/tu-ruc-client/`.

## Integración continua

CI ejecuta `./gradlew clean build` con Java 17, 21 y 25 y falla si alguna
Expand All @@ -55,4 +75,36 @@ transitivos entre la compilación del consumidor y la ejecución. La conversión
JSON usa el módulo oficial `fastjson2-extension`, que incluye el
[conversor para Retrofit](https://github.com/alibaba/fastjson2/blob/2.0.65/extension/src/main/java/com/alibaba/fastjson2/support/retrofit/Retrofit2ConverterFactory.java).

Registra los cambios de cada versión en [CHANGELOG.md](CHANGELOG.md).
## Publicación

La biblioteca se publica en [Maven Central](https://central.sonatype.com/) con el
plugin [`com.vanniktech.maven.publish`](https://vanniktech.github.io/gradle-maven-publish-plugin/central/).
Maven Central rechaza artefactos sin firmar, por eso la publicación exige la
clave PGP.

Para publicar:

1. Sube `version` en `build.gradle` y registra los cambios en
[CHANGELOG.md](CHANGELOG.md).
2. Crea y sube un tag con la misma versión, sin `v`:

```bash
git tag -a 0.1.0 -m "Tu RUC Java Client 0.1.0"
git push origin 0.1.0
```

CI ejecuta las comprobaciones con Java 17, 21 y 25, verifica que el tag coincida
con la versión y publica en Maven Central. Una versión publicada no se puede
borrar ni reemplazar.

El workflow usa estos secretos del repositorio:

| Secreto | Contenido |
| ------------------------ | ------------------------------------------------------------ |
| `MAVEN_CENTRAL_USERNAME` | Usuario del token de Central Portal con acceso a `py.com.ith` |
| `MAVEN_CENTRAL_PASSWORD` | Contraseña de ese token |
| `SIGNING_KEY` | Clave privada PGP exportada en ASCII (`gpg --armor --export-secret-keys`) |
| `SIGNING_KEY_PASSWORD` | Frase de la clave PGP |

La clave pública debe estar en un servidor de claves que Maven Central consulte,
como `keys.openpgp.org` o `keyserver.ubuntu.com`.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 ITH E.A.S.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
37 changes: 20 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,25 @@ Java 17 o superior.

## Instalación

La biblioteca todavía no se publica en un repositorio Maven. Para usarla desde
otro proyecto Gradle, clona este repositorio junto a tu proyecto y agrega a su
`settings.gradle`:
La biblioteca se publica en Maven Central como `py.com.ith:tu-ruc-client`.

```groovy
includeBuild("../tu-ruc-java-client")
```

Y a su `build.gradle`:
Gradle:

```groovy
repositories {
mavenCentral()
}

dependencies {
implementation("org.ith:tu-ruc-client:0.1.0")
implementation("py.com.ith:tu-ruc-client:0.1.0")
}
```

Gradle compila la biblioteca y resuelve sus dependencias desde Maven Central.
Para compilarla así necesitas JDK 25 instalado, aunque el resultado funciona
desde Java 17. Si usas el JAR de `build/libs/`, agrega tú sus dependencias:
el JAR no las incluye.
Maven:

```xml
<dependency>
<groupId>py.com.ith</groupId>
<artifactId>tu-ruc-client</artifactId>
<version>0.1.0</version>
</dependency>
```

## Uso

Expand Down Expand Up @@ -138,13 +133,21 @@ si tu proyecto lo usa, decláralo por tu cuenta.

Las dependencias transitivas pasan a Retrofit 3.0.0 y OkHttp 5.5.0.

Las coordenadas Maven pasan de `org.ith:tu-ruc-client` a
`py.com.ith:tu-ruc-client`. Los paquetes Java no cambian: los imports siguen
siendo `org.ith.client` y `org.ith.model`.

El cliente ya no registra las peticiones y respuestas completas. Si dependías de
esos logs, actívalos con `withLogLevel(HttpLoggingInterceptor.Level.BODY)`.

## Cambios

Consulta [CHANGELOG.md](CHANGELOG.md) para conocer los cambios de cada versión.

## Licencia

[MIT](LICENSE).

## Contribuciones

Para compilar, ejecutar las pruebas y conocer las comprobaciones de calidad,
Expand Down
53 changes: 52 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
import com.vanniktech.maven.publish.JavaLibrary
import com.vanniktech.maven.publish.JavadocJar

plugins {
id("java-library")
id("pmd")
id("com.diffplug.spotless") version "8.10.4"
id("com.vanniktech.maven.publish") version "0.37.0"
}

group = "org.ith"
group = "py.com.ith"
version = "0.1.0"

java {
Expand Down Expand Up @@ -45,6 +49,11 @@ tasks.test {
useJUnitPlatform()
}

tasks.withType(Javadoc).configureEach {
options.encoding = "UTF-8"
options.addBooleanOption("Xdoclint:all,-missing", true)
}

spotless {
java {
palantirJavaFormat("2.102.0")
Expand All @@ -61,3 +70,45 @@ pmd {
ruleSetFiles = files("config/pmd/ruleset.xml")
consoleOutput = true
}

mavenPublishing {
publishToMavenCentral()
signAllPublications()
coordinates(project.group.toString(), "tu-ruc-client", project.version.toString())
configure(new JavaLibrary(new JavadocJar.Javadoc(), true))

pom {
name = "Tu RUC Java Client"
description = "Cliente Java para consultar y buscar contribuyentes en la API de Tu RUC."
inceptionYear = "2023"
url = "https://github.com/ithdev/tu-ruc-java-client"
licenses {
license {
name = "MIT License"
url = "https://opensource.org/license/mit"
distribution = "repo"
}
}
developers {
developer {
id = "ithdev"
name = "ITH E.A.S."
url = "https://ith.com.py"
}
}
scm {
url = "https://github.com/ithdev/tu-ruc-java-client"
connection = "scm:git:https://github.com/ithdev/tu-ruc-java-client.git"
developerConnection = "scm:git:ssh://git@github.com/ithdev/tu-ruc-java-client.git"
}
}
}

// Maven Central rechaza artefactos sin firmar; para publicar en Maven local no hace falta firmar.
signing {
required = {
gradle.taskGraph.allTasks.any {
it.name.contains("MavenCentral")
}
}
}
2 changes: 0 additions & 2 deletions gradle.properties

This file was deleted.

Loading