Skip to content

Commit

Permalink
Merge pull request #65 from velocitycareerlabs/dev-to-rc
Browse files Browse the repository at this point in the history
Dev to rc
  • Loading branch information
michaelavoyan authored Dec 13, 2023
2 parents ffc7b1e + 2da6086 commit 3fc3502
Show file tree
Hide file tree
Showing 5 changed files with 223 additions and 28 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/android-sdk-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: WalletAndroid-SDK-Tests

on:
pull_request:
branches:
- main
- rc
- dev
env:
PACKAGE_TYPE: "aar"
GRADLE_VERSION: "7.5"
JAVA_VERSION: "17"
ARTIFACT_PATH: "VCL/build/outputs"
ANDROID_NEXUS_SIGNING_KEY_ID: ${{ secrets.ANDROID_NEXUS_SIGNING_KEY_ID }}
ANDROID_NEXUS_SIGNING_PWD: ${{ secrets.ANDROID_NEXUS_SIGNING_PWD }}
ANDROID_NEXUS_OSSRH_USERNAME: ${{ secrets.ANDROID_NEXUS_OSSRH_USERNAME }}
ANDROID_NEXUS_OSSRH_PWD: ${{ secrets.ANDROID_NEXUS_OSSRH_PWD }}
ANDROID_NEXUS_STAGING_PROFILE_ID: ${{ secrets.ANDROID_NEXUS_STAGING_PROFILE_ID }}
ANDROID_NEXUS_PRIVATE_KEY: ${{ secrets.ANDROID_NEXUS_PRIVATE_KEY }}
jobs:
test-android-sdk:
runs-on: ubuntu-latest
steps:
- name: Git clone repository
uses: actions/checkout@v4
# Setup java
- uses: actions/setup-java@v3
with:
distribution: temurin
java-version: ${{ env.JAVA_VERSION }}
# Run test
- name: Run Test
run: ./gradlew test
83 changes: 83 additions & 0 deletions .github/workflows/android-sdk.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: WalletAndroid-SDK

on:
push:
branches:
- main
- rc
- dev
env:
PACKAGE_TYPE: "aar"
GRADLE_VERSION: "7.5"
JAVA_VERSION: "17"
ARTIFACT_PATH: "VCL/build/outputs"
ANDROID_NEXUS_SIGNING_KEY_ID: ${{ secrets.ANDROID_NEXUS_SIGNING_KEY_ID }}
ANDROID_NEXUS_SIGNING_PWD: ${{ secrets.ANDROID_NEXUS_SIGNING_PWD }}
ANDROID_NEXUS_OSSRH_USERNAME: ${{ secrets.ANDROID_NEXUS_OSSRH_USERNAME }}
ANDROID_NEXUS_OSSRH_PWD: ${{ secrets.ANDROID_NEXUS_OSSRH_PWD }}
ANDROID_NEXUS_STAGING_PROFILE_ID: ${{ secrets.ANDROID_NEXUS_STAGING_PROFILE_ID }}
ANDROID_NEXUS_PRIVATE_KEY: ${{ secrets.ANDROID_NEXUS_PRIVATE_KEY }}
jobs:
test-android-sdk:
runs-on: ubuntu-latest
steps:
- name: Git clone repository
uses: actions/checkout@v4
# Setup java
- uses: actions/setup-java@v3
with:
distribution: temurin
java-version: ${{ env.JAVA_VERSION }}
# Run test
- name: Run Test
run: ./gradlew test

