diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml new file mode 100644 index 0000000..2e80dc1 --- /dev/null +++ b/.github/workflows/ci_cd.yml @@ -0,0 +1,85 @@ +name: CI/CD + +on: + push: + tags: + - '*' + +jobs: + release_and_publish: + name: Release and Publish + runs-on: ubuntu-latest + + steps: + - name: Checkout Repository + uses: actions/checkout@v2 + + - name: Set up JDK + uses: actions/setup-java@v2 + with: + java-version: '1.8' # Adjust the Java version to your project's requirements + + - name: Build Project + run: ./gradlew build + + - name: Generate Release and Publish Package + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} +# GPR_USER: "jimdo-bot" +# GPR_TOKEN: ${{ secrets.GPR_TOKEN }} + run: | + ./gradlew release -Prelease.useAutomaticVersion=true +# ./gradlew publish + +#jobs: +# test: +# name: Test +# runs-on: ubuntu-latest +# steps: +# - name: Check out code +# uses: actions/checkout@v2 +# with: +# persist-credentials: false +# +# - name: Set up JDK 11 +# uses: actions/setup-java@v2.5.0 +# with: +# distribution: 'zulu' +# java-version: '11' +# cache: 'gradle' +# +# - name: Run tests +# run: ./gradlew check +# +# publish: +# name: Publish +# needs: +# - test +# runs-on: ubuntu-latest +# steps: +# - name: Check out code +# uses: actions/checkout@v2 +# with: +# persist-credentials: false +# +# - name: Set up JDK 11 +# uses: actions/setup-java@v2.5.0 +# with: +# distribution: 'zulu' +# java-version: '11' +# cache: 'gradle' +# +# - name: Publish snapshot +# if: github.ref != 'refs/heads/main' && !startsWith(github.ref, 'refs/tags/') +# run: make publish-snapshot +# env: +# BRANCH: ${GITHUB_REF#refs/heads/} +# USERNAME: "jimdo-bot" +# TOKEN: ${{ secrets.TOKEN }} +# +# - name: Publish +# if: startsWith(github.ref, 'refs/tags/') +# run: make publish +# env: +# USERNAME: "jimdo-bot" +# TOKEN: ${{ secrets.TOKEN }} diff --git a/Makefile b/Makefile index 8bea4e1..c96bc01 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,3 @@ -version := "0.0.2" target_data_directory := lib/src/main/resources/ target_po_directory := lib/src/main/resources/iso_3166/ @@ -29,17 +28,3 @@ delete-po-and-mo: .PHONY: get-latest-iso-files get-latest-iso-files: clone-iso-codes transpile-translations delete-po-and-mo - -# Generating deployable -.PHONY: generate-artifacts -generate-artifacts: - JCOUNTRY_VERSION=${version} ./gradlew build - -.PHONY: generate-pom -publish-to-ossrh: - OSSRH_USER=${OSSRH_USER} \ - OSSRH_PASS=${OSSRH_PASS} \ - GPG_SIGNING_KEY_PASSWORD=${GPG_SIGNING_KEY_PASSWORD} \ - GPG_SIGNING_KEY=${GPG_SIGNING_KEY} \ - JCOUNTRY_VERSION=${version} \ - ./gradlew publish diff --git a/README.md b/README.md index c344a79..66dc8fe 100644 --- a/README.md +++ b/README.md @@ -9,22 +9,11 @@ This will help having a quick source for translations of country names, and the For the status of the translations, please check the [iso codes](https://github.com/sailfishos-mirror/iso-codes) repository (which is the original source of the iso files and translations). ## Dependency -```java -// Maven - - io.github.castmart - jcountry - 0.0.2 - -``` ```kotlin // Gradle Kotlin -implementation("io.github.castmart:jcountry:0.0.2") -``` -```java -// Gradle short -implementation 'io.github.castmart:jcountry:0.0.2' +implementation("com.jimdo:jcountry:0.1.0") ``` + ## How to use it? ```java JCountry jcountry = new JCountry(); diff --git a/lib/build.gradle.kts b/lib/build.gradle.kts index f20ca1c..99fb790 100644 --- a/lib/build.gradle.kts +++ b/lib/build.gradle.kts @@ -6,29 +6,25 @@ * User Manual available at https://docs.gradle.org/7.6.1/userguide/building_java_projects.html * This project uses @Incubating APIs which are subject to change. */ -group = "io.github.castmart" -version = "${System.getenv("JCOUNTRY_VERSION")}" +group = "com.jimdo" plugins { // Apply the java-library plugin for API and implementation separation. - signing `java-library` `maven-publish` + id("pl.allegro.tech.build.axion-release") version "1.15.3" } +// TO BE UPDATED ON EVERY RELEASE. +version = scmVersion.version + repositories { // Use Maven Central for resolving dependencies. mavenCentral() } dependencies { - // This dependency is exported to consumers, that is to say found on their compile classpath. - // api("org.apache.commons:commons-math3:3.6.1") - - // This dependency is used internally, and not exposed to consumers on their own compile classpath. - // implementation("com.google.guava:guava:31.1-jre") implementation("org.json:json:20230618") - testImplementation("org.junit.jupiter:junit-jupiter-engine:5.9.2") } @@ -53,18 +49,12 @@ afterEvaluate { publishing { publications { create("jcountry") { - signing { - val signingKey: String = "${System.getenv("GPG_SIGNING_KEY")}" - val signingPassword: String = "${System.getenv("GPG_SIGNING_KEY_PASSWORD")}" - useInMemoryPgpKeys(signingKey, signingPassword) - sign(publishing.publications["jcountry"]) - } artifactId = "jcountry" from(components["java"]) pom { name.set("jcountry") description.set("A java wrapper for the ISO country codes and translations inspired in pycountry") - url.set("https://github.com/castmart/jcountry") + url.set("https://github.com/Jimdo/jcountry") licenses { license { name.set("GNU LESSER GENERAL PUBLIC LICENSE, Version 2.1") @@ -75,13 +65,13 @@ afterEvaluate { developer { id.set("castmart") name.set("Juan Carlos Castaneda Martinez") - email.set("jc.castmart@gmail.com") + email.set("juan.castaneda@jimdo.com") } } scm { - connection.set("scm:git:https://github.com/castmart/jcountry.git") - developerConnection.set("scm:git:https://github.com/castmart/jcountry.git") - url.set("https://github.com/castmart/jcountry") + connection.set("scm:git:https://github.com/Jimdo/jcountry.git") + developerConnection.set("scm:git:https://github.com/Jimdo/jcountry.git") + url.set("https://github.com/Jimdo/jcountry") } } } @@ -89,12 +79,11 @@ afterEvaluate { repositories { maven { -// url = uri(layout.buildDirectory.dir("repo")) - name = "OSSRH" - url = uri("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/") + name = "GitHubPackages" + url = uri("https://maven.pkg.github.com/jimdo/packages") credentials { - username = "${System.getenv("OSSRH_USER")}" - password = "${System.getenv("OSSRH_PASS")}" + username = "${System.getenv("MAVEN_USERNAME")}" + password = "${System.getenv("MAVEN_PASSWORD")}" } } } diff --git a/lib/src/main/java/io/github/castmart/jcountry/Country.java b/lib/src/main/java/com/jimdo/jcountry/Country.java similarity index 95% rename from lib/src/main/java/io/github/castmart/jcountry/Country.java rename to lib/src/main/java/com/jimdo/jcountry/Country.java index e15cc39..f42bd72 100644 --- a/lib/src/main/java/io/github/castmart/jcountry/Country.java +++ b/lib/src/main/java/com/jimdo/jcountry/Country.java @@ -1,4 +1,4 @@ -package io.github.castmart.jcountry; +package com.jimdo.jcountry; /** * Model Class to store Country Information. ISO-3166-1 diff --git a/lib/src/main/java/io/github/castmart/jcountry/CountryDB.java b/lib/src/main/java/com/jimdo/jcountry/CountryDB.java similarity index 97% rename from lib/src/main/java/io/github/castmart/jcountry/CountryDB.java rename to lib/src/main/java/com/jimdo/jcountry/CountryDB.java index a65fe2d..dbfee01 100644 --- a/lib/src/main/java/io/github/castmart/jcountry/CountryDB.java +++ b/lib/src/main/java/com/jimdo/jcountry/CountryDB.java @@ -1,4 +1,4 @@ -package io.github.castmart.jcountry; +package com.jimdo.jcountry; import java.util.HashMap; import java.util.Locale; diff --git a/lib/src/main/java/io/github/castmart/jcountry/CountryDBImpl.java b/lib/src/main/java/com/jimdo/jcountry/CountryDBImpl.java similarity index 98% rename from lib/src/main/java/io/github/castmart/jcountry/CountryDBImpl.java rename to lib/src/main/java/com/jimdo/jcountry/CountryDBImpl.java index da01d69..afa9984 100644 --- a/lib/src/main/java/io/github/castmart/jcountry/CountryDBImpl.java +++ b/lib/src/main/java/com/jimdo/jcountry/CountryDBImpl.java @@ -1,4 +1,4 @@ -package io.github.castmart.jcountry; +package com.jimdo.jcountry; import java.io.InputStream; import java.util.*; diff --git a/lib/src/main/java/io/github/castmart/jcountry/JCountry.java b/lib/src/main/java/com/jimdo/jcountry/JCountry.java similarity index 96% rename from lib/src/main/java/io/github/castmart/jcountry/JCountry.java rename to lib/src/main/java/com/jimdo/jcountry/JCountry.java index a021017..8a45f6c 100644 --- a/lib/src/main/java/io/github/castmart/jcountry/JCountry.java +++ b/lib/src/main/java/com/jimdo/jcountry/JCountry.java @@ -1,7 +1,7 @@ /* * This Java source file was generated by the Gradle 'init' task. */ -package io.github.castmart.jcountry; +package com.jimdo.jcountry; /** * Singleton class that loads the ISO DB's through the corresponding Classes. diff --git a/lib/src/main/java/io/github/castmart/jcountry/Language.java b/lib/src/main/java/com/jimdo/jcountry/Language.java similarity index 94% rename from lib/src/main/java/io/github/castmart/jcountry/Language.java rename to lib/src/main/java/com/jimdo/jcountry/Language.java index 2edbc9c..5ca0fda 100644 --- a/lib/src/main/java/io/github/castmart/jcountry/Language.java +++ b/lib/src/main/java/com/jimdo/jcountry/Language.java @@ -1,4 +1,4 @@ -package io.github.castmart.jcountry; +package com.jimdo.jcountry; /** * Model Class to store Country Information. ISO-639-2 diff --git a/lib/src/main/java/io/github/castmart/jcountry/LanguageDB.java b/lib/src/main/java/com/jimdo/jcountry/LanguageDB.java similarity index 97% rename from lib/src/main/java/io/github/castmart/jcountry/LanguageDB.java rename to lib/src/main/java/com/jimdo/jcountry/LanguageDB.java index e75f066..761ce53 100644 --- a/lib/src/main/java/io/github/castmart/jcountry/LanguageDB.java +++ b/lib/src/main/java/com/jimdo/jcountry/LanguageDB.java @@ -1,4 +1,4 @@ -package io.github.castmart.jcountry; +package com.jimdo.jcountry; import java.util.HashMap; import java.util.Locale; diff --git a/lib/src/main/java/io/github/castmart/jcountry/LanguageDBImpl.java b/lib/src/main/java/com/jimdo/jcountry/LanguageDBImpl.java similarity index 98% rename from lib/src/main/java/io/github/castmart/jcountry/LanguageDBImpl.java rename to lib/src/main/java/com/jimdo/jcountry/LanguageDBImpl.java index 3f48981..f7f72f2 100644 --- a/lib/src/main/java/io/github/castmart/jcountry/LanguageDBImpl.java +++ b/lib/src/main/java/com/jimdo/jcountry/LanguageDBImpl.java @@ -1,4 +1,4 @@ -package io.github.castmart.jcountry; +package com.jimdo.jcountry; import org.json.JSONArray; import org.json.JSONObject; diff --git a/lib/src/test/java/io/github/castmart/jcountry/JCountryTest.java b/lib/src/test/java/com/jimdo/jcountry/JCountryTest.java similarity index 99% rename from lib/src/test/java/io/github/castmart/jcountry/JCountryTest.java rename to lib/src/test/java/com/jimdo/jcountry/JCountryTest.java index 3706e1c..2480814 100644 --- a/lib/src/test/java/io/github/castmart/jcountry/JCountryTest.java +++ b/lib/src/test/java/com/jimdo/jcountry/JCountryTest.java @@ -1,7 +1,7 @@ /* * This Java source file was generated by the Gradle 'init' task. */ -package io.github.castmart.jcountry; +package com.jimdo.jcountry; import org.junit.jupiter.api.Test;