Skip to content

Commit 142aeda

Browse files
Merge pull request #5 from michallaskowski/add-maven-publishing
Add maven publishing
2 parents e272e42 + 9775d9c commit 142aeda

File tree

3 files changed

+67
-4
lines changed

3 files changed

+67
-4
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Publish release
2+
on:
3+
release:
4+
types: [published]
5+
6+
jobs:
7+
publish_release:
8+
name: Publish Release
9+
runs-on: macOS-latest
10+
steps:
11+
- name: Checkout
12+
uses: actions/checkout@v2
13+
with:
14+
lfs: true
15+
- name: Cache gradle dependencies
16+
uses: actions/cache@v2
17+
with:
18+
path: ~/.gradle/caches
19+
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
20+
restore-keys: |
21+
${{ runner.os }}-gradle-
22+
- name: Cache Kotlin Native dependencies
23+
uses: actions/cache@v2
24+
with:
25+
path: |
26+
~/.konan/kotlin-native-macos-*
27+
~/.konan/dependencies
28+
key: ${{ runner.os }}-kotlin-native-${{ hashFiles('build.gradle') }}
29+
restore-keys: |
30+
${{ runner.os }}-kotlin-native-
31+
- name: Set up JDK 1.8
32+
uses: actions/setup-java@v1
33+
with:
34+
java-version: 1.8
35+
- name: Select Xcode 11.4
36+
run: sudo xcode-select -s /Applications/Xcode_11.4.app
37+
- name: Publish artifacts
38+
env:
39+
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
40+
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
41+
run: ./gradlew library:publish

build.gradle

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
// Top-level build file where you can add configuration options common to all sub-projects/modules.
2-
31
buildscript {
42
ext.kotlin_version = '1.3.72'
53
repositories {
@@ -15,10 +13,14 @@ buildscript {
1513
}
1614
}
1715

16+
plugins {
17+
id 'pl.allegro.tech.build.axion-release' version '1.12.0'
18+
}
19+
1820
allprojects {
1921

2022
group 'dev.michallaskowski.mokttp'
21-
version = '0.0.1'
23+
version = scmVersion.version
2224

2325
repositories {
2426
google()

library/build.gradle

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,24 @@ apply plugin: 'maven'
33
apply plugin: 'maven-publish'
44
apply plugin: 'com.android.library'
55

6+
publishing {
7+
publications {
8+
kotlinMultiplatform.artifactId = "mokttp-common"
9+
}
10+
repositories {
11+
maven {
12+
name = "central"
13+
def snapshotRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots"
14+
def stagingRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2"
15+
url = version.endsWith('SNAPSHOT') ? snapshotRepoUrl : stagingRepoUrl
16+
credentials {
17+
username = System.getenv("MAVEN_USERNAME")
18+
password = System.getenv("MAVEN_PASSWORD")
19+
}
20+
}
21+
}
22+
}
23+
624
android {
725
compileSdkVersion 29
826
defaultConfig {
@@ -52,7 +70,9 @@ kotlin {
5270
}
5371
}
5472

55-
fromPreset(presets.android, 'android')
73+
fromPreset(presets.android, 'android') {
74+
publishAllLibraryVariants()
75+
}
5676
}
5777

5878
sourceSets {

0 commit comments

Comments
 (0)