Skip to content

Commit

Permalink
Read version name from property when building
Browse files Browse the repository at this point in the history
Also remove references to version number where we cannot inject it.

COAND-1014
  • Loading branch information
OscarSpruit committed Nov 7, 2024
1 parent 7470c5d commit b0a13d7
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 14 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/publish_to_maven_central.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,12 @@ jobs:
# Packages and publishes to Maven Central
- name: Publish to Maven Central
run: ./gradlew publishReleasePublicationToSonatypeRepository --max-workers 1 --stacktrace -Pversion-name=${{ inputs.version-name }}
run: ./gradlew publishReleasePublicationToSonatypeRepository --max-workers 1 --stacktrace -Pversion-name=
env:
OSSRH_USERNAME: ${{ secrets.OSSRH_TOKEN_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_TOKEN_PASSWORD }}
SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }}
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
SIGNING_SECRET_KEY_RING_FILE: ${{ secrets.SIGNING_SECRET_KEY_RING_FILE }}
SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }}
VERSION_NAME: ${{ inputs.version-name }}
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,26 +31,26 @@ Import the corresponding module in your `build.gradle` file.

For Drop-in:
```groovy
implementation "com.adyen.checkout:drop-in-compose:5.7.0"
implementation "com.adyen.checkout:drop-in-compose:LATEST_VERSION"
```
For the Credit Card component:
```groovy
implementation "com.adyen.checkout:card:5.7.0"
implementation "com.adyen.checkout:components-compose:5.7.0"
implementation "com.adyen.checkout:card:LATEST_VERSION"
implementation "com.adyen.checkout:components-compose:LATEST_VERSION"
```

### Without Jetpack Compose

For Drop-in:
```groovy
implementation "com.adyen.checkout:drop-in:5.7.0"
implementation "com.adyen.checkout:drop-in:LATEST_VERSION"
```
For the Credit Card component:
```groovy
implementation "com.adyen.checkout:card:5.7.0"
implementation "com.adyen.checkout:card:LATEST_VERSION"
```

The library is available on [Maven Central][mavenRepo].
Find out what the latest version is [here](https://github.com/Adyen/adyen-android/releases/latest). The library is available on [Maven Central][mavenRepo].

## Additional documentation

Expand Down
5 changes: 5 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ apply from: "config/gradle/sonarcloud.gradle"
apply from: "config/gradle/apiValidator.gradle"

ext {
if (project.hasProperty("version-name")) {
versionName = project.property("version-name")
} else {
versionName = "develop"
}
checkoutRedirectScheme = "adyencheckout"
}

Expand Down
2 changes: 1 addition & 1 deletion config/gradle/buildConfig.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

android {
defaultConfig {
buildConfigField "String", "CHECKOUT_VERSION", "\"${libs.versions.version.name.get()}\""
buildConfigField "String", "CHECKOUT_VERSION", "\"$rootProject.ext.versionName\""
}

buildFeatures {
Expand Down
2 changes: 1 addition & 1 deletion config/gradle/release.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ if (secretPropsFile.exists()) {

final theGroupId = "com.adyen.checkout"
final theArtifactId = project.mavenArtifactId
final theVersion = libs.versions.version.name.get()
final theVersion = rootProject.ext.versionName

final theName = project.mavenArtifactName
final theDescription = project.mavenArtifactDescription
Expand Down
6 changes: 3 additions & 3 deletions example-app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ android {
minSdk libs.versions.min.sdk.get().toInteger()
targetSdk libs.versions.target.sdk.get().toInteger()
versionCode libs.versions.version.code.get().toInteger()
versionName libs.versions.version.name.get()
versionName rootProject.ext.versionName

testInstrumentationRunner 'com.adyen.checkout.test.HiltTestRunner'
}
Expand Down Expand Up @@ -71,8 +71,8 @@ dependencies {
// Checkout
implementation project(':drop-in')
implementation project(':components-compose')
// implementation "com.adyen.checkout:drop-in:5.7.0"
// implementation "com.adyen.checkout:components-compose:5.7.0"
// implementation "com.adyen.checkout:drop-in:LATEST_VERSION"
// implementation "com.adyen.checkout:components-compose:LATEST_VERSION"

// Dependencies
implementation libs.bundles.kotlin.coroutines
Expand Down
2 changes: 0 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ min-sdk = "21"

# App version, only used for example app, no need to increment
version-code = "1"
# The version-name format is "major.minor.patch(-(alpha|beta|rc)[0-9]{2}){0,1}" (e.g. 3.0.0, 3.1.1-alpha04 or 3.1.4-rc01 etc).
version-name = "5.7.0"

# Build script
android-gradle-plugin = "8.7.1"
Expand Down

0 comments on commit b0a13d7

Please sign in to comment.