build-android-sdk:
runs-on: ubuntu-latest
needs:
- test-android-sdk
steps:
- name: Git clone repository
uses: actions/checkout@v4
# Setup java
- uses: actions/setup-java@v3
with:
distribution: temurin
java-version: ${{ env.JAVA_VERSION }}
# Gradle Assemble
- name: Gradle Assemble
run: ./gradlew assemble${{ env.RELEASE_TAG }}
env:
RELEASE_TAG: ${{ github.ref == 'refs/heads/main' && format('{0}', 'Release' ) || 'Rc' }}
# Convert artifact to lowercase
- name: Rename artifact to lowercase
run: mv ${{ env.ARTIFACT_PATH}}/${{ env.PACKAGE_TYPE }}/VCL-${{ env.RELEASE_TAG }}.${{ env.PACKAGE_TYPE }} ${{ env.ARTIFACT_PATH }}/${{ env.PACKAGE_TYPE }}/vcl-${{ env.RELEASE_TAG }}.${{ env.PACKAGE_TYPE }}
env:
RELEASE_TAG: ${{ github.ref == 'refs/heads/main' && format('{0}', 'release' ) || 'rc' }}
# Show Me Builded packages
- name: Show Me Builded packages
run: ls -al ${{ env.ARTIFACT_PATH}}/${{ env.PACKAGE_TYPE }}/
# Publish Main/Rc
- name: Publish Main/Rc
if: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/rc' }}
run: ./gradlew publish${{ env.RELEASE_TAG }}
env:
RELEASE_TAG: ${{ github.ref == 'refs/heads/main' && format('{0}', 'Release' ) || 'Rc' }}
# Upload Artifacts
- name: Upload Artifact
if: success()
uses: actions/upload-artifact@v3
with:
name: vcl-${{ env.RELEASE_TAG }}.${{ env.PACKAGE_TYPE }}
path: ${{ env.ARTIFACT_PATH }}/${{ env.PACKAGE_TYPE }}
if-no-files-found: error
retention-days: 1
env:
RELEASE_TAG: ${{ github.ref == 'refs/heads/main' && format('{0}', 'release' ) || 'rc' }}







