-
Notifications
You must be signed in to change notification settings - Fork 0
ci: add release workflow #15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
alexgerardojacinto
merged 17 commits into
feat/RMET-4099/android-implementation
from
ci/add-release-pipeline
Mar 31, 2026
Merged
Changes from 14 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
bc6d2ed
chore: update error codes
alexgerardojacinto 7baea3a
chore: update unit tests pipeline file name
alexgerardojacinto 18720e2
feat: add workflow to publish library in Maven repository
alexgerardojacinto d760c50
chore: update LICENSE
alexgerardojacinto dbb60d0
chore: add condition to run workflow on push to current branch to test
alexgerardojacinto 30927be
fix: fix branch name in pipeline condition
alexgerardojacinto 6490280
chore: correct workflow name
alexgerardojacinto a752e28
fix: add publish script to Gradle
alexgerardojacinto 5281a9a
fix: add missing Gradle repo
alexgerardojacinto 99d0c69
fix: add explicit dependsOn for dependency
alexgerardojacinto a71955c
fix: remove duplication in publish-module.gradle
alexgerardojacinto 64f09ed
fix: properly configure signing
alexgerardojacinto 1ed9eaf
fix: fixing release workflow
alexgerardojacinto 3c1386e
chore: configure workflow to run on manual trigger
alexgerardojacinto 2bac070
chore: update LICENSE and unit_tests.yml
alexgerardojacinto 63becde
misc: trigger workflow with push
alexgerardojacinto 2ee94ee
chore: update workflow dispatch rule to workflow_dispatch
alexgerardojacinto File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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" | ||
| centralTokenUsername=${{ secrets.ANDROID_CENTRAL_USERNAME }} | ||
| centralTokenPassword=${{ secrets.ANDROID_CENTRAL_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 |
2 changes: 1 addition & 1 deletion
2
.github/workflows/github_actions.yml → .github/workflows/unit_tests.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| name: GitHub Actions | ||
| name: Run Unit Tests | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| <?xml version="1.0" encoding="iso-8859-1"?> | ||
| <project xmlns="http://maven.apache.org/POM/4.0.0" | ||
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 | ||
| http://maven.apache.org/maven-v4_0_0.xsd"> | ||
|
|
||
| <modelVersion>4.0.0</modelVersion> | ||
| <groupId>io.ionic.libs</groupId> | ||
| <artifactId>ioncamera-android</artifactId> | ||
| <version>0.1.0</version> | ||
| </project> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| ANDROID_PATH=../ | ||
| LOG_OUTPUT=./tmp/publish-android.txt | ||
| THE_VERSION=`sed -n 's/.*<version>\(.*\)<\/version>.*/\1/p' ../pom.xml` | ||
|
|
||
| # Get latest io.ionic:portals XML version info | ||
| PUBLISHED_URL="https://repo1.maven.org/maven2/io/ionic/libs/ioncamera-android/maven-metadata.xml" | ||
| PUBLISHED_DATA=$(curl -s $PUBLISHED_URL) | ||
| PUBLISHED_VERSION="$(perl -ne 'print and last if s/.*<latest>(.*)<\/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 Central Portal may be necessary https://central.sonatype.com/publishing/deployments/" | ||
| cat $LOG_OUTPUT | ||
| exit 1 | ||
| fi | ||
|
|
||
| fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| apply plugin: 'maven-publish' | ||
| apply plugin: 'signing' | ||
|
|
||
| def LIB_VERSION = System.getenv('THE_VERSION') | ||
|
|
||
| group = 'io.ionic.libs' | ||
| version = LIB_VERSION | ||
|
|
||
| afterEvaluate { | ||
| publishing { | ||
| publications { | ||
| release(MavenPublication) { | ||
| // Coordinates | ||
| groupId 'io.ionic.libs' | ||
| artifactId 'ioncamera-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") | ||
| } | ||
|
|
||
| // POM Data | ||
| pom { | ||
| name = 'ioncamera-android' | ||
| description = 'Camera Android Lib' | ||
| url = 'https://github.com/ionic-team/ion-android-camera' | ||
| licenses { | ||
| license { | ||
| name = 'License' | ||
| url = 'https://github.com/ionic-team/ion-android-camera/blob/main/docs/LICENSE' | ||
| } | ||
| } | ||
| developers { | ||
| developer { | ||
| name = 'Ionic' | ||
| email = 'hi@ionic.io' | ||
| } | ||
| } | ||
|
|
||
| // Version Control Info | ||
| scm { | ||
| connection = 'scm:git:github.com:ionic-team/ion-android-camera.git' | ||
| developerConnection = 'scm:git:ssh://github.com:ionic-team/ion-android-camera.git' | ||
| url = 'https://github.com/ionic-team/ion-android-camera/tree/main' | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| signing { | ||
| useInMemoryPgpKeys( | ||
| rootProject.ext["signing.keyId"], | ||
| rootProject.ext["signing.key"], | ||
| rootProject.ext["signing.password"], | ||
| ) | ||
| sign publishing.publications | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| // Create variables with empty default values | ||
| ext["signing.keyId"] = '' | ||
| ext["signing.key"] = '' | ||
| ext["signing.password"] = '' | ||
| ext["centralTokenUsername"] = '' | ||
| ext["centralTokenPassword"] = '' | ||
| 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["centralTokenUsername"] = System.getenv('ANDROID_CENTRAL_USERNAME') | ||
| ext["centralTokenPassword"] = System.getenv('ANDROID_CENTRAL_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 = centralTokenUsername | ||
| password = centralTokenPassword | ||
| nexusUrl.set(uri("https://ossrh-staging-api.central.sonatype.com/service/local/")) | ||
| snapshotRepositoryUrl.set(uri("https://central.sonatype.com/repository/maven-snapshots/")) | ||
| } | ||
| } | ||
| repositoryDescription = 'IONCamera Android Lib v' + System.getenv('THE_VERSION') | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.