diff --git a/.github/workflows/app-build.yml b/.github/workflows/app-build.yml
new file mode 100644
index 0000000..c2c4fe5
--- /dev/null
+++ b/.github/workflows/app-build.yml
@@ -0,0 +1,16 @@
+name: Android Build
+
+on: [ push ]
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+ - name: set up JDK 11
+ uses: actions/setup-java@v2
+ with:
+ distribution: adopt
+ java-version: 11
+ - name: Build with Gradle
+ run: ./gradlew build
\ No newline at end of file
diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml
new file mode 100644
index 0000000..30de2bf
--- /dev/null
+++ b/.github/workflows/publish.yml
@@ -0,0 +1,28 @@
+name: Publish
+on:
+ push:
+ tags:
+ - '*'
+
+jobs:
+ publish:
+ name: Release build and publish
+ runs-on: ubuntu-latest
+ steps:
+ - name: Check out code
+ uses: actions/checkout@v2
+ - name: Set up JDK 11
+ uses: actions/setup-java@v2
+ with:
+ distribution: adopt
+ java-version: 11
+
+ - name: Publish to MavenCentral
+ run: ./gradlew countrypicker:publishReleasePublicationToSonatypeRepository --max-workers 1 closeAndReleaseSonatypeStagingRepository
+ env:
+ OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
+ OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
+ SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }}
+ SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
+ SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
+ SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }}
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
index aa724b7..565a541 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,6 @@
*.iml
.gradle
+.idea
/local.properties
/.idea/caches
/.idea/libraries
diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml
new file mode 100644
index 0000000..4bec4ea
--- /dev/null
+++ b/.idea/codeStyles/Project.xml
@@ -0,0 +1,117 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+ xmlns:android
+
+ ^$
+
+
+
+
+
+
+
+
+ xmlns:.*
+
+ ^$
+
+
+ BY_NAME
+
+
+
+
+
+
+ .*:id
+
+ http://schemas.android.com/apk/res/android
+
+
+
+
+
+
+
+
+ .*:name
+
+ http://schemas.android.com/apk/res/android
+
+
+
+
+
+
+
+
+ name
+
+ ^$
+
+
+
+
+
+
+
+
+ style
+
+ ^$
+
+
+
+
+
+
+
+
+ .*
+
+ ^$
+
+
+ BY_NAME
+
+
+
+
+
+
+ .*
+
+ http://schemas.android.com/apk/res/android
+
+
+ ANDROID_ATTRIBUTE_ORDER
+
+
+
+
+
+
+ .*
+
+ .*
+
+
+ BY_NAME
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml
new file mode 100644
index 0000000..a55e7a1
--- /dev/null
+++ b/.idea/codeStyles/codeStyleConfig.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/build.gradle b/build.gradle
index f6d0add..6649e12 100644
--- a/build.gradle
+++ b/build.gradle
@@ -3,18 +3,14 @@ buildscript {
ext {
compose_version = '1.1.0-beta04'
}
- repositories {
- google()
- mavenCentral()
- }
- dependencies {
- classpath "com.android.tools.build:gradle:7.0.3"
- classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.0'
-
- // NOTE: Do not place your application dependencies here; they belong
- // in the individual module build.gradle files
- }
}
+plugins {
+ id 'com.android.application' version '7.1.0' apply false
+ id 'com.android.library' version '7.1.0' apply false
+ id 'org.jetbrains.kotlin.android' version '1.6.0' apply false
+ id 'io.github.gradle-nexus.publish-plugin' version "1.1.0"
+}
+apply from: "${rootDir}/scripts/publish-root.gradle"
task clean(type: Delete) {
delete rootProject.buildDir
diff --git a/countrypicker/build.gradle b/countrypicker/build.gradle
index c8ee6a9..4b7dc4b 100644
--- a/countrypicker/build.gradle
+++ b/countrypicker/build.gradle
@@ -3,6 +3,13 @@ plugins {
id 'kotlin-android'
}
+ext {
+ PUBLISH_GROUP_ID = 'com.canopas.jetcountrypicker'
+ PUBLISH_VERSION = '1.0.0'
+ PUBLISH_ARTIFACT_ID = 'jetcountrypicker'
+}
+apply from: "${rootDir}/scripts/publish-module.gradle"
+
android {
compileSdk 31
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 2f958f9..77a3a48 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
#Tue Jan 25 12:25:52 IST 2022
distributionBase=GRADLE_USER_HOME
-distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
diff --git a/scripts/publish-module.gradle b/scripts/publish-module.gradle
new file mode 100644
index 0000000..5e7a782
--- /dev/null
+++ b/scripts/publish-module.gradle
@@ -0,0 +1,78 @@
+apply plugin: 'maven-publish'
+apply plugin: 'signing'
+
+task androidSourcesJar(type: Jar) {
+ archiveClassifier.set('sources')
+ if (project.plugins.findPlugin("com.android.library")) {
+ from android.sourceSets.main.java.srcDirs
+ } else {
+ from sourceSets.main.java.srcDirs
+ }
+}
+
+artifacts {
+ archives androidSourcesJar
+}
+group = PUBLISH_GROUP_ID
+version = PUBLISH_VERSION
+
+afterEvaluate {
+ publishing {
+ publications {
+ release(MavenPublication) {
+ // The coordinates of the library, being set from variables that
+ // we'll set up later
+ groupId PUBLISH_GROUP_ID
+ artifactId PUBLISH_ARTIFACT_ID
+ version PUBLISH_VERSION
+
+ /// Two artifacts, the `aar` (or `jar`) and the sources
+ if (project.plugins.findPlugin("com.android.library")) {
+ from components.release
+ } else {
+ artifact("$buildDir/libs/${project.getName()}-${version}.jar")
+ }
+
+ artifact androidSourcesJar
+
+ // Mostly self-explanatory metadata
+ pom {
+ name = PUBLISH_ARTIFACT_ID
+ description = 'Country code bottomsheet picker in Jetpack Compose'
+ url = 'https://github.com/canopas/JetCountrypicker'
+ licenses {
+ license {
+ name = 'License'
+ url = 'https://github.com/canopas/JetCountrypicker/blob/main/License'
+ }
+ }
+ developers {
+ developer {
+ id = 'cp-radhika-s'
+ name = 'Radhika canopas'
+ email = 'radhika.s@canopas.com'
+ }
+ // Add all other devs here...
+ }
+
+ // Version control info - if you're using GitHub, follow the
+ // format as seen here
+ scm {
+ connection = 'scm:git:github.com/canopas/JetCountrypicker.git'
+ developerConnection = 'scm:git:ssh://github.com/canopas/JetCountrypicker.git'
+ url = 'https://github.com/canopas/JetCountrypicker.git'
+ }
+ }
+ }
+ }
+ }
+}
+signing {
+ useInMemoryPgpKeys(
+ rootProject.ext["signing.keyId"],
+ rootProject.ext["signing.key"],
+ rootProject.ext["signing.password"],
+ )
+
+ sign publishing.publications
+}
\ No newline at end of file
diff --git a/scripts/publish-root.gradle b/scripts/publish-root.gradle
new file mode 100644
index 0000000..e87dc00
--- /dev/null
+++ b/scripts/publish-root.gradle
@@ -0,0 +1,44 @@
+// Create variables with empty default values
+ext["ossrhUsername"] = ''
+ext["ossrhPassword"] = ''
+ext["sonatypeStagingProfileId"] = ''
+ext["signing.keyId"] = ''
+ext["signing.password"] = ''
+ext["signing.key"] = ''
+ext["snapshot"] = ''
+
+File secretPropsFile = project.rootProject.file('local.properties')
+
+if (secretPropsFile.exists()) {
+
+ // Read local.properties file first if it exists
+
+ Properties p = new Properties()
+
+ new FileInputStream(secretPropsFile).withCloseable { is -> p.load(is) }
+
+ p.each { name, value -> ext[name] = value }
+
+} else {
+ // Use system environment variables
+ ext["ossrhUsername"] = System.getenv('OSSRH_USERNAME')
+ ext["ossrhPassword"] = System.getenv('OSSRH_PASSWORD')
+ ext["sonatypeStagingProfileId"] = System.getenv('SONATYPE_STAGING_PROFILE_ID')
+ ext["signing.keyId"] = System.getenv('SIGNING_KEY_ID')
+ ext["signing.password"] = System.getenv('SIGNING_PASSWORD')
+ ext["signing.key"] = System.getenv('SIGNING_KEY')
+ ext["snapshot"] = System.getenv('SNAPSHOT')
+}
+
+// Set up Sonatype repository
+nexusPublishing {
+ repositories {
+ sonatype {
+ stagingProfileId = sonatypeStagingProfileId
+ username = ossrhUsername
+ password = ossrhPassword
+ nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
+ snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
+ }
+ }
+}
\ No newline at end of file
diff --git a/settings.gradle b/settings.gradle
index fc701ba..912d2c7 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -1,9 +1,15 @@
+pluginManagement {
+ repositories {
+ gradlePluginPortal()
+ google()
+ mavenCentral()
+ }
+}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
- jcenter() // Warning: this repository is going to shut down soon
}
}
rootProject.name = "JetCountyPicker"