83 changes: 73 additions & 10 deletions VCL/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ android {
defaultConfig {
minSdk 24
targetSdk 33
// Increase version for release
versionName "1.20.1"
versionCode 115
versionCode 116
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
}
Expand All @@ -41,6 +42,13 @@ android {
shrinkResources false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
rc {
buildConfigField "String", "VERSION_NAME", "\"${defaultConfig.versionName}-rc\""
buildConfigField "int", "VERSION_CODE", "${defaultConfig.versionCode}"
minifyEnabled false
shrinkResources false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}

compileOptions {
Expand Down Expand Up @@ -96,6 +104,62 @@ artifacts {
afterEvaluate {
publishing {
publications {
rc(MavenPublication) {
groupId getGroupId()
artifactId getArtifactId()

// define rc version name
def vers = getVersionName()
def rcSuffix = rootProject.ext.rcSuffix
version = "${vers}-${rcSuffix}"

// Two artifacts, the `aar` (or `jar`) and the sources
if (project.plugins.findPlugin("com.android.library")) {
from components.release
} else {
from components.java
}

artifact androidSourcesJar

// Mostly self-explanatory metadata
pom {
name = getArtifactId()
// Library description
description = 'Velocity Career Labs Android library'
// Library Github URL
url = 'https://github.com/velocitycareerlabs/WalletAndroid'
licenses {
license {
name = 'Apache License 2.0'
// Library license
url = 'https://github.com/velocitycareerlabs/WalletAndroid/blob/dev/VCL/LICENSE'
}
}
developers {
developer {
id = 'velocitycareerlabs'
name = 'Michael Avoyan'
email = '[email protected]'
}
}

scm {
// Library info on Github
connection = 'scm:github.com/velocitycareerlabs/WalletAndroid.git'
developerConnection = 'scm:git:ssh://github.com/velocitycareerlabs/WalletAndroid.git'
url = 'https://github.com/velocitycareerlabs/WalletAndroid'
}
}
signing {
useInMemoryPgpKeys(
rootProject.ext.signingKeyId,
rootProject.ext.signingPrivateKey,
rootProject.ext.signingPassword,
)
// sign publishing.publications
}
}
release(MavenPublication) {
groupId getGroupId()
artifactId getArtifactId()
Expand Down Expand Up @@ -139,20 +203,19 @@ afterEvaluate {
url = 'https://github.com/velocitycareerlabs/WalletAndroid'
}
}
signing {
useInMemoryPgpKeys(
rootProject.ext.signingKeyId,
rootProject.ext.signingPrivateKey,
rootProject.ext.signingPassword,
)
// sign publishing.publications
}
}
}
}
}

signing {
useInMemoryPgpKeys(
rootProject.ext.signingKeyId,
rootProject.ext.signingPrivateKey,
rootProject.ext.signingPassword,
)
sign publishing.publications
}

repositories {
mavenCentral()
}
Expand Down
5 changes: 4 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = "1.7.21"
// Set "rc" suffix for VCL SDK release candidate
ext.rcSuffix = "rc"
repositories {
google()
mavenCentral()
Expand All @@ -16,6 +18,7 @@ buildscript {

plugins {
// Automation plugin
// https://github.com/gradle-nexus/publish-plugin
id "io.github.gradle-nexus.publish-plugin" version "1.1.0"
}

Expand All @@ -35,4 +38,4 @@ allprojects {

task clean(type: Delete) {
delete rootProject.buildDir
}
}
47 changes: 30 additions & 17 deletions publish-core.gradle
Original file line number Diff line number Diff line change
@@ -1,23 +1,32 @@
Properties properties = new Properties()
properties.load(new FileInputStream(rootProject.file(
'/Volumes/Keybase/team/velocitycareers/mobile/android/maven/sonatype.properties'
)))
def propertiesFilePath = '/Volumes/Keybase/team/velocitycareers/mobile/android/maven/nexus.properties'
def propertiesFile = new File(propertiesFilePath)
def properties = new Properties()

if (propertiesFile.exists()) {
try {
properties.load(new FileInputStream(propertiesFile))
} catch (IOException e) {
e.printStackTrace()
}
} else {
println "Properties file not found: $propertiesFilePath"
}

ext {
signingKeyId = System.getenv("SIGNING_KEY_ID") ?: properties["signingKeyId"]
signingPassword = System.getenv("SIGNING_PASSWORD") ?: properties["signingPassword"]
ossrhUsername = System.getenv("OSSRH_USERNAME") ?: properties["ossrhUsername"]
ossrhPassword = System.getenv("OSSRH_PASSWORD") ?: properties["ossrhPassword"]
sonatypeStagingProfileId = System.getenv("SONATYPE_STAGING_PROFILE_ID") ?: properties["sonatypeStagingProfileId"]
signingPrivateKey = System.getenv("SIGNING_KEY") ?: properties["signingPrivateKey"]
signingKeyId = System.getenv("ANDROID_NEXUS_SIGNING_KEY_ID") ?: properties["signingKeyId"]
signingPassword = System.getenv("ANDROID_NEXUS_SIGNING_PWD") ?: properties["signingPassword"]
ossrhUsername = System.getenv("ANDROID_NEXUS_OSSRH_USERNAME") ?: properties["ossrhUsername"]
ossrhPassword = System.getenv("ANDROID_NEXUS_OSSRH_PWD") ?: properties["ossrhPassword"]
sonatypeStagingProfileId = System.getenv("ANDROID_NEXUS_STAGING_PROFILE_ID") ?: properties["stagingProfileId"]
signingPrivateKey = System.getenv("ANDROID_NEXUS_PRIVATE_KEY") ?: properties["signingPrivateKey"]
}

//println("signingKeyId: ${signingKeyId}")
//println("signingPassword: ${signingPassword}")
//println("ossrhUsername: ${ossrhUsername}")
//println("ossrhPassword: ${ossrhPassword}")
//println("sonatypeStagingProfileId: ${sonatypeStagingProfileId}")
//println("signingPrivateKey: ${signingPrivateKey}")
// println("signingKeyId: ${signingKeyId}")
// println("signingPassword: ${signingPassword}")
// println("ossrhUsername: ${ossrhUsername}")
// println("ossrhPassword: ${ossrhPassword}")
// println("sonatypeStagingProfileId: ${sonatypeStagingProfileId}")
// println("signingPrivateKey: ${signingPrivateKey}")

nexusPublishing {
repositories {
Expand All @@ -29,4 +38,8 @@ nexusPublishing {
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
}
}
}
}

// Create custom tasks for publishing
task publishRelease(dependsOn: [':VCL:publishReleasePublicationToSonatypeRepository'])
task publishRc(dependsOn: [':VCL:publishRcPublicationToSonatypeRepository'])

0 comments on commit 3fc3502

Please sign in to comment.