Skip to content

Commit 679ddb0

Browse files
committed
Set versionName and no versionCode
1 parent 97a1be5 commit 679ddb0

File tree

2 files changed

+37
-56
lines changed

2 files changed

+37
-56
lines changed

gradle/gradle-mvn-push.gradle

-53
This file was deleted.

native-bridge/build.gradle

+37-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
apply plugin: 'com.android.library'
22
apply plugin: 'kotlin-android'
3+
apply plugin: 'maven-publish'
4+
5+
def getGitHash() {
6+
def stdout = new ByteArrayOutputStream()
7+
exec {
8+
commandLine 'git', 'rev-parse', '--short', 'HEAD'
9+
standardOutput = stdout
10+
}
11+
return stdout.toString().trim()
12+
}
13+
14+
def runId = System.getenv("GITHUB_RUN_NUMBER") ?: "0"
15+
16+
def versionNumber = "1.0.${runId}-${getGitHash()}" as String
317

418
buildscript {
519
repositories {
@@ -18,8 +32,7 @@ android {
1832
defaultConfig {
1933
minSdkVersion 17
2034
targetSdkVersion 33
21-
versionCode 3
22-
versionName "1.0.2"
35+
versionName "$versionNumber"
2336
multiDexEnabled true
2437

2538
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
@@ -47,4 +60,25 @@ dependencies {
4760
api "com.fasterxml.jackson.module:jackson-module-kotlin:$jackson"
4861
}
4962

50-
apply from: rootProject.file('gradle/gradle-mvn-push.gradle')
63+
afterEvaluate {
64+
publishing {
65+
publications {
66+
mavenPublish(MavenPublication) {
67+
groupId 'no.nrk'
68+
artifactId 'nativebridge'
69+
version = versionNumber
70+
}
71+
}
72+
73+
repositories {
74+
maven {
75+
name = "GitHubPackages"
76+
url = "https://maven.pkg.github.com/nrkno/nativebridge-android"
77+
credentials {
78+
username System.getenv("GITHUB_ACTOR")
79+
password System.getenv("GITHUB_TOKEN")
80+
}
81+
}
82+
}
83+
}
84+
}

0 commit comments

Comments
 (0)