From 58323d57d599b5016d50c8ab18c961d6b5e32bbc Mon Sep 17 00:00:00 2001 From: Alexandre Jacinto Date: Mon, 27 Jan 2025 19:26:03 +0000 Subject: [PATCH 01/14] feat: add `publish-android.yml` workflow to publish library in Maven --- .github/workflows/publish-android.yml | 35 +++++++++ ...{github_actions.yml => run-unit-tests.yml} | 0 docs/CHANGELOG.md | 9 --- scripts/publish-android.sh | 38 ++++++++++ scripts/publish-module.gradle | 74 +++++++++++++++++++ scripts/publish-root.gradle | 37 ++++++++++ 6 files changed, 184 insertions(+), 9 deletions(-) create mode 100644 .github/workflows/publish-android.yml rename .github/workflows/{github_actions.yml => run-unit-tests.yml} (100%) delete mode 100644 docs/CHANGELOG.md create mode 100755 scripts/publish-android.sh create mode 100644 scripts/publish-module.gradle create mode 100644 scripts/publish-root.gradle diff --git a/.github/workflows/publish-android.yml b/.github/workflows/publish-android.yml new file mode 100644 index 0000000..c5dd721 --- /dev/null +++ b/.github/workflows/publish-android.yml @@ -0,0 +1,35 @@ +name: Publish Native Android Library + +on: workflow_dispatch + +jobs: + publish-android: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - uses: actions/checkout@v4 + - name: set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'adopt' + - name: Grant execute permission for gradlew + run: chmod +x ./gradlew + - name: Grant execute permission for publishing script + run: chmod +x ./scripts/publish-android.sh + - name: Make local props + run: | + cat << EOF > "local.properties" + ossrhUsername=${{ secrets.ANDROID_OSSRH_USERNAME }} + ossrhPassword=${{ secrets.ANDROID_OSSRH_PASSWORD }} + sonatypeStagingProfileId=${{ secrets.ANDROID_SONATYPE_STAGING_PROFILE_ID }} + signing.keyId=${{ secrets.ANDROID_SIGNING_KEY_ID }} + signing.password=${{ secrets.ANDROID_SIGNING_PASSWORD }} + signing.key=${{ secrets.ANDROID_SIGNING_KEY }} + EOF + echo "local.properties file has been created successfully." + - name: Run publish script + working-directory: ./scripts + run: ./publish-android.sh \ No newline at end of file diff --git a/.github/workflows/github_actions.yml b/.github/workflows/run-unit-tests.yml similarity index 100% rename from .github/workflows/github_actions.yml rename to .github/workflows/run-unit-tests.yml diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md deleted file mode 100644 index d689004..0000000 --- a/docs/CHANGELOG.md +++ /dev/null @@ -1,9 +0,0 @@ -# Changelog -All notable changes to this project will be documented in this file. - -The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), -and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - -### 2022-04-12 - -Create repository. diff --git a/scripts/publish-android.sh b/scripts/publish-android.sh new file mode 100755 index 0000000..5179efb --- /dev/null +++ b/scripts/publish-android.sh @@ -0,0 +1,38 @@ +#!/usr/bin/env bash + +ANDROID_PATH=../ +LOG_OUTPUT=./tmp/publish-android.txt +THE_VERSION=`sed -n 's/.*\(.*\)<\/version>.*/\1/p' ../pom.xml` + +# Get latest io.ionic:portals XML version info +PUBLISHED_URL="https://repo1.maven.org/maven2/io/ionic/libs/iongeolocation-android/maven-metadata.xml" +PUBLISHED_DATA=$(curl -s $PUBLISHED_URL) +PUBLISHED_VERSION="$(perl -ne 'print and last if s/.*(.*)<\/latest>.*/\1/;' <<< $PUBLISHED_DATA)" + +if [[ "$THE_VERSION" == "$PUBLISHED_VERSION" ]]; then + printf %"s\n\n" "Duplicate: a published version exists for $THE_VERSION, skipping..." +else + # Make log dir if doesnt exist + mkdir -p ./tmp + + # Export ENV variable used by Gradle for Versioning + export THE_VERSION + export SHOULD_PUBLISH=true + + printf %"s\n" "Attempting to build and publish version $THE_VERSION" + # Publish a release to the Maven repo + "$ANDROID_PATH"/gradlew clean build publishReleasePublicationToSonatypeRepository closeAndReleaseSonatypeStagingRepository --no-daemon --max-workers 1 -b "$ANDROID_PATH"/build.gradle -Pandroid.useAndroidX=true > $LOG_OUTPUT 2>&1 + # Stage a version + # "$ANDROID_PATH"/gradlew clean build publishReleasePublicationToSonatypeRepository --no-daemon --max-workers 1 -b "$ANDROID_PATH"/build.gradle -Pandroid.useAndroidX=true > $LOG_OUTPUT 2>&1 + + echo $RESULT + + if grep --quiet "BUILD SUCCESSFUL" $LOG_OUTPUT; then + printf %"s\n" "Success: Published to MavenCentral." + else + printf %"s\n" "Error publishing, check $LOG_OUTPUT for more info! Manually review and release from the Sonatype Repository Manager may be necessary https://s01.oss.sonatype.org/" + cat $LOG_OUTPUT + exit 1 + fi + +fi \ No newline at end of file diff --git a/scripts/publish-module.gradle b/scripts/publish-module.gradle new file mode 100644 index 0000000..13527c0 --- /dev/null +++ b/scripts/publish-module.gradle @@ -0,0 +1,74 @@ +apply plugin: 'maven-publish' +apply plugin: 'signing' + +def LIB_VERSION = System.getenv('THE_VERSION') + +task androidSourcesJar(type: Jar) { + archiveClassifier.set('sources') + from android.sourceSets.main.java.srcDirs + from android.sourceSets.main.kotlin.srcDirs +} + +artifacts { + archives androidSourcesJar +} + +group = 'io.ionic.libs' +version = LIB_VERSION + +afterEvaluate { + publishing { + publications { + release(MavenPublication) { + // Coordinates + groupId 'io.ionic.libs' + artifactId 'iongeolocation-android' + version LIB_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 + + // POM Data + pom { + name = 'iongeolocation-android' + description = 'Geolocation Android Lib' + url = 'https://github.com/ionic-team/IONGeolocationLib-Android' + licenses { + license { + name = 'License' + url = 'https://github.com/ionic-team/IONGeolocationLib-Android/blob/main/LICENSE' + } + } + developers { + developer { + name = 'Ionic' + email = 'hi@ionic.io' + } + } + + // Version Control Info + scm { + connection = 'scm:git:github.com:ionic-team/IONGeolocationLib-Android.git' + developerConnection = 'scm:git:ssh://github.com:ionic-team/IONGeolocationLib-Android.git' + url = 'https://github.com/ionic-team/IONGeolocationLib-Android/tree/main' + } + } + } + } + } +} + +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..b87a39d --- /dev/null +++ b/scripts/publish-root.gradle @@ -0,0 +1,37 @@ +// Create variables with empty default values +ext["signing.keyId"] = '' +ext["signing.key"] = '' +ext["signing.password"] = '' +ext["ossrhUsername"] = '' +ext["ossrhPassword"] = '' +ext["sonatypeStagingProfileId"] = '' + +File secretPropsFile = 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('ANDROID_OSSRH_USERNAME') + ext["ossrhPassword"] = System.getenv('ANDROID_OSSRH_PASSWORD') + ext["sonatypeStagingProfileId"] = System.getenv('ANDROID_SONATYPE_STAGING_PROFILE_ID') + ext["signing.keyId"] = System.getenv('ANDROID_SIGNING_KEY_ID') + ext["signing.key"] = System.getenv('ANDROID_SIGNING_KEY') + ext["signing.password"] = System.getenv('ANDROID_SIGNING_PASSWORD') +} + +// 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/")) + } + } + repositoryDescription = 'IONGeolocation Android Lib v' + System.getenv('THE_VERSION') +} \ No newline at end of file From 5cd7dc9698bf10ae0965c217b7a164487457f84d Mon Sep 17 00:00:00 2001 From: Alexandre Jacinto Date: Mon, 27 Jan 2025 19:29:43 +0000 Subject: [PATCH 02/14] feat: add `publish-android.yml` workflow to publish library in Maven --- .github/workflows/publish-android.yml | 6 +++++- scripts/publish-android.sh | 6 +++--- scripts/publish-module.gradle | 16 ++++++++-------- scripts/publish-root.gradle | 2 +- 4 files changed, 17 insertions(+), 13 deletions(-) diff --git a/.github/workflows/publish-android.yml b/.github/workflows/publish-android.yml index c5dd721..48ad7b9 100644 --- a/.github/workflows/publish-android.yml +++ b/.github/workflows/publish-android.yml @@ -1,6 +1,10 @@ name: Publish Native Android Library -on: workflow_dispatch +#on: workflow_dispatch +on: + workflow_dispatch: + push: + branches: [ feat/RMET-3983/add-publish-workflow ] jobs: publish-android: diff --git a/scripts/publish-android.sh b/scripts/publish-android.sh index 5179efb..f59dcd9 100755 --- a/scripts/publish-android.sh +++ b/scripts/publish-android.sh @@ -5,7 +5,7 @@ LOG_OUTPUT=./tmp/publish-android.txt THE_VERSION=`sed -n 's/.*\(.*\)<\/version>.*/\1/p' ../pom.xml` # Get latest io.ionic:portals XML version info -PUBLISHED_URL="https://repo1.maven.org/maven2/io/ionic/libs/iongeolocation-android/maven-metadata.xml" +PUBLISHED_URL="https://repo1.maven.org/maven2/io/ionic/libs/ionbarcode-android/maven-metadata.xml" PUBLISHED_DATA=$(curl -s $PUBLISHED_URL) PUBLISHED_VERSION="$(perl -ne 'print and last if s/.*(.*)<\/latest>.*/\1/;' <<< $PUBLISHED_DATA)" @@ -21,9 +21,9 @@ else printf %"s\n" "Attempting to build and publish version $THE_VERSION" # Publish a release to the Maven repo - "$ANDROID_PATH"/gradlew clean build publishReleasePublicationToSonatypeRepository closeAndReleaseSonatypeStagingRepository --no-daemon --max-workers 1 -b "$ANDROID_PATH"/build.gradle -Pandroid.useAndroidX=true > $LOG_OUTPUT 2>&1 + # "$ANDROID_PATH"/gradlew clean build publishReleasePublicationToSonatypeRepository closeAndReleaseSonatypeStagingRepository --no-daemon --max-workers 1 -b "$ANDROID_PATH"/build.gradle -Pandroid.useAndroidX=true > $LOG_OUTPUT 2>&1 # Stage a version - # "$ANDROID_PATH"/gradlew clean build publishReleasePublicationToSonatypeRepository --no-daemon --max-workers 1 -b "$ANDROID_PATH"/build.gradle -Pandroid.useAndroidX=true > $LOG_OUTPUT 2>&1 + "$ANDROID_PATH"/gradlew clean build publishReleasePublicationToSonatypeRepository --no-daemon --max-workers 1 -b "$ANDROID_PATH"/build.gradle -Pandroid.useAndroidX=true > $LOG_OUTPUT 2>&1 echo $RESULT diff --git a/scripts/publish-module.gradle b/scripts/publish-module.gradle index 13527c0..350e5ba 100644 --- a/scripts/publish-module.gradle +++ b/scripts/publish-module.gradle @@ -22,7 +22,7 @@ afterEvaluate { release(MavenPublication) { // Coordinates groupId 'io.ionic.libs' - artifactId 'iongeolocation-android' + artifactId 'ionbarcode-android' version LIB_VERSION // Two artifacts, the `aar` (or `jar`) and the sources @@ -36,13 +36,13 @@ afterEvaluate { // POM Data pom { - name = 'iongeolocation-android' - description = 'Geolocation Android Lib' - url = 'https://github.com/ionic-team/IONGeolocationLib-Android' + name = 'ionbarcode-android' + description = 'Barcode Android Lib' + url = 'https://github.com/OutSystems/OSBarcodeLib-Android' licenses { license { name = 'License' - url = 'https://github.com/ionic-team/IONGeolocationLib-Android/blob/main/LICENSE' + url = 'https://github.com/OutSystems/OSBarcodeLib-Android/blob/main/LICENSE' } } developers { @@ -54,9 +54,9 @@ afterEvaluate { // Version Control Info scm { - connection = 'scm:git:github.com:ionic-team/IONGeolocationLib-Android.git' - developerConnection = 'scm:git:ssh://github.com:ionic-team/IONGeolocationLib-Android.git' - url = 'https://github.com/ionic-team/IONGeolocationLib-Android/tree/main' + connection = 'scm:git:github.com:OutSystems/OSBarcodeLib-Android.git' + developerConnection = 'scm:git:ssh://github.com:OutSystems/OSBarcodeLib-Android.git' + url = 'https://github.com/OutSystems/OSBarcodeLib-Android/tree/main' } } } diff --git a/scripts/publish-root.gradle b/scripts/publish-root.gradle index b87a39d..ea5c6ab 100644 --- a/scripts/publish-root.gradle +++ b/scripts/publish-root.gradle @@ -33,5 +33,5 @@ nexusPublishing { snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")) } } - repositoryDescription = 'IONGeolocation Android Lib v' + System.getenv('THE_VERSION') + repositoryDescription = 'OSBarcode Android Lib v' + System.getenv('THE_VERSION') } \ No newline at end of file From 0b925ed29b3685dfb47abb358c0cf562ad705b6f Mon Sep 17 00:00:00 2001 From: Alexandre Jacinto Date: Mon, 27 Jan 2025 19:56:09 +0000 Subject: [PATCH 03/14] refactor: remove spaces from branch name --- .github/workflows/publish-android.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish-android.yml b/.github/workflows/publish-android.yml index 48ad7b9..da269d8 100644 --- a/.github/workflows/publish-android.yml +++ b/.github/workflows/publish-android.yml @@ -4,7 +4,7 @@ name: Publish Native Android Library on: workflow_dispatch: push: - branches: [ feat/RMET-3983/add-publish-workflow ] + branches: [feat/RMET-3983/add-publish-workflow] jobs: publish-android: From c74dcbaa1c8c1cdf4ed88d9304fd4eb7656b21b0 Mon Sep 17 00:00:00 2001 From: Alexandre Jacinto Date: Tue, 28 Jan 2025 10:39:45 +0000 Subject: [PATCH 04/14] fix: apply publish-root.gradle file in build.gradle --- build.gradle | 8 ++++++++ pom.xml | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 5cf518d..0aeaf0c 100644 --- a/build.gradle +++ b/build.gradle @@ -6,6 +6,9 @@ buildscript { mavenCentral() } dependencies { + if (System.getenv("SHOULD_PUBLISH") == "true") { + classpath("io.github.gradle-nexus:publish-plugin:1.1.0") + } classpath 'com.android.tools.build:gradle:8.7.2' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "org.jacoco:org.jacoco.core:$jacocoVersion" @@ -24,6 +27,11 @@ sonarqube { } } +if (System.getenv("SHOULD_PUBLISH") == "true") { + apply plugin: "io.github.gradle-nexus.publish-plugin" + apply from: file("./scripts/publish-root.gradle") +} + apply plugin: "com.android.library" apply plugin: "kotlin-android" apply plugin: "jacoco" diff --git a/pom.xml b/pom.xml index 1f81c4f..596ea77 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ http://maven.apache.org/maven-v4_0_0.xsd"> 4.0.0 - com.github.outsystems - osbarcode-android + io.ionic.libs + ionbarcode-android 1.2.0 From 40184a9c24d05f6c133ecf40ec5b9db60c2f56f5 Mon Sep 17 00:00:00 2001 From: Alexandre Jacinto Date: Tue, 28 Jan 2025 10:45:51 +0000 Subject: [PATCH 05/14] fix: add missing apply in build.gradle --- build.gradle | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/build.gradle b/build.gradle index 0aeaf0c..b42e013 100644 --- a/build.gradle +++ b/build.gradle @@ -137,4 +137,8 @@ dependencies { testImplementation 'org.mockito.kotlin:mockito-kotlin:4.0.0' testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.2" testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.2" +} + +if (System.getenv("SHOULD_PUBLISH") == "true") { + apply from: file("./scripts/publish-module.gradle") } \ No newline at end of file From b93858917de2174f8dccd12c9ac695f3f81953ee Mon Sep 17 00:00:00 2001 From: Alexandre Jacinto Date: Tue, 28 Jan 2025 10:53:56 +0000 Subject: [PATCH 06/14] chore: set JVM to 17 --- build.gradle | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index b42e013..9211a21 100644 --- a/build.gradle +++ b/build.gradle @@ -57,11 +57,11 @@ android { } } compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility JavaVersion.VERSION_17 + targetCompatibility JavaVersion.VERSION_17 } kotlinOptions { - jvmTarget = '1.8' + jvmTarget = '17' } task jacocoTestReport(type: JacocoReport, dependsOn: ['testDebugUnitTest']) { From 3ca7d711abc817b3ea0619cb2595b7daddfa316c Mon Sep 17 00:00:00 2001 From: Alexandre Jacinto Date: Tue, 28 Jan 2025 10:58:25 +0000 Subject: [PATCH 07/14] Revert "chore: set JVM to 17" This reverts commit b93858917de2174f8dccd12c9ac695f3f81953ee. --- build.gradle | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index 9211a21..b42e013 100644 --- a/build.gradle +++ b/build.gradle @@ -57,11 +57,11 @@ android { } } compileOptions { - sourceCompatibility JavaVersion.VERSION_17 - targetCompatibility JavaVersion.VERSION_17 + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 } kotlinOptions { - jvmTarget = '17' + jvmTarget = '1.8' } task jacocoTestReport(type: JacocoReport, dependsOn: ['testDebugUnitTest']) { From 803b2d2f00d8402d7f9f81bb9b1951baa80685cc Mon Sep 17 00:00:00 2001 From: Alexandre Jacinto Date: Tue, 28 Jan 2025 11:16:35 +0000 Subject: [PATCH 08/14] fix: add missing entries in build.gradle --- build.gradle | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/build.gradle b/build.gradle index b42e013..fc49524 100644 --- a/build.gradle +++ b/build.gradle @@ -9,7 +9,7 @@ buildscript { if (System.getenv("SHOULD_PUBLISH") == "true") { classpath("io.github.gradle-nexus:publish-plugin:1.1.0") } - classpath 'com.android.tools.build:gradle:8.7.2' + classpath 'com.android.tools.build:gradle:8.2.2' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "org.jacoco:org.jacoco.core:$jacocoVersion" } @@ -57,11 +57,11 @@ android { } } compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility JavaVersion.VERSION_17 + targetCompatibility JavaVersion.VERSION_17 } kotlinOptions { - jvmTarget = '1.8' + jvmTarget = '17' } task jacocoTestReport(type: JacocoReport, dependsOn: ['testDebugUnitTest']) { @@ -98,6 +98,15 @@ android { testOptions { unitTests.returnDefaultValues = true } + + lintOptions { + abortOnError false + } + + publishing { + singleVariant("release") + } + } repositories { From aa12dbe05b552acc8bae393b4fe1fe6d869d71eb Mon Sep 17 00:00:00 2001 From: Alexandre Jacinto Date: Tue, 28 Jan 2025 11:26:01 +0000 Subject: [PATCH 09/14] test: test publish-android workflow --- .github/workflows/publish-android.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish-android.yml b/.github/workflows/publish-android.yml index da269d8..48ad7b9 100644 --- a/.github/workflows/publish-android.yml +++ b/.github/workflows/publish-android.yml @@ -4,7 +4,7 @@ name: Publish Native Android Library on: workflow_dispatch: push: - branches: [feat/RMET-3983/add-publish-workflow] + branches: [ feat/RMET-3983/add-publish-workflow ] jobs: publish-android: From 696b5318a9f766c699aead3ce8042bcf5e3c9941 Mon Sep 17 00:00:00 2001 From: Alexandre Jacinto Date: Tue, 28 Jan 2025 13:46:29 +0000 Subject: [PATCH 10/14] chore: revert changes on AGP version and JVM version --- build.gradle | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/build.gradle b/build.gradle index fc49524..2e079fc 100644 --- a/build.gradle +++ b/build.gradle @@ -9,7 +9,7 @@ buildscript { if (System.getenv("SHOULD_PUBLISH") == "true") { classpath("io.github.gradle-nexus:publish-plugin:1.1.0") } - classpath 'com.android.tools.build:gradle:8.2.2' + classpath 'com.android.tools.build:gradle:8.7.2' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "org.jacoco:org.jacoco.core:$jacocoVersion" } @@ -57,11 +57,11 @@ android { } } compileOptions { - sourceCompatibility JavaVersion.VERSION_17 - targetCompatibility JavaVersion.VERSION_17 + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 } kotlinOptions { - jvmTarget = '17' + jvmTarget = '1.8' } task jacocoTestReport(type: JacocoReport, dependsOn: ['testDebugUnitTest']) { From 8234627e28bfd6070c7bba52cf2f6c573334f7ac Mon Sep 17 00:00:00 2001 From: Alexandre Jacinto Date: Tue, 28 Jan 2025 13:58:06 +0000 Subject: [PATCH 11/14] chore: update changelog and set workflow to only run on manual trigger --- .github/workflows/publish-android.yml | 6 +----- CHANGELOG.md | 4 ++++ scripts/publish-android.sh | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/publish-android.yml b/.github/workflows/publish-android.yml index 48ad7b9..c5dd721 100644 --- a/.github/workflows/publish-android.yml +++ b/.github/workflows/publish-android.yml @@ -1,10 +1,6 @@ name: Publish Native Android Library -#on: workflow_dispatch -on: - workflow_dispatch: - push: - branches: [ feat/RMET-3983/add-publish-workflow ] +on: workflow_dispatch jobs: publish-android: diff --git a/CHANGELOG.md b/CHANGELOG.md index 19dd6f9..2a3272a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 The changes documented here do not include those from the original repository. +## [Unreleased] + +- Add `publish-android` workflow to publish library under `io.ionic.libs` in Maven (https://outsystemsrd.atlassian.net/browse/RMET-3983) + ## [1.2.0] ### 02-12-2024 diff --git a/scripts/publish-android.sh b/scripts/publish-android.sh index f59dcd9..7e5dedf 100755 --- a/scripts/publish-android.sh +++ b/scripts/publish-android.sh @@ -21,9 +21,9 @@ else printf %"s\n" "Attempting to build and publish version $THE_VERSION" # Publish a release to the Maven repo - # "$ANDROID_PATH"/gradlew clean build publishReleasePublicationToSonatypeRepository closeAndReleaseSonatypeStagingRepository --no-daemon --max-workers 1 -b "$ANDROID_PATH"/build.gradle -Pandroid.useAndroidX=true > $LOG_OUTPUT 2>&1 + "$ANDROID_PATH"/gradlew clean build publishReleasePublicationToSonatypeRepository closeAndReleaseSonatypeStagingRepository --no-daemon --max-workers 1 -b "$ANDROID_PATH"/build.gradle -Pandroid.useAndroidX=true > $LOG_OUTPUT 2>&1 # Stage a version - "$ANDROID_PATH"/gradlew clean build publishReleasePublicationToSonatypeRepository --no-daemon --max-workers 1 -b "$ANDROID_PATH"/build.gradle -Pandroid.useAndroidX=true > $LOG_OUTPUT 2>&1 + # "$ANDROID_PATH"/gradlew clean build publishReleasePublicationToSonatypeRepository --no-daemon --max-workers 1 -b "$ANDROID_PATH"/build.gradle -Pandroid.useAndroidX=true > $LOG_OUTPUT 2>&1 echo $RESULT From 82d35c41dd0472263dffec6386d1161cd29be0e4 Mon Sep 17 00:00:00 2001 From: Alexandre Jacinto Date: Tue, 28 Jan 2025 13:59:32 +0000 Subject: [PATCH 12/14] chore: remove lintOptions from build.gradle --- .github/workflows/publish-android.yml | 6 +++++- build.gradle | 5 ----- scripts/publish-android.sh | 4 ++-- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/.github/workflows/publish-android.yml b/.github/workflows/publish-android.yml index c5dd721..48ad7b9 100644 --- a/.github/workflows/publish-android.yml +++ b/.github/workflows/publish-android.yml @@ -1,6 +1,10 @@ name: Publish Native Android Library -on: workflow_dispatch +#on: workflow_dispatch +on: + workflow_dispatch: + push: + branches: [ feat/RMET-3983/add-publish-workflow ] jobs: publish-android: diff --git a/build.gradle b/build.gradle index 2e079fc..d633706 100644 --- a/build.gradle +++ b/build.gradle @@ -99,14 +99,9 @@ android { unitTests.returnDefaultValues = true } - lintOptions { - abortOnError false - } - publishing { singleVariant("release") } - } repositories { diff --git a/scripts/publish-android.sh b/scripts/publish-android.sh index 7e5dedf..f59dcd9 100755 --- a/scripts/publish-android.sh +++ b/scripts/publish-android.sh @@ -21,9 +21,9 @@ else printf %"s\n" "Attempting to build and publish version $THE_VERSION" # Publish a release to the Maven repo - "$ANDROID_PATH"/gradlew clean build publishReleasePublicationToSonatypeRepository closeAndReleaseSonatypeStagingRepository --no-daemon --max-workers 1 -b "$ANDROID_PATH"/build.gradle -Pandroid.useAndroidX=true > $LOG_OUTPUT 2>&1 + # "$ANDROID_PATH"/gradlew clean build publishReleasePublicationToSonatypeRepository closeAndReleaseSonatypeStagingRepository --no-daemon --max-workers 1 -b "$ANDROID_PATH"/build.gradle -Pandroid.useAndroidX=true > $LOG_OUTPUT 2>&1 # Stage a version - # "$ANDROID_PATH"/gradlew clean build publishReleasePublicationToSonatypeRepository --no-daemon --max-workers 1 -b "$ANDROID_PATH"/build.gradle -Pandroid.useAndroidX=true > $LOG_OUTPUT 2>&1 + "$ANDROID_PATH"/gradlew clean build publishReleasePublicationToSonatypeRepository --no-daemon --max-workers 1 -b "$ANDROID_PATH"/build.gradle -Pandroid.useAndroidX=true > $LOG_OUTPUT 2>&1 echo $RESULT From 9787e5019a276db2612d89d67cb890d0fec6783f Mon Sep 17 00:00:00 2001 From: Alexandre Jacinto Date: Tue, 28 Jan 2025 14:04:23 +0000 Subject: [PATCH 13/14] chore: set workflow to run only on manual triggers --- .github/workflows/publish-android.yml | 6 +----- scripts/publish-android.sh | 4 ++-- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/.github/workflows/publish-android.yml b/.github/workflows/publish-android.yml index 48ad7b9..c5dd721 100644 --- a/.github/workflows/publish-android.yml +++ b/.github/workflows/publish-android.yml @@ -1,10 +1,6 @@ name: Publish Native Android Library -#on: workflow_dispatch -on: - workflow_dispatch: - push: - branches: [ feat/RMET-3983/add-publish-workflow ] +on: workflow_dispatch jobs: publish-android: diff --git a/scripts/publish-android.sh b/scripts/publish-android.sh index f59dcd9..7e5dedf 100755 --- a/scripts/publish-android.sh +++ b/scripts/publish-android.sh @@ -21,9 +21,9 @@ else printf %"s\n" "Attempting to build and publish version $THE_VERSION" # Publish a release to the Maven repo - # "$ANDROID_PATH"/gradlew clean build publishReleasePublicationToSonatypeRepository closeAndReleaseSonatypeStagingRepository --no-daemon --max-workers 1 -b "$ANDROID_PATH"/build.gradle -Pandroid.useAndroidX=true > $LOG_OUTPUT 2>&1 + "$ANDROID_PATH"/gradlew clean build publishReleasePublicationToSonatypeRepository closeAndReleaseSonatypeStagingRepository --no-daemon --max-workers 1 -b "$ANDROID_PATH"/build.gradle -Pandroid.useAndroidX=true > $LOG_OUTPUT 2>&1 # Stage a version - "$ANDROID_PATH"/gradlew clean build publishReleasePublicationToSonatypeRepository --no-daemon --max-workers 1 -b "$ANDROID_PATH"/build.gradle -Pandroid.useAndroidX=true > $LOG_OUTPUT 2>&1 + # "$ANDROID_PATH"/gradlew clean build publishReleasePublicationToSonatypeRepository --no-daemon --max-workers 1 -b "$ANDROID_PATH"/build.gradle -Pandroid.useAndroidX=true > $LOG_OUTPUT 2>&1 echo $RESULT From a3a6f788a13be5ee20b1402879c354cb01d4efe7 Mon Sep 17 00:00:00 2001 From: Alexandre Jacinto Date: Wed, 29 Jan 2025 16:03:39 +0000 Subject: [PATCH 14/14] chore: add date to changelog entry --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2a3272a..d279835 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ The changes documented here do not include those from the original repository. ## [Unreleased] +### 28-01-2025 - Add `publish-android` workflow to publish library under `io.ionic.libs` in Maven (https://outsystemsrd.atlassian.net/browse/RMET-3983) ## [1.2.0]