diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index 8f28184..7a6514e 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -1,6 +1,9 @@ name: Publish - Release on: + push: + branches: + - fix/release-workflow release: types: [released] @@ -10,8 +13,20 @@ jobs: steps: - name: Checkout project sources uses: actions/checkout@v3 + + - name: Set up JDK and Maven Central + uses: actions/setup-java@v3 + with: + java-version: '11' + distribution: 'adopt' + cache: 'gradle' + server-id: central + server-username: ${{ secrets.MAVEN_USERNAME }} + server-password: ${{ secrets.MAVEN_PASSWORD }} + - name: Setup Gradle uses: gradle/gradle-build-action@v2 + - name: Setup local.properties run: | cat << EOF >> local.properties @@ -23,15 +38,17 @@ jobs: contentType="${{ secrets.CONTENT_TYPE }}" assetUid="${{ secrets.ASSET_UID }}" EOF + - name: Gradle build and clean run: | ./gradlew clean build - - name: Publish the SDK + + - name: Publish to Maven Central run: | ./gradlew publishAndReleaseToMavenCentral --no-configuration-cache env: - ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.mavenCentralUsername }} - ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.mavenCentralPassword }} + ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVEN_USERNAME }} + ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_PASSWORD }} ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.signingInMemoryKey }} ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.signingInMemoryKeyId }} ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.signingInMemoryKeyPassword }} \ No newline at end of file diff --git a/contentstack/build.gradle b/contentstack/build.gradle index decfc05..3d97849 100755 --- a/contentstack/build.gradle +++ b/contentstack/build.gradle @@ -1,16 +1,15 @@ plugins { - id "com.vanniktech.maven.publish" version "0.27.0" + id "com.vanniktech.maven.publish" version "0.28.0" id "com.android.library" } - import com.vanniktech.maven.publish.SonatypeHost - android.buildFeatures.buildConfig true mavenPublishing { - publishToMavenCentral(SonatypeHost.DEFAULT) + // Use S01 host for Maven Central publishing + publishToMavenCentral(SonatypeHost.S01) signAllPublications() - coordinates("com.contentstack.sdk", "android", "4.1.0") + coordinates("com.contentstack.sdk", "android", "4.1.0-beta") pom { name = "contentstack-android" @@ -56,7 +55,8 @@ tasks.register('jacocoTestReport', JacocoReport) { } android { - //namespace "com.contentstack.sdk" + namespace "com.contentstack.sdk" + compileSdk 34 // Using latest stable Android SDK version packagingOptions { exclude("META-INF/DEPENDENCIES") exclude("META-INF/LICENSE") @@ -97,7 +97,6 @@ android { keyPassword 'android' } } - compileSdk 30 defaultConfig { // Required when setting minSdkVersion to 20 or lower multiDexEnabled true diff --git a/gradle.properties b/gradle.properties index 64b7045..6ba9660 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,16 @@ android.useAndroidX=true android.enableJetifier=true android.enableR8.fullMode=false -org.gradle.jvmargs=-XX:MaxMetaspaceSize=512m \ No newline at end of file +org.gradle.jvmargs=-XX:MaxMetaspaceSize=512m +android.suppressUnsupportedCompileSdk=34 + +# Maven Central Publishing Configuration +SONATYPE_HOST=S01 +RELEASE_SIGNING_ENABLED=true + +# These values should be provided by environment variables in CI +mavenCentralUsername= +mavenCentralPassword= +signing.keyId= +signing.password= +signing.secretKeyRingFile= \ No newline at end of file